Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging an llvm pass with gdb

Tags:

debugging

llvm

Is it possible to debug an llvm pass using gdb? I couldn't find any docs on the llvm site.

like image 679
Arjun Singri Avatar asked Feb 09 '10 01:02

Arjun Singri


People also ask

What is the command to debug using GDB?

l command: Use gdb command l or list to print the source code in the debug mode. Use l line-number to view a specific line number (or) l function to view a specific function. bt: backtrack – Print backtrace of all stack frames, or innermost COUNT frames. help – View help for a particular gdb topic — help TOPICNAME.

Can GDB be used with clang?

You can use GDB or lldb with clang.

Is LLDB better than GDB?

In brief, LLDB and GDB are two debuggers. The main difference between LLDB and GDB is that in LLDB, the programmer can debug programs written in C, Objective C and C++ while, in GDB, the programmer can debug programs written in Ada, C, C++, Objective C, Pascal, FORTRAN and Go.

Is LLDB compatible with GDB?

The standard LLDB installation provides you with an extensive set of commands designed to be compatible with familiar GDB commands. In addition to using the standard configuration, you can easily customize LLDB to suit your needs. Both GDB and LLDB are of course excellent debuggers without doubt.


1 Answers

Yes. Build LLVM in non-release mode (the default). It takes a bit longer than a release build, but you can use gdb to debug the resulting object file.

One note of caution: I had to upgrade my Linux box to 3GB of memory to make LLVM debug mode link times reasonable.

like image 92
Richard Pennington Avatar answered Oct 25 '22 17:10

Richard Pennington