This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Viewing the address of an array in gdb


On 07/06/2018 12:51 PM, Pedro Alves wrote:
> On 07/06/2018 04:33 AM, Mahmood Naderan via gdb wrote:
>> Hi,
>> I have define "char buffer[100]" in a C code. Trying to view the location of buffer in GDB, I see this

Ah, I missed the "you have defined a buffer yourself" part.

So what seems to be happening is that there's another symbol also 
called "buffer" in glibc:

 (gdb) info symbol buffer
 buffer in section .bss of /lib64/libc.so.6

and gdb is picking that symbol instead of yours.

I can reproduce this if I compile a small program without debug info,
but with debug info (-g), it works as you'd expect.

I don't think we have syntax to disambiguate this, like
'libc.so.6'::buffer' vs 'program'::buffer, or program#buffer some
such, unfortunately.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]