0

今天尝试用gdb在Solaris SPARC上调试一个程序,还是不行。我被要求使用 dbx,然后我设法调试了程序。

我的问题:

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?

谢谢!

4

1 回答 1

2

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.)
于 2014-06-07T16:14:58.267 回答