Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Relaxations vs debug info
@ 2017-03-15  0:04 James Bowman
  2017-03-15  5:55 ` Senthil Kumar Selvaraj
  0 siblings, 1 reply; 2+ messages in thread
From: James Bowman @ 2017-03-15  0:04 UTC (permalink / raw)
  To: gdb

I am working on some linker relaxations for my target, using existing 
relaxation implementations as my pattern.

Everything seems to be working: relaxations are being applied, for example
relaxation reduces the size of function foo from 0x48 to 0x38 bytes. 
Checking symbols, it looks good:

    $ ft32-elf-objdump -t a.out  | grep foo
    0000033c g     F .text  00000038 foo

However when I look at the debug info (objdump -g) I see that the size is still 0x48:

    <a1d>   DW_AT_name        : foo
    <a21>   DW_AT_decl_file   : 1
    <a22>   DW_AT_decl_line   : 51
    <a23>   DW_AT_prototyped  : 1
    <a23>   DW_AT_type        : <0x5d>
    <a27>   DW_AT_low_pc      : 0x33c
    <a2b>   DW_AT_high_pc     : 0x48
    
Unsurprisingly this confuses gdb.

My question is: in relaxation, how does the gdb info get adjusted? 


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

* Re: Relaxations vs debug info
  2017-03-15  0:04 Relaxations vs debug info James Bowman
@ 2017-03-15  5:55 ` Senthil Kumar Selvaraj
  0 siblings, 0 replies; 2+ messages in thread
From: Senthil Kumar Selvaraj @ 2017-03-15  5:55 UTC (permalink / raw)
  To: James Bowman; +Cc: gdb


James Bowman writes:

> I am working on some linker relaxations for my target, using existing 
> relaxation implementations as my pattern.
>
> Everything seems to be working: relaxations are being applied, for example
> relaxation reduces the size of function foo from 0x48 to 0x38 bytes. 
> Checking symbols, it looks good:
>
>     $ ft32-elf-objdump -t a.out  | grep foo
>     0000033c g     F .text  00000038 foo
>
> However when I look at the debug info (objdump -g) I see that the size is still 0x48:
>
>     <a1d>   DW_AT_name        : foo
>     <a21>   DW_AT_decl_file   : 1
>     <a22>   DW_AT_decl_line   : 51
>     <a23>   DW_AT_prototyped  : 1
>     <a23>   DW_AT_type        : <0x5d>
>     <a27>   DW_AT_low_pc      : 0x33c
>     <a2b>   DW_AT_high_pc     : 0x48
>     
> Unsurprisingly this confuses gdb.
>
> My question is: in relaxation, how does the gdb info get adjusted? 

1. Are you seeing relocs at the offsets for ow_pc and high_pc in the
debug_info section?

2. When relaxing, are you adjusting reloc values in debug sections as well?
If the reloc value is sym + addend, and if the relaxation occurs between
sym and addend, you'd obviously need to adjust the addend downwards.

Regards
Senthil


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

end of thread, other threads:[~2017-03-15  5:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-15  0:04 Relaxations vs debug info James Bowman
2017-03-15  5:55 ` Senthil Kumar Selvaraj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox