This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Address of variable doesn't work (ARM-ELF 4.18)?
- To: gdb at sourceware dot cygnus dot com
- Subject: Address of variable doesn't work (ARM-ELF 4.18)?
- From: Grant Edwards <grante at visi dot com>
- Date: Wed, 26 Jan 2000 10:32:33 -0600
Using arm-elf-gdb 4.18, how do I get gdb to print the address
of a variable or to use the address of a variable as the
argument for an 'x' command?
For example, my program is:
1 #define Bufsize 100
2
3 char buf[Bufsize];
4
5 int main(void)
6 {
7 int i;
8
9 for (i=0; i<Bufsize; ++i)
10 buf[i] = i;
11
12 while (1)
13 ;
14
15 return 0;
16 }
I run the program and stop it after a bit:
(gdb) cont
Continuing.
RDI_execute: you pressed Escape
Actually, I pressed ctrl-C, but we'll ignore that. ;)
Program received signal SIGINT, Interrupt.
0x10007c in main () at main.c:12
12 while (1)
I can print out the values in buf:
(gdb) print/x buf
$3 = {0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d,0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63}
I know by looking at the link map that buf is at address
0x100090, and gdb knows it too::
(gdb) x/8xb 0x100090
0x100090 <buf>: 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
^^^^^
See, gdb knows where 'buf' is!
But the address-of operator just won't work:
(gdb) print &buf
$4 = (char (*)[100]) 0x0
(gdb) x/8xb &buf
0x0: 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
Using a pointer expression as an agurment to the 'x' command
doesn't work either:
(gdb) x/8xb buf+0
0x0: 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
The same example under w gdb 4.18 Linux-i386 works fine. This
obviously isn't a show-stopping problem, but it's annoying.
Here's the arm-elf-gdb version info (the one where '&' doesn't work)
GNU gdb 4.18
[...]
This GDB was configured as "--host=i586-pc-linux-gnu --target=arm-elf".
JEENI (ADP, ARM7TDI) Rev 1.1
Rebuilt on Apr 13 1998 at 13:23:52
SN=9805J050 ENET=00:80:CF:00:03:31 IP=204.73.219.108
Connected to ARM RDI target.
--
Grant Edwards
grante@visi.com