public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Issue with debug symbols with garbage collector
@ 2022-04-20  9:15 Nagaraju Mekala
  2022-04-20 19:22 ` Michael Eager
  0 siblings, 1 reply; 6+ messages in thread
From: Nagaraju Mekala @ 2022-04-20  9:15 UTC (permalink / raw)
  To: gcc-help

Hello All,

When I enable the garbage collector for the microblaze compiler compilation
seems to be fine, but the debug symbols are not generated properly.

If we set a breakpoint at 0x0 it is showing some different location, we can
see the same in the objdump as well.


Disassembly of section .vectors.reset:

00000000 <_start>:
*
*
****************************************************************************/
void microblaze_register_handler(XInterruptHandler Handler, void *DataPtr)
{
   MB_InterruptVectorTable[0].Handler = Handler;
   0: b0008000 imm -32768
   4: b8080000 brai 0

for the _start symbols "void microblaze_register_handler(XInterruptHandler
Handler, void *DataPtr)" is coming up.

If I disable the garbage-collector then everything seems fine.
I have used "-ffunction-sections and -fdata-sections" options during
compilation and -gc-sections during linking command.

Please let me know how to tell the garbage collector to not delete
debug_loc information.

Thanks,
Nagaraju

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue with debug symbols with garbage collector
  2022-04-20  9:15 Issue with debug symbols with garbage collector Nagaraju Mekala
@ 2022-04-20 19:22 ` Michael Eager
  2022-04-21  7:27   ` Nagaraju Mekala
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Eager @ 2022-04-20 19:22 UTC (permalink / raw)
  To: Nagaraju Mekala, gcc-help

On 4/20/22 02:15, Nagaraju Mekala via Gcc-help wrote:
> Hello All,
> 
> When I enable the garbage collector for the microblaze compiler compilation
> seems to be fine, but the debug symbols are not generated properly.
> 
> If we set a breakpoint at 0x0 it is showing some different location, we can
> see the same in the objdump as well.

What different location?

> 
> 
> Disassembly of section .vectors.reset:
> 
> 00000000 <_start>:
> *
> *
> ****************************************************************************/
> void microblaze_register_handler(XInterruptHandler Handler, void *DataPtr)
> {
>     MB_InterruptVectorTable[0].Handler = Handler;
>     0: b0008000 imm -32768
>     4: b8080000 brai 0
> 
> for the _start symbols "void microblaze_register_handler(XInterruptHandler
> Handler, void *DataPtr)" is coming up.

It looks like both _start and microblaze_register_handler are both at 0.
What did you expect?

GDB picks the first symbol which matches the address.

> If I disable the garbage-collector then everything seems fine.
> I have used "-ffunction-sections and -fdata-sections" options during
> compilation and -gc-sections during linking command.
> 
> Please let me know how to tell the garbage collector to not delete
> debug_loc information.

Why do you think that the garbage collector is deleting debug info?

-- 
Michael Eager

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue with debug symbols with garbage collector
  2022-04-20 19:22 ` Michael Eager
@ 2022-04-21  7:27   ` Nagaraju Mekala
  2022-04-21 18:11     ` Michael Eager
  0 siblings, 1 reply; 6+ messages in thread
From: Nagaraju Mekala @ 2022-04-21  7:27 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1920 bytes --]

Hi Michael,

Thanks for the reply.

On Thu, Apr 21, 2022 at 12:52 AM Michael Eager <eager@eagercon.com> wrote:

> On 4/20/22 02:15, Nagaraju Mekala via Gcc-help wrote:
> > Hello All,
> >
> > When I enable the garbage collector for the microblaze compiler
> compilation
> > seems to be fine, but the debug symbols are not generated properly.
> >
> > If we set a breakpoint at 0x0 it is showing some different location, we
> can
> > see the same in the objdump as well.
>
> What different location?
>
>  I meant instead of pointing to _start, Debug symbols were pointing to
microblaze_register_handler.

> >
> >
> > Disassembly of section .vectors.reset:
> >
> > 00000000 <_start>:
> > *
> > *
> >
> ****************************************************************************/
> > void microblaze_register_handler(XInterruptHandler Handler, void
> *DataPtr)
> > {
> >     MB_InterruptVectorTable[0].Handler = Handler;
> >     0: b0008000 imm -32768
> >     4: b8080000 brai 0
> >
> > for the _start symbols "void
> microblaze_register_handler(XInterruptHandler
> > Handler, void *DataPtr)" is coming up.
>
> It looks like both _start and microblaze_register_handler are both at 0.
> What did you expect?
>
> GDB picks the first symbol which matches the address.
>
I have attached the elf, where we cannot find any symbols related to
microblaze_register_handler function but the debug_loc is somehow showing
up at _start address.


> > If I disable the garbage-collector then everything seems fine.
> > I have used "-ffunction-sections and -fdata-sections" options during
> > compilation and -gc-sections during linking command.
> >
> > Please let me know how to tell the garbage collector to not delete
> > debug_loc information.
>
> Why do you think that the garbage collector is deleting debug info?
>
I was just guessing since _start debug symbols were mixed with
microblaze_register_handler.


> --
> Michael Eager
>

[-- Attachment #2: kc705_hello.elf --]
[-- Type: application/octet-stream, Size: 202256 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue with debug symbols with garbage collector
  2022-04-21  7:27   ` Nagaraju Mekala
@ 2022-04-21 18:11     ` Michael Eager
  2022-04-21 18:28       ` Michael Eager
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Eager @ 2022-04-21 18:11 UTC (permalink / raw)
  To: Nagaraju Mekala, Michael Eager; +Cc: gcc-help

On 4/21/22 00:27, Nagaraju Mekala via Gcc-help wrote:
>>   I meant instead of pointing to _start, Debug symbols were pointing to
> microblaze_register_handler.

Both symbols are at location 0.

> I have attached the elf, where we cannot find any symbols related to
> microblaze_register_handler function but the debug_loc is somehow showing
> up at _start address.

There are two places where symbols are defined.  One is in the ELF
symbol table:

    $ readelf -s kc705_hello.elf | grep " _start"
    277: 0000000000000000     0 FUNC    GLOBAL DEFAULT    1 _start

The other in the DWARF debug_info section:

    $ readelf -w kc705_hello.elf
<1><383>: Abbrev Number: 15 (DW_TAG_subprogram)
     <384>   DW_AT_external    : 1
     <384>   DW_AT_name        : (indirect string, offset: 0xf783): 
microblaze_register_handler
     <388>   DW_AT_decl_file   : 1
     <389>   DW_AT_decl_line   : 86
     <38a>   DW_AT_decl_column : 6
     <38b>   DW_AT_prototyped  : 1
     <38b>   DW_AT_low_pc      : 0x0              <=== Fun is at 0x0000
     <393>   DW_AT_high_pc     : 0x18
     <39b>   DW_AT_frame_base  : 1 byte block: 9c 
(DW_OP_call_frame_cfa)
     <39d>   DW_AT_call_all_calls: 1
     <39d>   DW_AT_sibling     : <0x3bc>

GDB uses the DWARF information before falling back to using the
ELF symbol table.

-- 
Michael Eager

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue with debug symbols with garbage collector
  2022-04-21 18:11     ` Michael Eager
@ 2022-04-21 18:28       ` Michael Eager
  2022-04-22  6:29         ` Nagaraju Mekala
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Eager @ 2022-04-21 18:28 UTC (permalink / raw)
  To: Michael Eager, Nagaraju Mekala; +Cc: gcc-help

On 4/21/22 11:11, Michael Eager wrote:
> On 4/21/22 00:27, Nagaraju Mekala via Gcc-help wrote:
>>>   I meant instead of pointing to _start, Debug symbols were pointing to
>> microblaze_register_handler.
> 
> Both symbols are at location 0.
> 
>> I have attached the elf, where we cannot find any symbols related to
>> microblaze_register_handler function but the debug_loc is somehow showing
>> up at _start address.
> 
> There are two places where symbols are defined.  One is in the ELF
> symbol table:
> 
>     $ readelf -s kc705_hello.elf | grep " _start"
>     277: 0000000000000000     0 FUNC    GLOBAL DEFAULT    1 _start

There are a number of symbols with the prefix microblaze_ which appear 
in the ELF symbol table.  I can't tell from the very limited information 
you provide why those are included but microblaze_register_handler is 
not.  This probably has to do with how these functions are written.

-- 
Michael Eager

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue with debug symbols with garbage collector
  2022-04-21 18:28       ` Michael Eager
@ 2022-04-22  6:29         ` Nagaraju Mekala
  0 siblings, 0 replies; 6+ messages in thread
From: Nagaraju Mekala @ 2022-04-22  6:29 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-help

On Thu, Apr 21, 2022 at 11:58 PM Michael Eager <eager@eagercon.com> wrote:

> On 4/21/22 11:11, Michael Eager wrote:
> > On 4/21/22 00:27, Nagaraju Mekala via Gcc-help wrote:
> >>>   I meant instead of pointing to _start, Debug symbols were pointing to
> >> microblaze_register_handler.
> >
> > Both symbols are at location 0.
> >
> >> I have attached the elf, where we cannot find any symbols related to
> >> microblaze_register_handler function but the debug_loc is somehow
> showing
> >> up at _start address.
> >
> > There are two places where symbols are defined.  One is in the ELF
> > symbol table:
> >
> >     $ readelf -s kc705_hello.elf | grep " _start"
> >     277: 0000000000000000     0 FUNC    GLOBAL DEFAULT    1 _start
>
> There are a number of symbols with the prefix microblaze_ which appear
> in the ELF symbol table.  I can't tell from the very limited information
> you provide why those are included but microblaze_register_handler is
> not.  This probably has to do with how these functions are written.
>
Thanks for the information.
I will check why microblaze_register_handler is not part of symbol table.

-Nagaraju

>
> --
> Michael Eager
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-22  6:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  9:15 Issue with debug symbols with garbage collector Nagaraju Mekala
2022-04-20 19:22 ` Michael Eager
2022-04-21  7:27   ` Nagaraju Mekala
2022-04-21 18:11     ` Michael Eager
2022-04-21 18:28       ` Michael Eager
2022-04-22  6:29         ` Nagaraju Mekala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).