llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.1k stars 12.01k forks source link

debug info for MACRO not produced #14524

Open 2094601b-373c-43bf-9fad-2557fa9f70d5 opened 12 years ago

2094601b-373c-43bf-9fad-2557fa9f70d5 commented 12 years ago
Bugzilla Link 14152
Version trunk
OS MacOS X
Blocks llvm/llvm-bugzilla-archive#24345
Attachments bitcode file
CC @adrian-prantl,@echristo,@zygoloid

Extended Description

Consider the test:

$ cat test2.c

define ADD1(x) (x+1)

int n = 0; int main(int argc) { int n = ADD1(argc); return n; }

Macro ADD1 is not mentioned in debug info for test2.c. Are there any plans on adding debug info for macros in clang?

Compilation line: clang -g -O0 test2.c -emit-llvm -o test2.bc -S

Olga Chupina

Software Engineer Intel Compiler Team Intel Corp.

llvmbot commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#24345

llvmbot commented 7 years ago

Debug info macros is already support in dwarf4 format starting from revision 294637.

In order to enable debug info macros you can use -fdebug-macro flag with -g. In fact, this flag will work with all debug info flags other than -g0.

If we want to be compatible with GCC, we need to enable debug info macros when using -g3. To do that, we need to map "-g3" to "-cc1 -debug-info-macro -debug-info-kind=standalone".

I am not planing to do that though.

Regards, Amjad

echristo commented 12 years ago

I'm not planning (and don't know of anyone planning) to do this anytime soon, no.

lattner commented 12 years ago

I don't know of anyone planning to do this, but it is generally only produced when using "-g3" since it bloats generated debug information significantly.