From: Julian Seward Date: Sat, 22 Oct 2011 20:23:30 +0000 (+0000) Subject: Addition of v.info scheduler monitor command X-Git-Tag: svn/VALGRIND_3_7_0~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a07f759681bb85e2f768e418d77e3e1b1c71f0f3;p=thirdparty%2Fvalgrind.git 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, philippe.waroquiers@skynet.be) git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12203 --- diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index d1f519e80c..6dc5e1ad14 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -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 : set valgrind debug log level to \n" " v.translate [] : debug translation of with \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); } diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml index 3004fda16d..042c2c3d9e 100644 --- a/docs/xml/manual-core-adv.xml +++ b/docs/xml/manual-core-adv.xml @@ -1182,6 +1182,24 @@ problems or bugs. + + v.info scheduler 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 info + threads. The output of this command shows the + GDB thread number and the valgrind 'tid'. The 'tid' is the thread number + output by v.info scheduler. + When using the callgrind tool, the callgrind monitor command + status outputs internal callgrind + information about the stack/call graph it maintains. + + + v.set debuglog <intvalue> sets the Valgrind debug log level to <intvalue>. This allows to diff --git a/gdbserver_tests/mchelp.stdoutB.exp b/gdbserver_tests/mchelp.stdoutB.exp index d9c7e63b8f..de9f74f2b2 100644 --- a/gdbserver_tests/mchelp.stdoutB.exp +++ b/gdbserver_tests/mchelp.stdoutB.exp @@ -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 : set valgrind debug log level to v.translate [] : debug translation of with (default traceflags 0b00100000 : show after instrumentation)