[mprof-report] Don't print a thread with a zero thread ID in the summary.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Tue, 5 Apr 2016 22:42:54 +0000 (00:42 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Wed, 6 Apr 2016 00:28:56 +0000 (02:28 +0200)
Log buffers can end up with a zero thread ID when we synthesize events on the
writer thread, leading to mprof-report thinking a thread exists with that ID.
We simply ignore the "zero thread" in the thread summary.

mono/profiler/decode.c

index c72ee0dfb868ab2488d97760df908a6e2cad29aa..10eaba51c6ce6d7bce0d68888f4666b44bf9c18c 100644 (file)
@@ -3150,7 +3150,9 @@ dump_threads (ProfContext *ctx)
        ThreadContext *thread;
        fprintf (outfile, "\nThread summary\n");
        for (thread = ctx->threads; thread; thread = thread->next) {
-               fprintf (outfile, "\tThread: %p, name: \"%s\"\n", (void*)thread->thread_id, thread->name? thread->name: "");
+               if (thread->thread_id) {
+                       fprintf (outfile, "\tThread: %p, name: \"%s\"\n", (void*)thread->thread_id, thread->name? thread->name: "");
+               }
        }
 }