cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH 3/3] runtests.pl: use exit code of child for gdb

From: Peter Wu <peter_at_lekensteyn.nl>
Date: Mon, 17 Nov 2014 23:23:31 +0100

On Monday 17 November 2014 22:47:16 Dan Fandrich wrote:
> On Mon, Nov 17, 2014 at 06:06:26PM +0100, Peter Wu wrote:
> > test916 would be detect as fail when ran under gdb. Fix this by
> > returning the child exit code from gdb rather than assuming 0.
> >
> > Signed-off-by: Peter Wu <peter_at_lekensteyn.nl>
> > ---
> > tests/runtests.pl | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/tests/runtests.pl b/tests/runtests.pl
> > index 3f8d160..ca17138 100755
> > --- a/tests/runtests.pl
> > +++ b/tests/runtests.pl
> > @@ -684,9 +684,9 @@ sub torture {
> >
> > logmsg "*** Alloc number $limit is now set to fail ***\n" if($gdbthis);
> >
> > - my $ret = 0;
> > + my $ret;
> > if($gdbthis) {
> > - runclient(%gdbline)
> > + $ret = runclient(%gdbline)
> > }
> > else {
> > $ret = runclient(%testcmd);
> > @@ -3565,6 +3565,7 @@ sub singletest {
> > cmd => [
> > $gdb,
> > "--directory", "libtest",
> > + "-return-child-result",
>
> When was this option added to gdb? Since it's added unconditionally, it will
> break -g debugging altogether if it's run on an older system where it's not
> recognized, and curl runs on a lot of older systems.

I could not find it in the Changelog, but it was somewhere in the 6.x series.
Digging in the git repo, it looks like this option was added after GDB
6.3.50.20051104-cvs (November 4, 2005) which is over 9 years old now.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=4b0ad76243714b959a63aa42649fa3cf6c886ef2

> > $DBGCURL,
> > "-x", "$LOGDIR/gdbcmd"
> > ],
> > @@ -3573,16 +3574,17 @@ sub singletest {
> > }
> > elsif($gdbthis) {
> > my $GDBW = ($gdbxwin) ? "-w" : "";
> > - runclient(
> > + $cmdres = runclient(
> > cmd => [
> > $gdb,
> > "--directory", "libtest",
> > + "-return-child-result",
> > $DBGCURL,
> > $GDBW,
> > "-x", "$LOGDIR/gdbcmd",
> > ]
> > );
> > - $cmdres=0; # makes it always continue after a debugged run
> > + $cmdres >>= 8;
> > }
> > else {
> > $cmdres = runclient(%test_command);

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-11-17