Re: Displaying structure members named like C keywords.

2014-08-22 Thread Emilio Lopes
Hi Sergio,

thank you for taking a look at this issue.

> Would it be possible for you to come up with a simpler reproducer
> and send it to this list?  I am guessing there is something else in
> your code that might be triggering this.

I was hoping for this to be something simple...  Oh, well.

As you can imagine this is a somewhat larger codebase, with lots of
automatically generated code from XML files, using those structures.

But look at the transcript of this debugging session:

$ arm-cortexa8-linux-gnueabi-gdb
build/master-device-control/master_device_control
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later

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 "--host=x86_64-unknown-linux-gnu
--target=arm-cortexa8-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from
build/master-device-control/master_device_control...done.
(gdb) target remote 192.168.51.84:
Remote debugging using 192.168.51.84:
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Cannot access memory at address 0x0
0xb6fbadf0 in ?? ()
(gdb) b hal-cmd-proxy.c:16
Breakpoint 1 at 0x79ae0: file
/home/lopes/projects/hal/firmware-cmd-manager/master-device-control/hal-cmd-proxy/hal-cmd-proxy.c,
line 16.
(gdb) c
Continuing.
warning: Could not load shared library symbols for 7 libraries,
e.g. /lib/libpthread.so.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
[New Thread 1562]
[Switching to Thread 1562]

Breakpoint 1, hal_cmd_proxy () at
/home/lopes/projects/hal/firmware-cmd-manager/master-device-control/hal-cmd-proxy/hal-cmd-proxy.c:16
16
set_param_not_available(C_HAL_SLAVE_OPTMIN_START_OPTIMIZATION,
enabled);
(gdb) info macro P_SLAVE_CMDS_OPTIONS_HAL_OPTMIN_ENABLED
Defined at 
/home/lopes/projects/hal/firmware-cmd-manager/build/master-device-control/d-param-defs.h:8151
  included at
/home/lopes/projects/hal/firmware-cmd-manager/master-device-control/hal-cmd-proxy/hal-cmd-proxy.c:5
#define P_SLAVE_CMDS_OPTIONS_HAL_OPTMIN_ENABLED
(&g_global_paramv[31].info.complex.paramv[29].info.complex.paramv[0].info.complex.paramv[1].info.complex.paramv[0])
(gdb) p P_SLAVE_CMDS_OPTIONS_HAL_OPTMIN_ENABLED
$1 = (struct param_t *) 0x10db9c <_slave_cmds_options_hal_optmin>
(gdb) set sysroot ~/projects/hal/system/platform-tam3517/root-debug
Reading symbols from
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libpthread.so.0...done.
Loaded symbols for
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libpthread.so.0
Reading symbols from
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/librt.so.1...done.
Loaded symbols for
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/librt.so.1
Reading symbols from
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libstdc++.so.6...done.
Loaded symbols for
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libstdc++.so.6
Reading symbols from
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libm.so.6...done.
Loaded symbols for
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libm.so.6
Reading symbols from
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libgcc_s.so.1...done.
Loaded symbols for
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libgcc_s.so.1
Reading symbols from
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libc.so.6...done.
Loaded symbols for
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libc.so.6
Reading symbols from
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/ld-linux.so.3...done.
Loaded symbols for
/home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/ld-linux.so.3
(gdb) p P_SLAVE_CMDS_OPTIONS_HAL_OPTMIN_ENABLED
A syntax error in expression, near
`complex.paramv[29].info.complex.paramv[0].info.complex.paramv[1].info.complex.paramv[0])'.
(gdb) set sysroot ''
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
(g

Re: Displaying structure members named like C keywords.

2014-08-22 Thread Sergio Durigan Junior
On Friday, August 22 2014, Emilio Lopes wrote:

>> Would it be possible for you to come up with a simpler reproducer
>> and send it to this list?  I am guessing there is something else in
>> your code that might be triggering this.
>
> I was hoping for this to be something simple...  Oh, well.

Yeah, sometimes issues are not so simple...

> As you can imagine this is a somewhat larger codebase, with lots of
> automatically generated code from XML files, using those structures.

Sure, that is also why I asked for a simpler reproducer :-).

> (gdb) p P_SLAVE_CMDS_OPTIONS_HAL_OPTMIN_ENABLED
> $1 = (struct param_t *) 0x10db9c <_slave_cmds_options_hal_optmin>
> (gdb) set sysroot ~/projects/hal/system/platform-tam3517/root-debug
> Reading symbols from
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libpthread.so.0...done.
> Loaded symbols for
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libpthread.so.0
> Reading symbols from
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/librt.so.1...done.
> Loaded symbols for
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/librt.so.1
> Reading symbols from
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libstdc++.so.6...done.
> Loaded symbols for
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libstdc++.so.6
> Reading symbols from
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libm.so.6...done.
> Loaded symbols for
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libm.so.6
> Reading symbols from
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libgcc_s.so.1...done.
> Loaded symbols for
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libgcc_s.so.1
> Reading symbols from
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libc.so.6...done.
> Loaded symbols for
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/libc.so.6
> Reading symbols from
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/ld-linux.so.3...done.
> Loaded symbols for
> /home/lopes/projects/hal/system/platform-tam3517/root-debug/lib/ld-linux.so.3
> (gdb) p P_SLAVE_CMDS_OPTIONS_HAL_OPTMIN_ENABLED
> A syntax error in expression, near
> `complex.paramv[29].info.complex.paramv[0].info.complex.paramv[1].info.complex.paramv[0])'.
> (gdb) set sysroot ''
> warning: Unable to find dynamic linker breakpoint function.
> GDB will be unable to debug shared library initializers
> and track explicitly loaded dynamic code.
> (gdb) p P_SLAVE_CMDS_OPTIONS_HAL_OPTMIN_ENABLED
> $2 = (struct param_t *) 0x10db9c <_slave_cmds_options_hal_optmin>
> (gdb)
>
> Problems come and go as I set/unset `sysroot'!!! (I'm debugging code
> running on an ARM evaluation board remotely.)

Hm, OK, I'm thinking about some issue with symbols here (visibility
maybe).  I made lots of attempts here to reproduce it based on what you
posted, but I still cannot see this behavior using GDB from git HEAD.

If you cannot give more instructions on how to reproduce this, then I
have to ask you to file a bug against GDB on
, please.

> Can you give me a hint on what to look for from here?

There are a few debug triggers that you can enable on GDB.  Maybe 'set
debug expression 1' could help.  Also, you can use 'maintenance print
symbols ' to print all the symbols; this could help analyzing
if 'complex' is being hidden by some other library.  Feel free to post
those things here.

Cheers,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb