Nagaraju Mekala via llvm-dev
2017-Dec-08 06:24 UTC
[llvm-dev] Help in generating Debug symbols
Hi all, I am new to LLVM. Currently working on adding an embedded target to LLVM backend. I was able to generate the object file for our target using LLVM and Clang framework. The generated object file doesn't contain any debug symbols in it. I tried searching documents related to this on web but couldn't find any. Can anyone please point some links/documents on generation of dwarf debug symbols for the generated object file. Thanks in Advance Nagaraju
Florian Hahn via llvm-dev
2017-Dec-08 13:18 UTC
[llvm-dev] Help in generating Debug symbols
Hi, On 08/12/2017 06:24, Nagaraju Mekala via llvm-dev wrote:> Hi all, > > I am new to LLVM. Currently working on adding an embedded target to > LLVM backend. > I was able to generate the object file for our target using LLVM and > Clang framework. > The generated object file doesn't contain any debug symbols in it. >What commands are you using? Do you get object files with debug info for other backends? If you pass `clang -g`, debug info should be generated. In the IR, you should have !dbg metadata. Cheers, Florian
Nagaraju Mekala via llvm-dev
2017-Dec-08 18:05 UTC
[llvm-dev] Help in generating Debug symbols
Hi Florian, Thanks for the reply. On Fri, Dec 8, 2017 at 6:48 PM, Florian Hahn <florian.hahn at arm.com> wrote:> Hi, > > On 08/12/2017 06:24, Nagaraju Mekala via llvm-dev wrote: >> >> Hi all, >> >> I am new to LLVM. Currently working on adding an embedded target to >> LLVM backend. >> I was able to generate the object file for our target using LLVM and >> Clang framework. >> The generated object file doesn't contain any debug symbols in it. >> > > What commands are you using?llvm/bin/clang -g -target xmb -c a.c> Do you get object files with debug info for> other backends?Yes, for ARM and X86 targets debug symbols are generating fine.> If you pass `clang -g`, debug info should be generated. In> the IR, you should have !dbg metadata.Yes I can see the !dbg metadata in ll file: a.c --------------------------- int main() { printf ("Hello World\n"); return 0; } a.ll -------------------------------- @.str = private unnamed_addr constant [13 x i8] c"Hello World\0A\00", align 1 ; Function Attrs: nounwind define i32 @main() #0 !dbg !4 { entry: %retval = alloca i32, align 4 store i32 0, i32* %retval, align 4 %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0)), !dbg !12 ret i32 0, !dbg !13 } Thanks, Nagaraju .> Cheers, > Florian