|
From: <sv...@va...> - 2012-10-21 14:37:22
|
philippe 2012-10-21 15:37:14 +0100 (Sun, 21 Oct 2012)
New Revision: 13072
Log:
Fix 308644 vgdb command for having the info for the track-fds option
(allows to have the list of opened fds and the associated info
on request from GDB or from the shell, using vgdb)
Modified files:
trunk/NEWS
trunk/coregrind/m_gdbserver/server.c
trunk/coregrind/m_main.c
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/coregrind/pub_core_syswrap.h
trunk/docs/xml/manual-core-adv.xml
trunk/docs/xml/manual-core.xml
trunk/gdbserver_tests/mchelp.stdoutB.exp
trunk/gdbserver_tests/mssnapshot.stderrB.exp
Modified: trunk/docs/xml/manual-core-adv.xml (+7 -0)
===================================================================
--- trunk/docs/xml/manual-core-adv.xml 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/docs/xml/manual-core-adv.xml 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -1274,6 +1274,13 @@
</listitem>
<listitem>
+ <para><varname>v.info open_fds</varname> shows the list of open file
+ descriptors and details related to the file descriptor.
+ This only works if <option>--track-fds=yes</option>
+ was given at Valgrind startup.</para>
+ </listitem>
+
+ <listitem>
<para><varname>v.set {gdb_output | log_output |
mixed_output}</varname> allows redirection of the Valgrind output
(e.g. the errors detected by the tool). The default setting is
Modified: trunk/coregrind/m_main.c (+1 -1)
===================================================================
--- trunk/coregrind/m_main.c 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/coregrind/m_main.c 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -2491,7 +2491,7 @@
/* Print out file descriptor summary and stats. */
if (VG_(clo_track_fds))
- VG_(show_open_fds)();
+ VG_(show_open_fds)("at exit");
/* Call the tool's finalisation function. This makes Memcheck's
leak checker run, and possibly chuck a bunch of leak errors into
Modified: trunk/gdbserver_tests/mchelp.stdoutB.exp (+4 -2)
===================================================================
--- trunk/gdbserver_tests/mchelp.stdoutB.exp 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/gdbserver_tests/mchelp.stdoutB.exp 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -1,9 +1,10 @@
general valgrind monitor commands:
- help [debug] : monitor command help. With debug: + debugging commands
+ help [debug] : monitor command help. With debug: + debugging commands
v.wait [<ms>] : sleep <ms> (default 0) then continue
v.info all_errors : show all errors found so far
v.info last_error : show last error found
v.info n_errs_found : show the nr of errors found so far
+ v.info open_fds : show open file descriptors (only if --track-fds=yes)
v.kill : kill the Valgrind process
v.set gdb_output : set valgrind output to gdb
v.set log_output : set valgrind output to log
@@ -36,11 +37,12 @@
with len > 1, will also show "interior pointers")
general valgrind monitor commands:
- help [debug] : monitor command help. With debug: + debugging commands
+ help [debug] : monitor command help. With debug: + debugging commands
v.wait [<ms>] : sleep <ms> (default 0) then continue
v.info all_errors : show all errors found so far
v.info last_error : show last error found
v.info n_errs_found : show the nr of errors found so far
+ v.info open_fds : show open file descriptors (only if --track-fds=yes)
v.kill : kill the Valgrind process
v.set gdb_output : set valgrind output to gdb
v.set log_output : set valgrind output to log
Modified: trunk/docs/xml/manual-core.xml (+5 -4)
===================================================================
--- trunk/docs/xml/manual-core.xml 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/docs/xml/manual-core.xml 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -773,10 +773,11 @@
</term>
<listitem>
<para>When enabled, Valgrind will print out a list of open file
- descriptors on exit. Along with each file descriptor is printed a
- stack backtrace of where the file was opened and any details
- relating to the file descriptor such as the file name or socket
- details.</para>
+ descriptors on exit or on request, via the gdbserver monitor
+ command <varname>v.info open_fds</varname>. Along with each
+ file descriptor is printed a stack backtrace of where the file
+ was opened and any details relating to the file descriptor such
+ as the file name or socket details.</para>
</listitem>
</varlistentry>
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c (+2 -2)
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -691,11 +691,11 @@
/* Dump out a summary, and a more detailed list, of open file descriptors. */
-void VG_(show_open_fds) (void)
+void VG_(show_open_fds) (HChar* when)
{
OpenFd *i = allocated_fds;
- VG_(message)(Vg_UserMsg, "FILE DESCRIPTORS: %d open at exit.\n", fd_count);
+ VG_(message)(Vg_UserMsg, "FILE DESCRIPTORS: %d open %s.\n", fd_count, when);
while (i) {
if (i->pathname) {
Modified: trunk/gdbserver_tests/mssnapshot.stderrB.exp (+2 -1)
===================================================================
--- trunk/gdbserver_tests/mssnapshot.stderrB.exp 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/gdbserver_tests/mssnapshot.stderrB.exp 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -1,11 +1,12 @@
relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
general valgrind monitor commands:
- help [debug] : monitor command help. With debug: + debugging commands
+ help [debug] : monitor command help. With debug: + debugging commands
v.wait [<ms>] : sleep <ms> (default 0) then continue
v.info all_errors : show all errors found so far
v.info last_error : show last error found
v.info n_errs_found : show the nr of errors found so far
+ v.info open_fds : show open file descriptors (only if --track-fds=yes)
v.kill : kill the Valgrind process
v.set gdb_output : set valgrind output to gdb
v.set log_output : set valgrind output to log
Modified: trunk/coregrind/pub_core_syswrap.h (+1 -1)
===================================================================
--- trunk/coregrind/pub_core_syswrap.h 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/coregrind/pub_core_syswrap.h 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -63,7 +63,7 @@
/* fd leakage calls. */
extern void VG_(init_preopened_fds) ( void );
-extern void VG_(show_open_fds) ( void );
+extern void VG_(show_open_fds) ( HChar* when );
// When the final thread is done, where shall I call to shutdown the
// system cleanly? Is set once at startup (in m_main) and never
Modified: trunk/coregrind/m_gdbserver/server.c (+12 -2)
===================================================================
--- trunk/coregrind/m_gdbserver/server.c 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/coregrind/m_gdbserver/server.c 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -160,11 +160,12 @@
VG_(gdb_printf) (
"general valgrind monitor commands:\n"
-" help [debug] : monitor command help. With debug: + debugging commands\n"
+" help [debug] : monitor command help. With debug: + debugging commands\n"
" v.wait [<ms>] : sleep <ms> (default 0) then continue\n"
" v.info all_errors : show all errors found so far\n"
" v.info last_error : show last error found\n"
" v.info n_errs_found : show the nr of errors found so far\n"
+" v.info open_fds : show open file descriptors (only if --track-fds=yes)\n"
" v.kill : kill the Valgrind process\n"
" v.set gdb_output : set valgrind output to gdb\n"
" v.set log_output : set valgrind output to log\n"
@@ -239,7 +240,7 @@
wcmd = strtok_r (NULL, " ", &ssaveptr);
switch (kwdid = VG_(keyword_id)
("all_errors n_errs_found last_error gdbserver_status memory"
- " scheduler",
+ " scheduler open_fds",
wcmd, kwd_report_all)) {
case -2:
case -1:
@@ -282,6 +283,15 @@
VG_(show_sched_status) ();
ret = 1;
break;
+ case 6: /* open_fds */
+ if (VG_(clo_track_fds))
+ VG_(show_open_fds) ("");
+ else
+ VG_(gdb_printf)
+ ("Valgrind must be started with --track-fds=yes"
+ " to show open fds\n");
+ ret = 1;
+ break;
default:
vg_assert(0);
}
Modified: trunk/NEWS (+4 -0)
===================================================================
--- trunk/NEWS 2012-10-21 04:43:20 +01:00 (rev 13071)
+++ trunk/NEWS 2012-10-21 15:37:14 +01:00 (rev 13072)
@@ -7,6 +7,9 @@
* ==================== OTHER CHANGES ====================
+ - Addition of GDB server monitor command 'v.info open_fds' that gives the
+ list of open file descriptors and additional details.
+
* ==================== FIXED BUGS ====================
The following bugs have been fixed or resolved. Note that "n-i-bz"
@@ -34,6 +37,7 @@
307155 [390] filter_gdb should filter out syscall-template.S T_PSEUDO
308321 [390] testsuite memcheck filter interferes with gdb_filter
308341 [390] vgdb should report process exit (or fatal signal)
+308644 [390] vgdb command for having the info for the track-fds option
n-i-bz [390] report error for vgdb snapshot requested before execution
n-i-bz [390] Some wrong command line options could be ignored
|