When can a program be only debugged by dbx, not gdb?

461 Views Asked by At

Today I tried to debug a program on Solaris SPARC by gdb, and it does not work. I was asked to use dbx, then I managed to debug the program.

My Question:

1. When can a program be only debugged by dbx, not gdb?   
2. When do we need to use gdb, not dbx?   
3. Does it depend on the compiler that compiled the code?

Thank you!

1

There are 1 best solutions below

2
On

I tried to debug a program on Solaris SPARC by gdb, and it does not work.

Your question is of very poor quality: "doesn't work" can mean great variety of things, and the answer of why it didn't work depends on details, which you didn't provide.

Generally, compilers on Solaris emit debug info in a standard DWARF format that debuggers (such as gdb and dbx) understand and interpret.

However, there are several versions of the format (current is version 4), and if your debugger is old but your compiler is new, then you are likely to have problems.

Other reasons you may have problems:

  • you invoked GDB incorrectly
  • there is a bug in GDB, and it doesn't handle some legal DWARF4 info.
  • there is a bug in Sun CC, and it emits incorrect DWARF4 info, which gdb rejects, but which dbx accepts.
  • older cc emitted STABS format, which gdb may no longer support. (This does not appear to be the case though.)