[SATYR PATCHv2] Use build id when comparing core frames for distance
Richard Marko
rmarko at redhat.com
Tue Jun 25 15:10:25 UTC 2013
This one doesn't fit on current head, would you please send a rebased
version?
On 06/18/2013 12:38 PM, Martin Milata wrote:
> The function names might not be known and the fingerprints are
> unreliable. On the other hand, we should always have build ID, which is
> also very reliable.
>
> Fixes #91.
>
> Signed-off-by: Martin Milata <mmilata at redhat.com>
> ---
> lib/core_frame.c | 36 +++++++++++++++++++++++++-----------
> 1 file changed, 25 insertions(+), 11 deletions(-)
>
> diff --git a/lib/core_frame.c b/lib/core_frame.c
> index a2d1ef0..cb96e2b 100644
> --- a/lib/core_frame.c
> +++ b/lib/core_frame.c
> @@ -176,19 +176,33 @@ int
> sr_core_frame_cmp_distance(struct sr_core_frame *frame1,
> struct sr_core_frame *frame2)
> {
> - /* Function name. */
> - int function_name = sr_strcmp0(frame1->function_name,
> - frame2->function_name);
> - if (function_name != 0)
> - return function_name;
> + /* If both function names are present, compare those. */
> + if (frame1->function_name && frame2->function_name)
> + return strcmp(frame1->function_name, frame2->function_name);
>
> - /* Fingerprint. */
> - int fingerprint = sr_strcmp0(frame1->fingerprint,
> - frame2->fingerprint);
> - if (fingerprint != 0)
> - return fingerprint;
> + /* Try matching build ID and offset. */
> + int build_id = sr_strcmp0(frame1->build_id,
> + frame2->build_id);
>
> - return 0;
> + int build_id_offset = frame1->build_id_offset - frame2->build_id_offset;
> +
> + if (build_id == 0 && build_id_offset == 0)
> + return 0;
> +
> + /* Build ID mismatch - this might still mean that the frames are the same
> + * but from a different build. Try falling back to fingerprints if those
> + * are present.
> + */
> + if (frame1->fingerprint && frame2->fingerprint)
> + return strcmp(frame1->fingerprint, frame2->fingerprint);
> +
> + /* Fingerprints are not present, return the result of build ID and offset
> + * comparison.
> + */
> + if (build_id)
> + return build_id;
> +
> + return build_id_offset;
> }
>
> struct sr_core_frame *
--
Richard Marko
More information about the Crash-catcher
mailing list