]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Show backtraces for all threads in vg_assert, VG_(panic) and
authorJulian Seward <jseward@acm.org>
Wed, 17 Apr 2002 19:35:12 +0000 (19:35 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 17 Apr 2002 19:35:12 +0000 (19:35 +0000)
VG_(unimplemented).  In future this will not be enabled by default due
to the danger of recursion of assertion failures.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@92

coregrind/vg_include.h
coregrind/vg_main.c
coregrind/vg_mylibc.c
coregrind/vg_scheduler.c
vg_include.h
vg_main.c
vg_mylibc.c
vg_scheduler.c

index cd831c8d24fa828726fb4ee9ceeea4cdf84cceb0..c4ba60310b51b005bae6ee0140900629b800d930 100644 (file)
@@ -550,6 +550,7 @@ extern VgSchedReturnCode VG_(scheduler) ( void );
 
 extern void VG_(scheduler_init) ( void );
 
+extern void VG_(pp_sched_status) ( void );
 
 /* vg_oursignalhandler() might longjmp().  Here's the jmp_buf. */
 extern jmp_buf VG_(scheduler_jmpbuf);
index 06b2e978f1353875c5d99da125c55905a54787f8..7c7f61219e3b082a7470ce831f7db534117fa01f 100644 (file)
@@ -1152,6 +1152,7 @@ extern void VG_(unimplemented) ( Char* msg )
       "Valgrind has to exit now.  Sorry.  Bye!");
    VG_(message)(Vg_UserMsg,
       "");
+   VG_(pp_sched_status)();
    VG_(exit)(1);
 }
 
index c8ff2cb8dc9d0396ea814095df21324cf449c74f..2b92a8b66468353fea0fb977a7e8c4dcd9b5cf62 100644 (file)
@@ -843,6 +843,7 @@ void VG_(assert_fail) ( Char* expr, Char* file, Int line, Char* fn )
 {
    VG_(printf)("\n%s: %s:%d (%s): Assertion `%s' failed.\n",
                "valgrind", file, line, fn, expr );
+   VG_(pp_sched_status)();
    VG_(printf)("Please report this bug to me at: %s\n\n", EMAIL_ADDR);
    VG_(shutdown_logging)();
    VG_(exit)(1);
@@ -852,6 +853,7 @@ void VG_(panic) ( Char* str )
 {
    VG_(printf)("\nvalgrind: the `impossible' happened:\n   %s\n", str);
    VG_(printf)("Basic block ctr is approximately %llu\n", VG_(bbs_done) );
+   VG_(pp_sched_status)();
    VG_(printf)("Please report this bug to me at: %s\n\n", EMAIL_ADDR);
    VG_(shutdown_logging)();
    VG_(exit)(1);
index 770fbd37827a6bd8df838272cf74e0a8ca6a57c8..b2aa9dda58fc886e2fb53b19f11db142139c928a 100644 (file)
@@ -127,14 +127,14 @@ static void do_nontrivial_clientreq ( ThreadId tid );
    Helper functions for the scheduler.
    ------------------------------------------------------------------ */
 
-static
-void pp_sched_status ( void )
+/* Print the scheduler status. */
+void VG_(pp_sched_status) ( void )
 {
    Int i; 
    VG_(printf)("\nsched status:\n"); 
    for (i = 0; i < VG_N_THREADS; i++) {
       if (vg_threads[i].status == VgTs_Empty) continue;
-      VG_(printf)("tid %d:  ", i);
+      VG_(printf)("\nThread %d: status = ", i);
       switch (vg_threads[i].status) {
          case VgTs_Runnable:   VG_(printf)("Runnable\n"); break;
          case VgTs_WaitFD:     VG_(printf)("WaitFD\n"); break;
@@ -144,6 +144,9 @@ void pp_sched_status ( void )
          case VgTs_Sleeping:   VG_(printf)("Sleeping\n"); break;
          default: VG_(printf)("???"); break;
       }
+      VG_(pp_ExeContext)( 
+         VG_(get_ExeContext)( False, vg_threads[i].m_eip, 
+                                     vg_threads[i].m_ebp ));
    }
    VG_(printf)("\n");
 }
@@ -992,7 +995,7 @@ VgSchedReturnCode VG_(scheduler) ( void )
             /* No runnable threads and no prospect of any appearing
                even if we wait for an arbitrary length of time.  In
                short, we have a deadlock. */
-           pp_sched_status();
+           VG_(pp_sched_status)();
             return VgSrc_Deadlock;
          }
 
@@ -1098,7 +1101,7 @@ VgSchedReturnCode VG_(scheduler) ( void )
          VG_(message)(Vg_DebugMsg, "thread %d:  %ld bbs, event %s", 
                                    tid, VG_(bbs_done),
                                    name_of_sched_event(trc) );
-
+      vg_assert(VG_(bbs_done) < 1000000);
       /* Examine the thread's return code to figure out why it
          stopped, and handle requests. */
 
index cd831c8d24fa828726fb4ee9ceeea4cdf84cceb0..c4ba60310b51b005bae6ee0140900629b800d930 100644 (file)
@@ -550,6 +550,7 @@ extern VgSchedReturnCode VG_(scheduler) ( void );
 
 extern void VG_(scheduler_init) ( void );
 
+extern void VG_(pp_sched_status) ( void );
 
 /* vg_oursignalhandler() might longjmp().  Here's the jmp_buf. */
 extern jmp_buf VG_(scheduler_jmpbuf);
index 06b2e978f1353875c5d99da125c55905a54787f8..7c7f61219e3b082a7470ce831f7db534117fa01f 100644 (file)
--- a/vg_main.c
+++ b/vg_main.c
@@ -1152,6 +1152,7 @@ extern void VG_(unimplemented) ( Char* msg )
       "Valgrind has to exit now.  Sorry.  Bye!");
    VG_(message)(Vg_UserMsg,
       "");
+   VG_(pp_sched_status)();
    VG_(exit)(1);
 }
 
index c8ff2cb8dc9d0396ea814095df21324cf449c74f..2b92a8b66468353fea0fb977a7e8c4dcd9b5cf62 100644 (file)
@@ -843,6 +843,7 @@ void VG_(assert_fail) ( Char* expr, Char* file, Int line, Char* fn )
 {
    VG_(printf)("\n%s: %s:%d (%s): Assertion `%s' failed.\n",
                "valgrind", file, line, fn, expr );
+   VG_(pp_sched_status)();
    VG_(printf)("Please report this bug to me at: %s\n\n", EMAIL_ADDR);
    VG_(shutdown_logging)();
    VG_(exit)(1);
@@ -852,6 +853,7 @@ void VG_(panic) ( Char* str )
 {
    VG_(printf)("\nvalgrind: the `impossible' happened:\n   %s\n", str);
    VG_(printf)("Basic block ctr is approximately %llu\n", VG_(bbs_done) );
+   VG_(pp_sched_status)();
    VG_(printf)("Please report this bug to me at: %s\n\n", EMAIL_ADDR);
    VG_(shutdown_logging)();
    VG_(exit)(1);
index 770fbd37827a6bd8df838272cf74e0a8ca6a57c8..b2aa9dda58fc886e2fb53b19f11db142139c928a 100644 (file)
@@ -127,14 +127,14 @@ static void do_nontrivial_clientreq ( ThreadId tid );
    Helper functions for the scheduler.
    ------------------------------------------------------------------ */
 
-static
-void pp_sched_status ( void )
+/* Print the scheduler status. */
+void VG_(pp_sched_status) ( void )
 {
    Int i; 
    VG_(printf)("\nsched status:\n"); 
    for (i = 0; i < VG_N_THREADS; i++) {
       if (vg_threads[i].status == VgTs_Empty) continue;
-      VG_(printf)("tid %d:  ", i);
+      VG_(printf)("\nThread %d: status = ", i);
       switch (vg_threads[i].status) {
          case VgTs_Runnable:   VG_(printf)("Runnable\n"); break;
          case VgTs_WaitFD:     VG_(printf)("WaitFD\n"); break;
@@ -144,6 +144,9 @@ void pp_sched_status ( void )
          case VgTs_Sleeping:   VG_(printf)("Sleeping\n"); break;
          default: VG_(printf)("???"); break;
       }
+      VG_(pp_ExeContext)( 
+         VG_(get_ExeContext)( False, vg_threads[i].m_eip, 
+                                     vg_threads[i].m_ebp ));
    }
    VG_(printf)("\n");
 }
@@ -992,7 +995,7 @@ VgSchedReturnCode VG_(scheduler) ( void )
             /* No runnable threads and no prospect of any appearing
                even if we wait for an arbitrary length of time.  In
                short, we have a deadlock. */
-           pp_sched_status();
+           VG_(pp_sched_status)();
             return VgSrc_Deadlock;
          }
 
@@ -1098,7 +1101,7 @@ VgSchedReturnCode VG_(scheduler) ( void )
          VG_(message)(Vg_DebugMsg, "thread %d:  %ld bbs, event %s", 
                                    tid, VG_(bbs_done),
                                    name_of_sched_event(trc) );
-
+      vg_assert(VG_(bbs_done) < 1000000);
       /* Examine the thread's return code to figure out why it
          stopped, and handle requests. */