1

I am using clang on a linux environment to compile a C program. When trying to debug the executable using ddd, it does not find the debug symbols (yes, they are included). When I use gcc instead of clang to build, then ddd seems to work fine.

According to the documentation, one can define the "inferior debugger" (the underlying debugger) in a ddd session. By default is auto-detects the debugger to use, and for my program it uses gdb.

How can I debug the clang executable with ddd? Should I use a different inferior debugger, and if so, which one?

Note: according to the docs, lldb is not supported by ddd.

Update: here's what clang reports:

clang version 16.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /tools/oss/packages/x86_64-rocky8/llvm/default/bin

and the command line used:

$ clang -g -O0 -o ddd_test.e ddd_test.c
$ ddd ddd_test.e

The result:

enter image description here

When using gcc:

$ gcc -g -O0 -o ddd_test.e ddd_test.c
$ ddd ddd_test.e

The result is:

enter image description here

Running on Rocky Linux 8.10

6
  • Can't reproduce. On a linux env too, using both gcc and clang, and in both case, using default gdb as "inferior" debugger (which, indeed, is the only one that counts. ddd does know anything about debugging. It is merely a window with buttons that replace "step", "next", etc. Displays code source, translate line number into some highlight in the code source, etc. Not saying it is nothing. But well, it is a graphical tool that calls gdb, and feed it some strings in a pipe, and parse the strings that gdb prints) Commented Jul 22 at 1:23
  • But well, point is, clang compiled programs work well with ddd here, or directly with gdb without complaining about symbol (and showing correct line number, function names, variables names and values, etc.) Commented Jul 22 at 1:24
  • 2
    What compiler options are you using with clang, what platform/distro are you on? Version of clang? Commented Jul 22 at 1:46
  • 1
    The question was edited to including the clang version; I think it is a good question. The worst that can happen is that the reason is a quirk in the OP's environment, but that would be valuable information as well. Commented Jul 22 at 19:45
  • What is the version of gdb? From the partial output shown (as an image...) this looks like the same issue as in stackoverflow.com/questions/17958650/… Commented Jul 23 at 10:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.