|
From: <sv...@va...> - 2011-10-22 20:28:14
|
Author: sewardj
Date: 2011-10-22 21:23:30 +0100 (Sat, 22 Oct 2011)
New Revision: 12203
Log:
Addition of v.info scheduler monitor command
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, phi...@sk...)
Modified:
trunk/coregrind/m_gdbserver/server.c
trunk/docs/xml/manual-core-adv.xml
trunk/gdbserver_tests/mchelp.stdoutB.exp
Modified: trunk/coregrind/m_gdbserver/server.c
===================================================================
--- trunk/coregrind/m_gdbserver/server.c 2011-10-22 19:48:57 UTC (rev 12202)
+++ trunk/coregrind/m_gdbserver/server.c 2011-10-22 20:23:30 UTC (rev 12203)
@@ -172,6 +172,7 @@
"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 @@
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 @@
VG_(print_arena_cc_analysis) ();
ret = 1;
break;
+ case 5: /* scheduler */
+ VG_(show_sched_status) ();
+ ret = 1;
+ break;
default:
vg_assert(0);
}
Modified: trunk/docs/xml/manual-core-adv.xml
===================================================================
--- trunk/docs/xml/manual-core-adv.xml 2011-10-22 19:48:57 UTC (rev 12202)
+++ trunk/docs/xml/manual-core-adv.xml 2011-10-22 20:23:30 UTC (rev 12203)
@@ -1183,6 +1183,24 @@
</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 <intvalue></varname> sets the
Valgrind debug log level to <intvalue>. This allows to
dynamically change the log level of Valgrind e.g. when a problem
Modified: trunk/gdbserver_tests/mchelp.stdoutB.exp
===================================================================
--- trunk/gdbserver_tests/mchelp.stdoutB.exp 2011-10-22 19:48:57 UTC (rev 12202)
+++ trunk/gdbserver_tests/mchelp.stdoutB.exp 2011-10-22 20:23:30 UTC (rev 12203)
@@ -41,6 +41,7 @@
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)
|