Is there an equivalent of GDB for GCC for debugging when compiling with CLANG?

13,312

Solution 1

LLDB appears to be the equivalent debugger for CLANG. Here are some links I found on learning LLDB and the equivalent commands for LLDB from GDB.

http://lldb.llvm.org/lldb-gdb.html

http://meowni.ca/posts/unscary-lldb/

How to debug Clang plugin using lldb (or gdb)

Solution 2

You can use GDB or lldb with clang.


for example

$ clang hello.c -g
$ gdb a.out
Share:
13,312
joshuatvernon
Author by

joshuatvernon

Concurrently studying a Bachelor of Science at the University of Sydney with majors in Computer Science and Informations Systems and working as a Software Engineer @ Huddle.

Updated on July 06, 2022

Comments

  • joshuatvernon
    joshuatvernon almost 2 years

    I have found that you can debug with GDB when compiling with GCC however at our university we are required to use CLANG for compiling and I can't find an equivalent of GDB for GCC for CLANG, is there one?

  • Alex028502
    Alex028502 over 2 years
    The example in my edit worked for me, but I don't really know if that's what you are supposed to do. I might just be trying out Cunningham's Law here.