[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Displaying structure members named like C keywords.
From: |
Emilio Lopes |
Subject: |
Displaying structure members named like C keywords. |
Date: |
Thu, 21 Aug 2014 14:39:11 +0200 |
I'm having trouble trying to display structure members with names like
C keywords. GDB refuses to display the member called `complex' in
this case.
Here is the structure:
(gdb) p g_global_paramv[37].info
$27 = {
complex = {
paramc = 20,
paramv = 0xd14f4 <_sys_opt>
},
cmd = {
cmd_fct = 0x14,
wrap = 0xd14f4 <_sys_opt>
},
alias = {
type = 20,
link = 0xd14f4 <_sys_opt>
}
}
Printing other members is no problem:
(gdb) p g_global_paramv[37].info.cmd
$28 = {
cmd_fct = 0x14,
wrap = 0xd14f4 <_sys_opt>
}
(gdb) p g_global_paramv[37].info.alias
$29 = {
type = 20,
link = 0xd14f4 <_sys_opt>
}
But trying to print the member `complex' results in an error:
(gdb) p g_global_paramv[37].info.complex
A syntax error in expression, near `complex'.
Note that the error message for non-existing members is different
depending if their names are C keywords (`long' and `int' => "syntax
error") or not (`foobar', `xyz' => "no member named ...").
(gdb) p g_global_paramv[37].info.foobar
There is no member named foobar.
(gdb) p g_global_paramv[37].info.long
A syntax error in expression, near `long'.
(gdb) p g_global_paramv[37].info.int
A syntax error in expression, near `int'.
(gdb) p g_global_paramv[37].info.xyz
There is no member named xyz.
(gdb)
This happens using gdb-7.8 configured as following:
(gdb) show version
GNU gdb (GDB) 7.8
Copyright (C) 2014 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 "--host=x86_64-unknown-linux-gnu
--target=arm-cortexa8-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) show configuration
This GDB was configured as follows:
configure --host=x86_64-unknown-linux-gnu
--target=arm-cortexa8-linux-gnueabi
--with-auto-load-dir=$debugdir:$datadir/auto-load
--with-auto-load-safe-path=$debugdir:$datadir/auto-load
--with-expat
--with-gdb-datadir=/usr/local/share/gdb (relocatable)
--with-jit-reader-dir=/usr/local/lib/gdb (relocatable)
--without-libunwind-ia64
--with-lzma
--with-python=/usr
--without-guile
--with-separate-debug-dir=/usr/local/lib/debug (relocatable)
--with-zlib
--without-babeltrace
("Relocatable" means the directory can be moved with the GDB installation
tree, and GDB will still find it.)
The code was compiled using:
$ arm-cortexa8-linux-gnueabi-gcc --version
arm-cortexa8-linux-gnueabi-gcc (OSELAS.Toolchain-2012.12.1
linaro-4.7-2012.11) 4.7.3 20121106 (prerelease)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GDB itself was compiled with:
$ gcc --version
gcc (Debian 4.9.0-7) 4.9.0
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thank you very much!
EmÃlio
- Displaying structure members named like C keywords.,
Emilio Lopes <=
- Re: Displaying structure members named like C keywords., Sergio Durigan Junior, 2014/08/21
- Re: Displaying structure members named like C keywords., Emilio Lopes, 2014/08/21
- Re: Displaying structure members named like C keywords., Sergio Durigan Junior, 2014/08/21
- Re: Displaying structure members named like C keywords., Emilio Lopes, 2014/08/22
- Re: Displaying structure members named like C keywords., Sergio Durigan Junior, 2014/08/22
- Re: Displaying structure members named like C keywords., Emilio Lopes, 2014/08/26
- Re: Displaying structure members named like C keywords., Sergio Durigan Junior, 2014/08/26
- Re: Displaying structure members named like C keywords., Emilio Lopes, 2014/08/27
- Re: Displaying structure members named like C keywords., Sergio Durigan Junior, 2014/08/27
- Re: Displaying structure members named like C keywords., Emilio Lopes, 2014/08/27