Unix Programming - DBX_DEBUGGING_INFO

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > August 2005 > DBX_DEBUGGING_INFO





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author DBX_DEBUGGING_INFO
grid

2005-08-17, 5:59 pm

Hi,
Maybe this might be specific to gcc.I am working on Solaris 8, and in
the process of debugging some 64 bit executable,needed to use the
studio8 dbx debugger,because the default gdb cannot load 64 bit binaries
for debugging.

Now while compiling with debug options (passing -g),when working with
gdb might work fine as gcc emits extra information specific to gdb.
From the gcc Man Page :

-g
Produce debugging information in the operating system's native
format (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging
information.

On most systems that use stabs format, -g enables use of extra
debugging information that only GDB can use; this extra information
makes debugging work better in GDB but will probably make other
debuggers crash or refuse to read the program. If you want to control
for certain whether to generate the extra information, use -gstabs+,
-gstabs, -gxcoff+, -gxcoff, or -gvms

What debug flags should I use use for DBX ? The below macro from the gcc
info pages tells :

DBX_DEBUGGING_INFO

Define this macro if GCC should produce debugging output for DBX in
response to the -g option.

Now with response to this macro,which is the flag that gets passed.Again
it depends on the OS's native format.How do I know whats the native
format for Solaris on SPARC ?If I would have used Sun's native
compiler,then it would automatically generate the debug info in a format
which dbx can understand.

There are multiple options like : -g -ggdb -gstabs -gstabs+ -gcoff
-gdwarf ... and I am not sure which should be the correct option.What if
I pass all the options , will it then pick up correctly according to the
native format of the OS.

Any light on this will be highly appreciated.

Thanks,

Paul Pluzhnikov

2005-08-18, 2:49 am

grid <prohit99@gmail.com> writes:

> Maybe this might be specific to gcc.I am working on Solaris 8, and
> in the process of debugging some 64 bit executable,needed to use
> the studio8 dbx debugger,because the default gdb cannot load 64 bit
> binaries for debugging.


It may just be easier to build gdb-6.1 (or whatever the latest gdb
is), which has no trouble with 64-bit binaries.

> If you
> want to control for certain whether to generate the extra
> information, use -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms


You obviously know how to read the manual. The same manual contains:

`-gstabs'
Produce debugging information in stabs format (if that is
supported), without GDB extensions.
^^^^^^^^^^^^^^^^^^^^^^

That's the flag you'll want to use on Solaris 8.

> DBX_DEBUGGING_INFO
>
> Define this macro if GCC should produce debugging output for DBX
> in response to the -g option.


Define that macro if you are building 'gcc' itself, and want it to
generate DBX debug info in response to '-g'. If you are not
rebuilding 'gcc' itself, this macro is of no use to you.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
grid

2005-08-18, 2:49 am

> You obviously know how to read the manual. The same manual contains:
>
> `-gstabs'
> Produce debugging information in stabs format (if that is
> supported), without GDB extensions.
> ^^^^^^^^^^^^^^^^^^^^^^
>
> That's the flag you'll want to use on Solaris 8.

I used this flag this is what I get :
$/usr/local/packages/gcc-3.4.2/bin/gcc -gstabs test.c
bash-2.03$ ls
bash-2.03$ dbx a.out
Reading a.out
Reading ld.so.1
Reading libc.so.1
Reading libdl.so.1
Reading libc_psr.so.1
(dbx) stop in main

dbx: warning: 'main' has no debugger info -- will trigger on first
instruction
(2) stop in main
(dbx)

But using the -gstabs+ flags does not have any issues ,even though the
manual says this :
-gstabs+
Produce debugging information in stabs format (if that
is supported), using GNU extensions understood only by
the GNU debugger (GDB). The use of these extensions is
likely to make other debuggers crash or refuse to read
the program.

Thanks,
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com