[llvm-dev] Help in generating Debug symbols

Nagaraju Mekala via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 8 10:05:38 PST 2017


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


More information about the llvm-dev mailing list