* compare vgdb-error with n_errs_shown, not with n_errs_found.
Using n_errs_shown allows the user to stop on an error
identified in a previous run by counting errors shown.
* shows also n_errs_shown in monitor command v.info n_errs_found
* slightly clarified the manual, updated to new output of v.info n_errs_found
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12388 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/NEWS b/NEWS
index 9c4352a..e169ac1 100644
--- a/NEWS
+++ b/NEWS
@@ -58,7 +58,7 @@
290974 vgdb must align pages to VKI_SHMLBA (16KB) on ARM
293088 Add some VEX sanity checks for ppc64 unhandled instructions
294055 regtest none/tests/shell fails when locale is not set to C
-
+294190 --vgdb-error=xxx can be out of sync with errors shown to the user
Release 3.7.0 (5 November 2011)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 793542c..1d08690 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -82,6 +82,9 @@
/* Running count of suppressed errors detected. */
static UInt n_errs_suppressed = 0;
+/* Running count of errors shown. */
+static UInt n_errs_shown = 0;
+
/* Running count of unsuppressed error contexts. */
static UInt n_err_contexts = 0;
@@ -171,6 +174,11 @@
return n_errs_found;
}
+UInt VG_(get_n_errs_shown)( void )
+{
+ return n_errs_shown;
+}
+
/*------------------------------------------------------------*/
/*--- Suppression type ---*/
/*------------------------------------------------------------*/
@@ -498,7 +506,7 @@
/* if user wants to debug from a certain error nr, then wait for gdb/vgdb */
if (VG_(clo_vgdb) != Vg_VgdbNo
&& allow_db_attach
- && VG_(dyn_vgdb_error) <= n_errs_found) {
+ && VG_(dyn_vgdb_error) <= n_errs_shown) {
VG_(umsg)("(action on error) vgdb me ... \n");
VG_(gdbserver)( err->tid );
VG_(umsg)("Continuing ...\n");
@@ -638,8 +646,6 @@
-static Int n_errs_shown = 0;
-
/* Top-level entry point to the error management subsystem.
All detected errors are notified here; this routine decides if/when the
user should see the error. */
@@ -796,12 +802,12 @@
p->supp = is_suppressible_error(&err);
errors = p;
if (p->supp == NULL) {
+ /* update stats */
n_err_contexts++;
n_errs_found++;
+ n_errs_shown++;
/* Actually show the error; more complex than you might think. */
pp_Error( p, /*allow_db_attach*/True, VG_(clo_xml) );
- /* update stats */
- n_errs_shown++;
} else {
n_supp_contexts++;
n_errs_suppressed++;
@@ -848,10 +854,10 @@
}
if (print_error) {
- /* Actually show the error; more complex than you might think. */
- pp_Error(&err, allow_db_attach, VG_(clo_xml));
/* update stats */
n_errs_shown++;
+ /* Actually show the error; more complex than you might think. */
+ pp_Error(&err, allow_db_attach, VG_(clo_xml));
}
return False;
diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c
index a1a2608..d8e6094 100644
--- a/coregrind/m_gdbserver/server.c
+++ b/coregrind/m_gdbserver/server.c
@@ -246,8 +246,9 @@
VG_(show_all_errors)(/* verbosity */ 2, /* xml */ False);
break;
case 1: // n_errs_found
- VG_(gdb_printf) ("n_errs_found %d (vgdb-error %d)\n",
+ VG_(gdb_printf) ("n_errs_found %d n_errs_shown %d (vgdb-error %d)\n",
VG_(get_n_errs_found) (),
+ VG_(get_n_errs_shown) (),
VG_(dyn_vgdb_error));
break;
case 2: // last_error
diff --git a/coregrind/pub_core_errormgr.h b/coregrind/pub_core_errormgr.h
index c9f5aa9..4cd0ace 100644
--- a/coregrind/pub_core_errormgr.h
+++ b/coregrind/pub_core_errormgr.h
@@ -67,6 +67,7 @@
extern Bool VG_(showing_core_errors) ( void );
extern UInt VG_(get_n_errs_found) ( void );
+extern UInt VG_(get_n_errs_shown) ( void );
extern void VG_(print_errormgr_stats) ( void );
diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml
index 3b602f9..97ded71 100644
--- a/docs/xml/manual-core-adv.xml
+++ b/docs/xml/manual-core-adv.xml
@@ -381,7 +381,7 @@
or <option>--vgdb=full</option>. A secondary command line option,
<option>--vgdb-error=number</option>, can be used to tell the gdbserver
only to become active once the specified number of errors have been
-reported. A value of zero will therefore cause
+shown. A value of zero will therefore cause
the gdbserver to become active at startup, which allows you to
insert breakpoints before starting the run. For example:
<screen><![CDATA[
@@ -625,7 +625,7 @@
(gdb) mo v. n
v. can match v.set v.info v.wait v.kill v.translate
(gdb) mo v.i n
-n_errs_found 0 (vgdb-error 0)
+n_errs_found 0 n_errs_shown 0 (vgdb-error 0)
(gdb)
]]></programlisting>
</para>
@@ -1196,9 +1196,8 @@
<listitem>
<para><varname>v.info n_errs_found</varname> shows the number of
- errors found so far and the current value of the
- <option>--vgdb-error</option>
- argument.</para>
+ errors found so far, the nr of errors shown so far and the current
+ value of the <option>--vgdb-error</option> argument.</para>
</listitem>
<listitem>
diff --git a/gdbserver_tests/mcbreak.stderrB.exp b/gdbserver_tests/mcbreak.stderrB.exp
index d5eaecf..3bf12a0 100644
--- a/gdbserver_tests/mcbreak.stderrB.exp
+++ b/gdbserver_tests/mcbreak.stderrB.exp
@@ -1,7 +1,7 @@
relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
vgdb-error value changed from 999999 to 0
-n_errs_found 1 (vgdb-error 0)
+n_errs_found 1 n_errs_shown 1 (vgdb-error 0)
vgdb-error value changed from 0 to 0
monitor command request to kill this process
Remote connection closed