]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Minor GDBserver source tidying. Also a small usability fix: if
authorJulian Seward <jseward@acm.org>
Sat, 18 Jun 2011 08:28:04 +0000 (08:28 +0000)
committerJulian Seward <jseward@acm.org>
Sat, 18 Jun 2011 08:28:04 +0000 (08:28 +0000)
--vgdb-error=N is specified, print a bit of text telling the user the
magic commands to give GDB in order to attach to the process.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11822

19 files changed:
coregrind/m_gdbserver/m_gdbserver.c
coregrind/m_gdbserver/remote-utils.c
coregrind/m_main.c
coregrind/m_scheduler/scheduler.c
coregrind/pub_core_gdbserver.h
coregrind/pub_core_scheduler.h
coregrind/vgdb.c
docs/xml/manual-core-adv.xml
gdbserver_tests/Makefile.am
gdbserver_tests/README_DEVELOPERS [moved from gdbserver_tests/README_DEVELOPPERS with 100% similarity]
gdbserver_tests/filter_stderr
gdbserver_tests/mcclean_after_fork.stderr.exp
gdbserver_tests/mcsignopass.stderr.exp
gdbserver_tests/mcsigpass.stderr.exp
gdbserver_tests/mcwatchpoints.stderr.exp
gdbserver_tests/nlcontrolc.stderr.exp
include/pub_tool_gdbserver.h
none/tests/cmdline1.stdout.exp
none/tests/cmdline2.stdout.exp

index 44669064fdd1a2d38f0a8e029327b3406d03c5fe..8171eefe2b15343ede38856ea077532f30c8e5c5 100644 (file)
@@ -7,7 +7,7 @@
    This file is part of Valgrind, a dynamic binary instrumentation
    framework.
 
-   Copyright (C) 2011 Philippe Waroquiers
+   Copyright (C) 2011-2011 Philippe Waroquiers
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 36b891aadde6768801ea92aad0ea3b042ac2677e..66e433763403744878fe048fa293d7114c01147f 100644 (file)
@@ -250,13 +250,30 @@ void remote_open (char *name)
       VG_(umsg)("embedded gdbserver: reading from %s\n", from_gdb);
       VG_(umsg)("embedded gdbserver: writing to   %s\n", to_gdb);
       VG_(umsg)("embedded gdbserver: shared mem   %s\n", shared_mem);
-      VG_(umsg)("CONTROL ME using: vgdb --pid=%d%s%s ...command...\n",
+      VG_(umsg)("\n");
+      VG_(umsg)("TO CONTROL THIS PROCESS USING vgdb (which you probably\n"
+                "don't want to do, unless you know exactly what you're doing,\n"
+                "or are doing some strange experiment):\n"
+                "  %s/../../bin/vgdb --pid=%d%s%s ...command...\n",
+                VG_LIBDIR,
                 pid, (name_default ? "" : " --vgdb="),
                 (name_default ? "" : name));
-      VG_(umsg)("DEBUG ME using: (gdb) target remote | vgdb --pid=%d%s%s\n",
-                pid, (name_default ? "" : " --vgdb="), 
-                (name_default ? "" : name));
-      VG_(umsg)("   --pid optional if only one valgrind process is running\n");
+   }
+   if (VG_(clo_verbosity) > 1 
+       || VG_(clo_vgdb_error) < 999999999) {
+      VG_(umsg)("\n");
+      VG_(umsg)(
+         "TO DEBUG THIS PROCESS USING GDB: start GDB like this\n"
+         "  /path/to/gdb %s\n"
+         "and then give GDB the following command\n"
+         "  target remote | %s/../../bin/vgdb --pid=%d%s%s\n",
+         VG_(args_the_exename),
+         VG_LIBDIR,
+         pid, (name_default ? "" : " --vgdb="), 
+         (name_default ? "" : name)
+      );
+      VG_(umsg)("--pid is optional if only one valgrind process is running\n");
+      VG_(umsg)("\n");
    }
 
    if (!mknod_done) {
index 1bf66c6174fc5700281e475e0e4ee9897238bb57..a3e791045b8b5bbd04f4aebae78a55b10d6d38d0 100644 (file)
@@ -132,7 +132,9 @@ static void usage_NORETURN ( Bool debug_help )
 "    --child-silent-after-fork=no|yes omit child output between fork & exec? [no]\n"
 "    --vgdb=no|yes|full        activate gdbserver? [yes]\n"
 "                              full is slower but provides precise watchpoint/step\n"
-"    --vgdb-error=<number>     invoke gdbserver after <number> errors [%d] \n"
+"    --vgdb-error=<number>     invoke gdbserver after <number> errors [%d]\n"
+"                              to get started quickly, use --vgdb-error=0\n"
+"                              and follow the on-screen directions\n"
 "    --track-fds=no|yes        track open file descriptors? [no]\n"
 "    --time-stamp=no|yes       add timestamps to log messages? [no]\n"
 "    --log-fd=<number>         log messages to file descriptor [2=stderr]\n"
index 9b9e3dc10f9a15f775df4a66b593b8d36049b12a..3104fdc0554217415bf9996018568fd1a0bc769c 100644 (file)
@@ -901,11 +901,6 @@ static UInt run_noredir_translation ( Addr hcode, ThreadId tid )
    return retval;
 }
 
-ULong VG_(bbs_done) (void)
-{
-   return bbs_done;
-}
-
 
 /* ---------------------------------------------------------------------
    The scheduler proper.
index 202d89bc84f0ad0a5ec6761b050032c8adab5d98..a001cc6c09a08ecfa1711754032200ebb1e7776f 100644 (file)
@@ -7,7 +7,7 @@
    This file is part of Valgrind, a dynamic binary instrumentation
    framework.
 
-   Copyright (C) 2011 Philippe Waroquiers
+   Copyright (C) 2011-2011 Philippe Waroquiers
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 0458aaa67be7a70c173e73ea27538033c5ada679..c2b22fce72cf6e9298197305a090bf50b5e598b8 100644 (file)
@@ -100,9 +100,6 @@ extern void VG_(scheduler_init_phase2) ( ThreadId main_tid,
 extern void VG_(disable_vgdb_poll) (void );
 extern void VG_(force_vgdb_poll) ( void );
 
-/* nr of bbs done since startup. */
-extern ULong VG_(bbs_done) (void);
-
 /* Stats ... */
 extern void VG_(print_scheduler_stats) ( void );
 
index cd315bfc2eef5c4f11f921a3be19c47ba90102f2..68e67970abe4f5ebd978eef238823c8aef5ffa6b 100644 (file)
@@ -6,7 +6,7 @@
    This file is part of Valgrind, a dynamic binary instrumentation
    framework.
 
-   Copyright (C) 2011 Philippe Waroquiers
+   Copyright (C) 2011-2011 Philippe Waroquiers
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index a43398417f63f8d1a548fc8c010a70fb4c394834..1f9b95c37858f6969f28cdde11351b27687ba87d 100644 (file)
@@ -295,6 +295,13 @@ under Memcheck and on-demand Massif snapshot production.
        xreflabel="gdbserver simple example">
 <title>Quick Start: debugging in 3 steps</title>
 
+<para>The simplest way to get started is to run Valgrind with the
+flag <option>--vgdb-error=0</option>.  Then follow the on-screen
+directions, which give you the precise commands needed to start GDB
+and connect it to your program.</para>
+
+<para>Otherwise, here's a slightly more verbose overview.</para>
+
 <para>If you want to debug a program with GDB when using the Memcheck
 tool, start Valgrind the following way:
 <screen><![CDATA[
index 5094f5a1bb238476a9b4ae4b9ed93aff3943f9c7..763a37414fc8f8a0c984f04430b65174e5dd476e 100644 (file)
@@ -7,6 +7,7 @@ dist_noinst_SCRIPTS = \
        filter_memcheck_monitor filter_stderr filter_vgdb
 
 EXTRA_DIST = \
+       README_DEVELOPERS \
        mcbreak.stderrB.exp \
        mcbreak.stderr.exp \
        mcbreak.stdinB.gdb \
index 1d26ab79b6a955c6ec1956c2036fd44fb25d4a2a..efe81ec2870a5d7ff70d4f7856e1a40423213280 100755 (executable)
@@ -3,4 +3,10 @@
 dir=`dirname $0`
 
 $dir/../tests/filter_stderr_basic    |
-sed -e '/^Copyright (C) /d'
+sed -e '/^Copyright (C) /d' \
+    \
+    -e '/TO DEBUG THIS PROCESS USING GDB/d' \
+    -e '/\/path\/to\/gdb/d' \
+    -e '/and then give GDB the following command/d' \
+    -e '/target remote |/d' \
+    -e '/pid is optional if only one valgrind process is running/d'
index 0e8e017bbb481f10902ede043854d69c58ca4a96..fcece50d6b178154ab554dfcb814e4aad18d33c2 100644 (file)
@@ -1,6 +1,8 @@
 
 (action at startup) vgdb me ... 
 
+
+
 HEAP SUMMARY:
     in use at exit: 0 bytes in 0 blocks
   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
index f60f30e845f4d37f819c70e38ad76946d5842659..a429670c43730fc1a409ab035380e9406e608b6d 100644 (file)
@@ -1,5 +1,7 @@
 
 (action at startup) vgdb me ... 
+
+
 Test 1: Invalid write of size 4
    at 0x........: test1 (faultstatus.c:105)
    by 0x........: main (faultstatus.c:168)
index af2b53aa59fda81535f7a4e1f68c6a3a2557a42d..1951b6a7edc9697e1a1b82d7cb46df393b14bc16 100644 (file)
@@ -1,5 +1,7 @@
 
 (action at startup) vgdb me ... 
+
+
 Test 1: Invalid write of size 4
    at 0x........: test1 (faultstatus.c:105)
    by 0x........: main (faultstatus.c:168)
index b73233a98dda1a977e51843dbacaee4fdf82c43d..d873f4f9d63f9608389b2393310127d7b37ffe11 100644 (file)
@@ -1,5 +1,7 @@
 
 (action at startup) vgdb me ... 
+
+
 breakme function called from line 19
 before reading 0/4/8
 u: Expected value at 0
index f6eef783ad195702fe2fde21750a32b0829c4c41..0f27d71bf618eff4bca2c316a02c1103446c6efe 100644 (file)
@@ -1,6 +1,8 @@
 Nulgrind, the minimal Valgrind tool
 
 (action at startup) vgdb me ... 
+
+
 loops/sleep_ms/burn/threads_spec:  1000000000 1000000000 1000000000 BSBSBSBS
 Brussels ready to sleep and/or burn
 London ready to sleep and/or burn
index 514bcaa99dc1ff6ed4ecfe7d271b6ebeccc610dc..87ba3e268bd748161a203778ba7b08498d60a622 100644 (file)
@@ -7,7 +7,7 @@
    This file is part of Valgrind, a dynamic binary instrumentation
    framework.
 
-   Copyright (C) 2011 Philippe Waroquiers
+   Copyright (C) 2011-2011 Philippe Waroquiers
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 6faa70f3b6473a72000f92643cec43180988b0ab..4bb0752f7df6cd6b76b595c76929cd27a19761b6 100644 (file)
@@ -18,7 +18,9 @@ usage: valgrind [options] prog-and-args
     --child-silent-after-fork=no|yes omit child output between fork & exec? [no]
     --vgdb=no|yes|full        activate gdbserver? [yes]
                               full is slower but provides precise watchpoint/step
-    --vgdb-error=<number>     invoke gdbserver after <number> errors [999999999] 
+    --vgdb-error=<number>     invoke gdbserver after <number> errors [999999999]
+                              to get started quickly, use --vgdb-error=0
+                              and follow the on-screen directions
     --track-fds=no|yes        track open file descriptors? [no]
     --time-stamp=no|yes       add timestamps to log messages? [no]
     --log-fd=<number>         log messages to file descriptor [2=stderr]
index a65047e069ce8aac7b9b36bdcae1af2922312a7f..056c68908446057c3d52f1fa449bcdce3bf88f42 100644 (file)
@@ -18,7 +18,9 @@ usage: valgrind [options] prog-and-args
     --child-silent-after-fork=no|yes omit child output between fork & exec? [no]
     --vgdb=no|yes|full        activate gdbserver? [yes]
                               full is slower but provides precise watchpoint/step
-    --vgdb-error=<number>     invoke gdbserver after <number> errors [999999999] 
+    --vgdb-error=<number>     invoke gdbserver after <number> errors [999999999]
+                              to get started quickly, use --vgdb-error=0
+                              and follow the on-screen directions
     --track-fds=no|yes        track open file descriptors? [no]
     --time-stamp=no|yes       add timestamps to log messages? [no]
     --log-fd=<number>         log messages to file descriptor [2=stderr]