|
From: <sv...@va...> - 2013-01-23 22:10:37
|
philippe 2013-01-23 22:10:28 +0000 (Wed, 23 Jan 2013)
New Revision: 13262
Log:
Implement the gdbsrv monitor command v.do expensive_sanity_check_general
(useful to check the sanity of valgrind on request and/or from GDB,
when an error is reported by the tool).
Also re-order the NEWS entries to put the internals things after
the user level new functions.
Modified files:
trunk/NEWS
trunk/coregrind/m_gdbserver/server.c
trunk/docs/xml/manual-core-adv.xml
trunk/gdbserver_tests/mchelp.stdoutB.exp
Modified: trunk/gdbserver_tests/mchelp.stdoutB.exp (+1 -0)
===================================================================
--- trunk/gdbserver_tests/mchelp.stdoutB.exp 2013-01-23 21:46:22 +00:00 (rev 13261)
+++ trunk/gdbserver_tests/mchelp.stdoutB.exp 2013-01-23 22:10:28 +00:00 (rev 13262)
@@ -54,6 +54,7 @@
v.set merge-recursive-frames <num> : merge recursive calls in max <num> frames
v.set vgdb-error <errornr> : debug me at error >= <errornr>
debugging valgrind internals monitor commands:
+ v.do expensive_sanity_check_general : do an expensive sanity check now
v.info gdbserver_status : show gdbserver status
v.info memory [aspacemgr] : show valgrind heap memory stats
(with aspacemgr arg, also shows valgrind segments on log ouput)
Modified: trunk/coregrind/m_gdbserver/server.c (+22 -1)
===================================================================
--- trunk/coregrind/m_gdbserver/server.c 2013-01-23 21:46:22 +00:00 (rev 13261)
+++ trunk/coregrind/m_gdbserver/server.c 2013-01-23 22:10:28 +00:00 (rev 13262)
@@ -146,7 +146,8 @@
/* NB: if possible, avoid introducing a new command below which
starts with the same 3 first letters as an already existing
command. This ensures a shorter abbreviation for the user. */
- switch (VG_(keyword_id) ("help v.set v.info v.wait v.kill v.translate",
+ switch (VG_(keyword_id) ("help v.set v.info v.wait v.kill v.translate"
+ " v.do",
wcmd, kwd_report_duplicated_matches)) {
case -2:
ret = 1;
@@ -183,6 +184,7 @@
" v.set vgdb-error <errornr> : debug me at error >= <errornr> \n");
if (int_value) { VG_(gdb_printf) (
"debugging valgrind internals monitor commands:\n"
+" v.do expensive_sanity_check_general : do an expensive sanity check now\n"
" v.info gdbserver_status : show gdbserver status\n"
" v.info memory [aspacemgr] : show valgrind heap memory stats\n"
" (with aspacemgr arg, also shows valgrind segments on log ouput)\n"
@@ -375,6 +377,25 @@
break;
}
+ case 6: /* v.do */
+ ret = 1;
+ wcmd = strtok_r (NULL, " ", &ssaveptr);
+ switch (VG_(keyword_id) ("expensive_sanity_check_general",
+ wcmd, kwd_report_all)) {
+ case -2:
+ case -1: break;
+ case 0: { /* expensive_sanity_check_general */
+ // Temporarily bump up sanity level to check e.g. the malloc arenas.
+ const Int save_clo_sanity_level = VG_(clo_sanity_level);
+ if (VG_(clo_sanity_level) < 4) VG_(clo_sanity_level) = 4;
+ VG_(sanity_check_general) (/* force_expensive */ True);
+ VG_(clo_sanity_level) = save_clo_sanity_level;
+ break;
+ }
+ default: tl_assert (0);
+ }
+ break;
+
default:
vg_assert (0);
}
Modified: trunk/NEWS (+12 -8)
===================================================================
--- trunk/NEWS 2013-01-23 21:46:22 +00:00 (rev 13261)
+++ trunk/NEWS 2013-01-23 22:10:28 +00:00 (rev 13262)
@@ -22,14 +22,6 @@
* ==================== OTHER CHANGES ====================
- - Addition of GDB server monitor command 'v.info open_fds' that gives the
- list of open file descriptors and additional details.
-
- - Addition of GDB server monitor command 'v.info execontext' that shows
- information about the stack traces recorded by Valgrind.
- This can be used to analyse one possible cause of Valgrind high
- memory usage for some programs.
-
- Option --merge-recursive-frames=<number> tells Valgrind to
detect and merge (collapse) recursive calls when recording stack traces.
When your program has recursive algorithms, this limits
@@ -42,6 +34,18 @@
This can be used to execute gdbserver monitor commands from
the client program.
+ - Addition of GDB server monitor command 'v.info open_fds' that gives the
+ list of open file descriptors and additional details.
+
+ - Addition of GDB server monitor command 'v.info execontext' that shows
+ information about the stack traces recorded by Valgrind.
+ This can be used to analyse one possible cause of Valgrind high
+ memory usage for some programs.
+
+ - Addition of GDB server monitor command
+ 'v.do expensive_sanity_check_general' that checks the sanity
+ of various Valgrind aspects, including the Valgrind heap.
+
* ==================== FIXED BUGS ====================
The following bugs have been fixed or resolved. Note that "n-i-bz"
Modified: trunk/docs/xml/manual-core-adv.xml (+11 -0)
===================================================================
--- trunk/docs/xml/manual-core-adv.xml 2013-01-23 21:46:22 +00:00 (rev 13261)
+++ trunk/docs/xml/manual-core-adv.xml 2013-01-23 22:10:28 +00:00 (rev 13262)
@@ -1360,6 +1360,17 @@
<itemizedlist>
<listitem>
+ <para><varname>v.do expensive_sanity_check_general</varname>
+ executes various sanity checks. In particular, the sanity of the
+ Valgrind heap is verified. This can be useful if you suspect that
+ your program and/or Valgrind has a bug corrupting Valgrind data
+ structure. It can also be used when a Valgrind tool
+ reports a client error to the connected GDB, in order to verify
+ the sanity of Valgrind before continuing the execution.
+ </para>
+ </listitem>
+
+ <listitem>
<para><varname>v.info gdbserver_status</varname> shows the
gdbserver status. In case of problems (e.g. of communications),
this shows the values of some relevant Valgrind gdbserver internal
|