]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
gdbsrv: factorize gdb version handling, fix doc and typos
authorJulian Seward <jseward@acm.org>
Mon, 24 Oct 2011 07:36:57 +0000 (07:36 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 24 Oct 2011 07:36:57 +0000 (07:36 +0000)
* fix various typos in doc
* following commit in gdb
   http://sourceware.org/ml/gdb-patches/2011-07/msg00742.html
  means unlimited length for valgrind watchpoints is understood by the
  (future) gdb 7.4 => doc updated
* factorize  gdb version detection and reporting in
  gdbserver_tests/make_local_links
* replace zignal by signal in a string used in umsg.
* updated gdbserver_tests/README_DEVELOPPERS (ref to --port vgdb option)

No functional change, tested on f12/x86, debian5/amd64, s390/RHEL4

Fixes #278892.  (Philippe Waroquiers, philippe.waroquiers@skynet.be)

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

coregrind/m_gdbserver/server.c
docs/xml/manual-core-adv.xml
gdbserver_tests/README_DEVELOPERS
gdbserver_tests/make_local_links

index 6dc5e1ad14123bf0025d2875dda10f0e14817750..a1a26087f54958c9d49126840c74ab4d27420d65 100644 (file)
@@ -1016,7 +1016,7 @@ void server_main (void)
       if (status == 'W')
          VG_(umsg) ("\nChild exited with status %d\n", zignal);
       if (status == 'X')
-         VG_(umsg) ("\nChild terminated with zignal = 0x%x (%s)\n",
+         VG_(umsg) ("\nChild terminated with signal = 0x%x (%s)\n",
                     target_signal_to_host (zignal),
                     target_signal_to_name (zignal));
       if (status == 'W' || status == 'X') {
index 0ef20d2e9f0ff64a64611b8b84ccce066e3e4c15..2039f6f10c5acb957806c92f74a059ccd2dae25a 100644 (file)
@@ -14,6 +14,8 @@ ways.  The subjects covered are:</para>
 
 <itemizedlist>
   <listitem><para>The "Client Request" mechanism</para></listitem>
+  <listitem><para>Debugging your program using Valgrind's gdbserver
+      and GDB</para></listitem>
   <listitem><para>Function Wrapping</para></listitem>
 </itemizedlist>
 
@@ -376,7 +378,7 @@ command line.
 <para>To debug a program "<filename>prog</filename>" running under
 Valgrind, you must ensure that the Valgrind gdbserver is activated by
 specifying either <option>--vgdb=yes</option>
-or <option>--vgdb=full</option>).  A secondary command line option,
+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
@@ -595,7 +597,7 @@ these from a shell command line.  For example, the following command
 lines, when given in a shell, will cause the same leak search to be executed
 by the process 3145:
 <screen><![CDATA[
-vgdb --pid=3145 leak_check any full reachable
+vgdb --pid=3145 leak_check full reachable any
 vgdb --pid=3145 l f r a
 ]]></screen></para>
 
@@ -728,12 +730,10 @@ are however some limitations and peculiarities:</para>
      bytes. The Valgrind gdbserver does not have any limitation on the
      number of simulated hardware watchpoints. It also has no
      limitation on the length of the memory zone being
-     watched.  However, GDB currently does not understand that
-     Valgrind gdbserver watchpoints have no length limit.  A GDB patch
-     providing a command "set remote hardware-watchpoint-length-limit"
-     has been developped. Integration of this patch into GDB would
-     allow full use of the flexibility of the Valgrind gdbserver's
-     simulated hardware watchpoints.
+     watched.  Using GDB version 7.4 or later allow full use of the
+     flexibility of the Valgrind gdbserver's simulated hardware watchpoints.
+     Previous GDB versions do not understand that Valgrind gdbserver
+     watchpoints have no length limit.
      </para>
      <para>Memcheck implements hardware watchpoint simulation by
      marking the watched address ranges as being unaddressable.  When
@@ -1223,7 +1223,7 @@ problems or bugs.</para>
   <listitem>
     <para><varname>v.info gdbserver_status</varname> shows the
     gdbserver status. In case of problems (e.g. of communications),
-    this showns the values of some relevant Valgrind gdbserver internal
+    this shows the values of some relevant Valgrind gdbserver internal
     variables.  Note that the variables related to breakpoints and
     watchpoints (e.g. the number of breakpoint addresses and the number of
     watchpoints) will be zero, as GDB by default removes all
index 1509a8371181ed58029a12cd87ddc2890f4fc3b5..e33eb033876c2423fba9b3ed0068143d41f507cc 100644 (file)
@@ -17,14 +17,13 @@ or (to just run the gdbserver tests with another gdb):
   gdbserver_tests/make_local_links /path/to/another/gdb
   perl tests/vg_regtest gdbserver_tests
 
-The minimum version to use the Valgrind gdbserver is gdb >= 6.5.
+The minimum version to run the tests is gdb >= 6.5.
     Previous versions do not have the 'target remote |' command.  It
-    would be possible to use an older version by having a tcp relay
-    application between gdb and vgdb (or, alternatively, change vgdb
-    so that it could read/write from/to a tcpip socket rather than
-    read/write from stdin/stdout.
+    would be possible to use an older version by using the option
+    --port of vgdb, and using the tcp/ip variant of the 'target remote'
+    GDB command.
 
-The tests have been run on various platforms using gdb 7.2
+The tests have been run on various platforms using gdb versions >= 7.2
 and on some platforms gdb 7.0 and 7.1.
 Some gdb tests implies a gdb >= 7.2. (these are automatically disabled
 if testing with a lower version).
index 44f36c5041495d12d2cee66266c62dff21a706f5..8e50093b2ecbe5e8aa9474687c6ea3d7a4102368 100755 (executable)
@@ -4,7 +4,7 @@
 #
 # Make local links in the gdbserver_tests directory
 # so that tests needing gdb can be disabled if
-# a tool old version of gdb is provided or if no gdb is
+# a too old version of gdb is provided or if no gdb is
 # provided.
 #
 # The vgdb link is needed either for gdb tests
@@ -24,55 +24,72 @@ if [ "x$1" = "x" ]; then
   exit 1
 fi
 
+
+export GDB=""
+export GDBVERSIONLINE=""
+export GDBMAJ=""
+export GDBMIN=""
+
+# $1 = Major.Minor gdb version needed
+# $2 = marker file to touch (if version ok) or to remove (version not ok)
+# $3 and following: msg in output
+check_version()
+{
+  NEEDED=$1
+  shift
+  NEEDEDMAJ=$(echo $NEEDED | awk -F\. '{ print $1 }')
+  NEEDEDMIN=$(echo $NEEDED | awk -F\. '{ print $2 }')
+
+  MARKERFILE=$1
+  shift
+
+  if [   \( $GDBMAJ -gt $NEEDEDMAJ \)         \
+      -o \(   \( $GDBMAJ -eq $NEEDEDMAJ \)    \
+           -a \( $GDBMIN -ge $NEEDEDMIN \) \)     ]
+  then
+    if [ ! -f $MARKERFILE ]
+    then
+      touch $MARKERFILE
+    fi
+  else
+    echo "$@"  "suppressed as $GDB version" $GDBVERSIONLINE "is <" $NEEDED 
+    rm -f $MARKERFILE
+  fi
+}
+
 if [ -x "$1" ]
 then
-   ln -f -s "$1" gdbserver_tests/gdb
-   # Try to extract the gdb version.
-   VERSIONLINE=`gdbserver_tests/gdb --version | head -n 1`
-   VERSION=`echo $VERSIONLINE                         |
-            sed -e 's/[^0-9\.]//g' -e 's/\./ /g'`
+   GDB=$1
+   ln -f -s "$GDB" gdbserver_tests/gdb
+   # Try to extract the gdb version major and minor numbers.
+   # We assume these are the first two integers separated by a .
+   GDBVERSIONLINE=`gdbserver_tests/gdb --version | head -n 1`
+   GDBMAJ=`echo $GDBVERSIONLINE | sed -e 's/[^0-9\.]//g' |
+                  awk -F\. '{print $1}'`
+   GDBMIN=`echo $GDBVERSIONLINE | sed -e 's/[^0-9\.]//g' |
+                  awk -F\. '{print $2}'`
    
    # We need at least a 6.5 version to use the Valgrind gdbserver.
-   # However, the tests are only supported/maintained for gdb >= 7
-   VERSIONOK=`echo $VERSION |
-              awk '{ if ($1 >= 7) print "version ok"}'`
-   if [ "$VERSIONOK" = "" ]
-   then
-      echo "gdbserver tests suppressed as $1 version is < 6.5: " $VERSIONLINE
-      rm -f gdbserver_tests/gdb
-   fi
+   # However, the gdb tests are only supported/maintained for gdb >= 7
+   check_version 7.0 gdbserver_tests/gdb "gdbserver gdb tests"
 
-   # We need at least a 7.1 version to run the 'pic' executable test
+   # We need at least a 7.1 version to run the 'pic' executable tests
    # (with 7.0, it fails on many platforms)
-   # On ARM, we need at least 7.1 to run the 'next/step/...' tests.
+   check_version 7.1 gdbserver_tests/gdb.pic "pic executable tests"
+
+   # by default, we can run tests needed next/step/...
+   # But on ARM, we need at least 7.1 to run the 'next/step/...' tests.
    # (gdb 7.0 has bugs in the 'guess next pc' heuristic in thumb mode).
-   VERSIONOK=`echo $VERSION |
-              awk '{ if ( ($1 >= 8) || (($1 == 7) && ($2 >= 1)) ) print "version ok"}'`
-   # By default, consider step/next/... tests are ok. We will remove for ARM if needed.
-   touch gdbserver_tests/gdb.step
-   if [ "$VERSIONOK" = "" ]
+   if tests/arch_test arm
    then
-      echo "gdbserver 'pic' tests suppressed as $1 version is < 7.1: " $VERSIONLINE
-      rm -f gdbserver_tests/gdb.pic
-      if tests/arch_test arm
-      then
-         echo "gdbserver 'step/next' tests suppressed as arm $1 version is < 7.1: " $VERSIONLINE
-         rm -f gdbserver_tests/gdb.step
-      fi
+      check_version 7.1 gdbserver_tests/gdb.step "gdbserver next/step/... tests ARM"
    else
-      touch gdbserver_tests/gdb.pic
+      check_version 7.0 gdbserver_tests/gdb.step "gdbserver next/step/... tests"
    fi
 
    # We need at least a 7.2 version for gdb tests using eval command
-   VERSIONOK=`echo $VERSION |
-              awk '{ if ( ($1 >= 8) || (($1 == 7) && ($2 >= 2)) ) print "version ok"}'`
-   if [ "$VERSIONOK" = "" ]
-   then
-      echo "gdbserver eval tests suppressed as $1 version is < 7.2: " $VERSIONLINE
-      rm -f gdbserver_tests/gdb.eval
-   else
-      touch gdbserver_tests/gdb.eval
-   fi
+   check_version 7.2 gdbserver_tests/gdb.eval "gdbserver eval tests"
+
 else
    echo "gdbserver gdb tests suppressed as $1 is not executable"
 fi