]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Addition of v.info scheduler monitor command
authorJulian Seward <jseward@acm.org>
Sat, 22 Oct 2011 20:23:30 +0000 (20:23 +0000)
committerJulian Seward <jseward@acm.org>
Sat, 22 Oct 2011 20:23:30 +0000 (20:23 +0000)
Monitor command useful for debugging/investigation of Valgrind unwinder and/or
gdbserver/gdb stack trace.

The Valgrind unwinder has some limitations compared to the GDB unwinder.
(see e.g. 278972).

With this monitor command, it is easy to see if the Valgrind unwinder
produces something different than the GDB unwinder.

Fixes #279212.  (Philippe Waroquiers, philippe.waroquiers@skynet.be)

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

coregrind/m_gdbserver/server.c
docs/xml/manual-core-adv.xml
gdbserver_tests/mchelp.stdoutB.exp

index d1f519e80c3f4205f2ce5c9730dd2370f0680882..6dc5e1ad14123bf0025d2875dda10f0e14817750 100644 (file)
@@ -172,6 +172,7 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return)
 "debugging valgrind internals monitor commands:\n"
 "  v.info gdbserver_status : show gdbserver status\n"
 "  v.info memory           : show valgrind heap memory stats\n"
+"  v.info scheduler        : show valgrind thread state and stacktrace\n"
 "  v.set debuglog <level>  : set valgrind debug log level to <level>\n"
 "  v.translate <addr> [<traceflags>]  : debug translation of <addr> with <traceflags>\n"
 "    (default traceflags 0b00100000 : show after instrumentation)\n"
@@ -234,7 +235,8 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return)
       ret = 1;
       wcmd = strtok_r (NULL, " ", &ssaveptr);
       switch (kwdid = VG_(keyword_id) 
-              ("all_errors n_errs_found last_error gdbserver_status memory",
+              ("all_errors n_errs_found last_error gdbserver_status memory"
+               " scheduler",
                wcmd, kwd_report_all)) {
       case -2:
       case -1: 
@@ -260,6 +262,10 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return)
             VG_(print_arena_cc_analysis) ();
          ret = 1;
          break;
+      case  5: /* scheduler */
+         VG_(show_sched_status) ();
+         ret = 1;
+         break;
       default:
          vg_assert(0);
       }
index 3004fda16de867597ef5863e47ae7041ab87d8af..042c2c3d9ebce326a6ec924912c57c83f7a508a6 100644 (file)
@@ -1182,6 +1182,24 @@ problems or bugs.</para>
     </para>
   </listitem>
 
+  <listitem>
+    <para><varname>v.info scheduler</varname> shows the state and
+    stack trace for all threads, as known by Valgrind.  This allows to
+    compare the stack traces produced by the Valgrind unwinder with
+    the stack traces produced by GDB+Valgrind gdbserver. Pay attention
+    that GDB and Valgrind scheduler status have their own thread
+    numbering scheme. To make the link between the GDB thread
+    number and the corresponding Valgrind scheduler thread number,
+    use the GDB command <computeroutput>info
+    threads</computeroutput>.  The output of this command shows the
+    GDB thread number and the valgrind 'tid'. The 'tid' is the thread number
+    output by <computeroutput>v.info scheduler</computeroutput>.
+    When using the callgrind tool, the callgrind monitor command
+    <computeroutput>status</computeroutput> outputs internal callgrind
+    information about the stack/call graph it maintains.
+    </para>
+  </listitem>
+
   <listitem>
     <para><varname>v.set debuglog &lt;intvalue&gt;</varname> sets the
     Valgrind debug log level to &lt;intvalue&gt;.  This allows to
index d9c7e63b8f65daed9eac0d2cb0995599d587e677..de9f74f2b2cf21885504c650546f62684ba7954b 100644 (file)
@@ -41,6 +41,7 @@ general valgrind monitor commands:
 debugging valgrind internals monitor commands:
   v.info gdbserver_status : show gdbserver status
   v.info memory           : show valgrind heap memory stats
+  v.info scheduler        : show valgrind thread state and stacktrace
   v.set debuglog <level>  : set valgrind debug log level to <level>
   v.translate <addr> [<traceflags>]  : debug translation of <addr> with <traceflags>
     (default traceflags 0b00100000 : show after instrumentation)