|
From: <sv...@va...> - 2011-10-24 07:41:42
|
Author: sewardj Date: 2011-10-24 08:36:57 +0100 (Mon, 24 Oct 2011) New Revision: 12223 Log: gdbsrv: factorize gdb version handling, fix doc and typos * 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, phi...@sk...) Modified: trunk/coregrind/m_gdbserver/server.c trunk/docs/xml/manual-core-adv.xml trunk/gdbserver_tests/README_DEVELOPERS trunk/gdbserver_tests/make_local_links Modified: trunk/coregrind/m_gdbserver/server.c =================================================================== --- trunk/coregrind/m_gdbserver/server.c 2011-10-24 05:59:54 UTC (rev 12222) +++ trunk/coregrind/m_gdbserver/server.c 2011-10-24 07:36:57 UTC (rev 12223) @@ -1016,7 +1016,7 @@ 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') { Modified: trunk/docs/xml/manual-core-adv.xml =================================================================== --- trunk/docs/xml/manual-core-adv.xml 2011-10-24 05:59:54 UTC (rev 12222) +++ trunk/docs/xml/manual-core-adv.xml 2011-10-24 07:36:57 UTC (rev 12223) @@ -14,6 +14,8 @@ <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 @@ <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 @@ 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 @@ 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 @@ <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 Modified: trunk/gdbserver_tests/README_DEVELOPERS =================================================================== --- trunk/gdbserver_tests/README_DEVELOPERS 2011-10-24 05:59:54 UTC (rev 12222) +++ trunk/gdbserver_tests/README_DEVELOPERS 2011-10-24 07:36:57 UTC (rev 12223) @@ -17,14 +17,13 @@ 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). Modified: trunk/gdbserver_tests/make_local_links =================================================================== --- trunk/gdbserver_tests/make_local_links 2011-10-24 05:59:54 UTC (rev 12222) +++ trunk/gdbserver_tests/make_local_links 2011-10-24 07:36:57 UTC (rev 12223) @@ -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 @@ 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 |