🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1087

call strcmp

#1087
From: Réginald LIPS
Date: Wed, 09 Jun 2010 10:57
62 lines
3889 bytes
Dear all,

I found a strange change since gdb 7.1.
I just would like to call strcmp within gdb (as a breakpoint command for ex.).
So here I am:

(gdb) call strcmp("toto", "toto")
$1 = -138906208
(gdb)

It never returns the good value.
So I wrote this test program:

nox@segfault:/tmp$ cat test.c
#include <stdio.h>
#include <string.h>

int	main()
{
  printf("strcmp: %d\n", strcmp("toto", "toto"));
  return (0);
}
nox@segfault:/tmp$ gcc ./test.c -g3
nox@segfault:/tmp$ ./a.out
strcmp: 0

But still the issue:
nox@segfault:/tmp$ gdb ./a.out
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/a.out...done.
(gdb) b main
Breakpoint 1 at 0x400528: file ./test.c, line 6.
(gdb) r
Starting program: /tmp/a.out

Breakpoint 1, main () at ./test.c:6
6	  printf("strcmp: %d\n", strcmp("toto", "toto"));
(gdb) call strcmp("toto", "toto")
$1 = -138906208

Another test seems to be fine:
(gdb) call strdup("toto")
$8 = 6299856
(gdb) p (char *)$
$9 = 0x6020d0 "toto"


It worked in 7.0, so I really don't get it, if you have any idea?

Thanks.
-- 
Réginald
Technical Details
Message-ID: <mailman.0.1276081059.25890.bug-gdb@gnu.org>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news2.glorb.com!news.glorb.com!usenet.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f0ead4270c,e2bc61972df5408f,start
X-Google-Attributes: gidf0ead4270c,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news2.glorb.com!news.glorb.com!usenet.stanford.edu!not-for-mail
From: Réginald LIPS <reginald.l@gmail.com>
Newsgroups: gnu.gdb.bug
Subject: call strcmp
Date: Wed, 9 Jun 2010 12:57:23 +0200
Lines: 63
Approved: bug-gdb@gnu.org
Message-ID: <mailman.0.1276081059.25890.bug-gdb@gnu.org>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: usenet.stanford.edu 1276081059 26191 199.232.76.165 (9 Jun 2010 10:57:39 GMT)
X-Complaints-To: action@cs.stanford.edu
To: bug-gdb@gnu.org
Envelope-to: bug-gdb@gnu.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
 h=domainkey-signature:mime-version:received:received:date:message-id
 :subject:from:to:content-type:content-transfer-encoding;
 bh=Wm/f6Z14aizICfWGybVJsT7zwyu3vFr/5zRcuhkCp/0=;
 b=RrlKQFHOOQdq6Sp81wnXJuPUCjvcbd2Eb+sb5Et3cFxWS7TfavGBVZd+rKkN1L/ZX+
 kPCGjXC/CpisDir6BsAIJ7Kb4HDCK22X6pCXi8mumfvMEZ2JxbcrrjvSRrYESlb/a7hg
 cldE16aRn+jJmkHmrHtLPKltExVKeJN/NYTgY=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
 h=mime-version:date:message-id:subject:from:to:content-type
 :content-transfer-encoding;
 b=Yp082NyRGxpXfyt/wj1OAKfk9DhN5/ISNa0x2IFoVnDOycfF3zP4yaC5OPsUDF8df2
 1GPfol4asaN8oNy9SkcQO91uh0H+TCFuwELFa5zo0fNjUu3kGpqKfLDWeo55jslcKmG6
 ErRTun3+vkDoxW98y1sJeQeXWQAwq1epH/om4=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-BeenThere: bug-gdb@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gdb>
List-Post: <mailto:bug-gdb@gnu.org>
List-Help: <mailto:bug-gdb-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=subscribe>