[llvm-dev] Help in generating Debug symbols

Nagaraju Mekala via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 11 01:05:05 PST 2017


Hi Paulr,

   Thanks for the pointers.
   In my case debug symbols are not getting generated even in asm
file. I will check the target interaction with Codegen.

Thanks,
Nagaraju

On Sat, Dec 9, 2017 at 3:35 AM, Robinson, Paul <paul.robinson at sony.com> wrote:
>> -----Original Message-----
>> From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of
>> Nagaraju Mekala via llvm-dev
>> Sent: Friday, December 08, 2017 10:06 AM
>> To: Florian Hahn
>> Cc: llvm-dev at lists.llvm.org; nd
>> Subject: Re: [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:
>
> That is not surprising, if all you have done is add a new target.
>
> If you use `clang -g -S` to get an asm file, do you see the
> .debug_info and other .debug_* sections?  Do you see .loc directives?
> If not, the problem is somewhere in how your target interacts with
> CodeGen.  If you see these things in the assembler source, but
> assembling to an object file loses the information, then there is
> likely some problem with how your target interacts with the MC
> layer.  Or, if you are not emitting ELF or MachO object files, but
> have your own object format, then you might have a problem with how
> you have implemented the object file stuff.
>
> I hope this helps narrow down the problem for you.
> --paulr
>
>>
>> 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
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list