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@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..1457a11 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 sr_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 sr_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 *
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@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 *
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@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 *
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@redhat.com --- lib/core_frame.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/lib/core_frame.c b/lib/core_frame.c index afdeb55..074de56 100644 --- a/lib/core_frame.c +++ b/lib/core_frame.c @@ -180,21 +180,33 @@ int sr_core_frame_cmp_distance(struct sr_core_frame *frame1, struct sr_core_frame *frame2) { - /* TODO: we should not rely on function name and we definitely should use - * build id */ - /* 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 *
Thanks! Pushed.
On 06/26/2013 11:40 AM, 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@redhat.com
lib/core_frame.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/lib/core_frame.c b/lib/core_frame.c index afdeb55..074de56 100644 --- a/lib/core_frame.c +++ b/lib/core_frame.c @@ -180,21 +180,33 @@ int sr_core_frame_cmp_distance(struct sr_core_frame *frame1, struct sr_core_frame *frame2) {
- /* TODO: we should not rely on function name and we definitely should use
* build id */
- /* 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 *
crash-catcher@lists.fedorahosted.org