This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Problem calling functions within gdb (version 7.5)
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Saurabh T <saurabh at hotmail dot com>, gdb at sourceware dot org
- Date: Thu, 25 Apr 2013 14:10:41 +0100
- Subject: Re: Problem calling functions within gdb (version 7.5)
- References: <DUB123-W3379C1D5569CB0664A9923B1B50 at phx dot gbl>
On 24/04/13 22:30, Saurabh T wrote:
> Here's a simple C++ example:
> 1. call fn(3, x)
> 2. print k
> Let's say this prints 0x7ffb24
> call fn2(0x7ffb24)
> gdb again says: Cannot resolve function fn2 to any overloaded instance
> This also used to work with gdb 7.2. Here I can understand if promoting ints to arbitrary pointers is no longer supported.
[pmuldoon@localhost build]$ gdb --version
GNU gdb (GDB) Fedora (7.5.1-37.fc18)
Copyright (C) 2012 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) b 19
Breakpoint 1 at 0x4006bc: file /home/pmuldoon/pr.c, line 19.
(gdb) r
Starting program: /home/pmuldoon/pr
1 2 3
3 4 5
5 6 7
3
Breakpoint 1, main () at /home/pmuldoon/pr.c:19
19 return 0;
(gdb) call fn(3,x)
1 2 3
3 4 5
5 6 7
(gdb) call fn2(k)
3
(gdb) p k
$1 = (int *) 0x7fffffffe064
(gdb) call fn2(0x7fffffffe064)
3
So it works with my installed GDB. What architecture, and what minor
version of GDB are you using (ie 7.5.x)? How did you compile the
binary? I did:
gcc -std=c99 ~/build/pr.c -o ~/build/pr -O0 -g3
Cheers,
Phil