bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

call strcmp


From: Réginald LIPS
Subject: call strcmp
Date: Wed, 9 Jun 2010 12:57:23 +0200

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:

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

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

But still the issue:
address@hidden:/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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]