diff options
| author | DJ Delorie <dj@delorie.com> | 2016-07-19 22:22:46 -0400 |
|---|---|---|
| committer | DJ Delorie <dj@delorie.com> | 2016-07-19 22:22:46 -0400 |
| commit | f57aaed3b2fb73aa3ecc40e5afa1030681c93bf4 (patch) | |
| tree | f5bfc008fa28d68fa58fad8313006239275f34c6 /malloc | |
| parent | 2c5e3bf401fa46ca2545820a68b4c2b5c1ee1bce (diff) | |
| download | glibc-f57aaed3b2fb73aa3ecc40e5afa1030681c93bf4.tar.xz glibc-f57aaed3b2fb73aa3ecc40e5afa1030681c93bf4.zip | |
Minor tweaks to trace_run and trace2wl
trace_run - fix realloc returning NULL behavior
trace2wl - hard stop on multi-level inversion, print number
of fixed inversions.
Diffstat (limited to 'malloc')
| -rw-r--r-- | malloc/trace2wl.cc | 11 | ||||
| -rw-r--r-- | malloc/trace_run.c | 14 |
2 files changed, 14 insertions, 11 deletions
diff --git a/malloc/trace2wl.cc b/malloc/trace2wl.cc index 5cab4755d9..e1e8bb684b 100644 --- a/malloc/trace2wl.cc +++ b/malloc/trace2wl.cc @@ -182,6 +182,7 @@ PerThread *master_thread = NULL; int last_tid = -1; PerThread *thread = NULL; int pending_inversions = 0; +int fixed_inversions = 0; static void process_one_trace_record (__malloc_trace_buffer_s *r) @@ -231,8 +232,14 @@ process_one_trace_record (__malloc_trace_buffer_s *r) if (pa2 && pa2->valid) { if (pa2->inverted) - printf ("%d: pointer %p alloc'd again? %d:%s\n", i, pa2->ptr, pa2->reason_idx, pa2->reason); + { + printf ("%d: pointer %p alloc'd again? (possible multi-level inversion) size %d %d:%s\n", + i, pa2->ptr, (int)r->size, pa2->reason_idx, pa2->reason); + exit (1); + } + printf("inversion for type %d\n", r->type); pa2->inverted = r; + fixed_inversions ++; pending_inversions ++; return; } @@ -468,6 +475,8 @@ main(int argc, char **argv) if (pending_inversions) printf("%d pending inversions remain\n", pending_inversions); + if (fixed_inversions) + printf("%d inversions fixed\n", fixed_inversions); return 0; } diff --git a/malloc/trace_run.c b/malloc/trace_run.c index 3b74ce3fb9..91331e4946 100644 --- a/malloc/trace_run.c +++ b/malloc/trace_run.c @@ -413,19 +413,13 @@ thread_common (void *my_data_v) myabort(); if (p2 > n_ptrs) myabort(); + /* we can't force realloc to return NULL (fail), so just skip it. */ + if (p2 == 0) + break; + if (ptrs[p1]) atomic_rss (-sizes[p1]); free_wipe(p1); - /* we can't force realloc to return NULL (fail), so just skip it. */ - if (p2 == 0) - { - if (p1) - { - free ((void *)ptrs[p1]); - ptrs[p1] = 0; - } - break; - } stime = rdtsc_s(); Q1; #ifdef MDEBUG |
