Operating System - HP-UX
1757846 Members
2999 Online
108866 Solutions
New Discussion юеВ

Re: debug error No symbol in current context when compiling 64bit

 
kwagner
New Member

debug error No symbol in current context when compiling 64bit

I have following program (excerpt):
main(int argc, char *argv[])
{ char buffer [10+EN];
...
when debugging using /opt/langtools/bin/vdb -d . -d /users/progs/fors_neu/share/lib -d /users/progs/fors_neu/share/src -tty=/dev/$ttydev -xdb -tui obj/myprog
following error happens:
(wdb) p buffer
No symbol "buffer" in current context.
------------
compile command: (excerpt)
cc -D_ANSI_C_PROTOS_ -U__HP_CURSES -D_XOPEN_SOURCE_EXTENDED
-Agcc +w
-g
-L/usr/local/lib/hpux64 +DD64 -Wl,-z -Wl,+b
-I/usr/local/include -lpgport -lxnet -lz -lreadline -lm
-o obj/myprog myprog.c -lcurses

compiler version:
/opt/aCC/bin/cc: HP C/aC++ for Integrity Servers B3910B A.06.15 [May 16 2007]
debugger version:
HP VDB 2.0 is based on Vim 5.7
HP gdb 5.7 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.
Question: What causes the problem for the missing symbol???
3 REPLIES 3
kwagner
New Member

Re: debug error No symbol in current context when compiling 64bit

buffer has not been used-therefore the error
kwagner
New Member

Re: debug error No symbol in current context when compiling 64bit

-----------------

Re: debug error No symbol in current context when compiling 64bit

> cc -D_ANSI_C_PROTOS_ -U__HP_CURSES
> -D_XOPEN_SOURCE_EXTENDED -Agcc +w -g
Since -Agcc is used cc should behave like GCC.

> buffer has not been used-therefore the error
But GCC's behaviiour is to emit debugging information for all types declared in a compilation unit, regardless of whether or not they are actually used in that compilation unit.

> compiler version: .... HP C/aC++ for Integrity Servers B3910B A.06.15 ....
This feature is available in PA cc (though not by default. It needs HPC_DEBUG_COMPAT).
$export HPC_DEBUG_COMPAT=1
$cc -g unused_char_arr_debug.c
$gdb a.out
....
(gdb) ptype buffer
type = char [10]

http://www.docs.hp.com/en/5991-4869/ch01s07.html#bgbghgib

HPC_DEBUG_COMPAT Environment Variable: HP C does not emit debug information for unused objects (structures, unions, and others) anymore with the -g option. For getting the older behavior (emitting debug information for all objects, irrespective of whether they are used in the program or not), the environment variable HPC_DEBUG_COMPAT can be set in the environment along with the -g option in the compilation command line. It suffices to define this environment variable to have an empty string; it does not need to be set to any particular value.