Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LLDB debugger - how to evaluate C macros?

Tags:

xcode

gdb

lldb

I am trying to debug an application that makes extensive use of C macros (nested macros of macros). It gives "use of undeclared identifier" error.

Is there any way to make LLDB debugger recognize and evaluate it properly? I can decompose the macros myself and write the full expression but it's very tedious and error prone.

like image 480
fatdragon Avatar asked Mar 11 '13 02:03

fatdragon


People also ask

Is LLDB better than GDB?

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.

What is LLDB in C?

LLDB is the default debugger in Xcode on macOS and supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator. All of the code in the LLDB project is available under the “Apache 2.0 License with LLVM exceptions”.

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.

How do you make a breakpoint in LLDB?

In lldb you can set breakpoints by typing either break or b followed by information on where you want the program to pause. After the b command, you can put either: a function name (e.g., b my_subroutine ) a line number (e.g., b 12 )


1 Answers

Unfortunately this is not gonna happen because we get no debug info for macros from the compiler, which kinda makes sense because macros disappear after the preprocessor does its deed and before the compiler converts your sources to machine code.

like image 130
Enrico Granata Avatar answered Oct 02 '22 01:10

Enrico Granata