]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make loss record ordering more deterministic, so that regtests are reliable.
authorNicholas Nethercote <njn@valgrind.org>
Wed, 6 May 2009 06:52:47 +0000 (06:52 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 6 May 2009 06:52:47 +0000 (06:52 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9784

memcheck/mc_leakcheck.c
memcheck/tests/leak-cases-full.stderr.exp

index a3fdd8f7c9c6c92a80111367225cacfc3448f35d..1a402df6807c8e7dd12d15b1fa728e7d6caba222 100644 (file)
@@ -782,6 +782,15 @@ static Int cmp_LossRecords(void* va, void* vb)
    // If size are equal, compare by states.
    if (lr_a->key.state < lr_b->key.state) return -1;
    if (lr_a->key.state > lr_b->key.state) return  1;
+   // If they're still equal here, it doesn't matter that much, but we keep
+   // comparing other things so that regtests are as deterministic as
+   // possible.  So:  compare num_blocks.
+   if (lr_a->num_blocks < lr_b->num_blocks) return -1;
+   if (lr_a->num_blocks > lr_b->num_blocks) return  1;
+   // Finally, compare ExeContext addresses... older ones are likely to have
+   // lower addresses.
+   if (lr_a->key.allocated_at < lr_b->key.allocated_at) return -1;
+   if (lr_a->key.allocated_at > lr_b->key.allocated_at) return  1;
    return 0;
 }
 
index 832e0bbfa919b35027bc0e4cc11cc4f6b062cc2b..08447a7cdb8c18e21f0d278cf9704f927ad36a2b 100644 (file)
@@ -6,42 +6,42 @@ suppressed:   0 bytes in  0 blocks
 16 bytes in 1 blocks are possibly lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
    by 0x........: mk (leak-cases.c:52)
-   by 0x........: f (leak-cases.c:87)
+   by 0x........: f (leak-cases.c:78)
    by 0x........: main (leak-cases.c:107)
 
 
 16 bytes in 1 blocks are possibly lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
    by 0x........: mk (leak-cases.c:52)
-   by 0x........: f (leak-cases.c:87)
+   by 0x........: f (leak-cases.c:81)
    by 0x........: main (leak-cases.c:107)
 
 
 16 bytes in 1 blocks are possibly lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
    by 0x........: mk (leak-cases.c:52)
-   by 0x........: f (leak-cases.c:78)
+   by 0x........: f (leak-cases.c:84)
    by 0x........: main (leak-cases.c:107)
 
 
 16 bytes in 1 blocks are possibly lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
    by 0x........: mk (leak-cases.c:52)
-   by 0x........: f (leak-cases.c:81)
+   by 0x........: f (leak-cases.c:84)
    by 0x........: main (leak-cases.c:107)
 
 
 16 bytes in 1 blocks are possibly lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
    by 0x........: mk (leak-cases.c:52)
-   by 0x........: f (leak-cases.c:84)
+   by 0x........: f (leak-cases.c:87)
    by 0x........: main (leak-cases.c:107)
 
 
 16 bytes in 1 blocks are possibly lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
    by 0x........: mk (leak-cases.c:52)
-   by 0x........: f (leak-cases.c:84)
+   by 0x........: f (leak-cases.c:87)
    by 0x........: main (leak-cases.c:107)