This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/4] Allow display of negative offsets in print_address_symbolic()


On Wed, 3 Jul 2019 16:09:21 -0700
Kevin Buettner <kevinb@redhat.com> wrote:

> When I say "x/i foo_cold", I do think I'd prefer to see <foo_cold> instead
> of <foo-19>.
> 
> However, when I do "x/5i $pc" after doing "up" from the baz frame, I think
> I somewhat prefer seeing foo with negative offsets.
> 
> What would you think about this behavior?
> 
> (gdb) x/5i foo_cold
>    0x40110d <foo_cold>:	push   %rbp
>    0x40110e <foo-18>:	mov    %rsp,%rbp
>    0x401111 <foo-15>:	callq  0x401106 <baz>
> => 0x401116 <foo-10>:	nop  
>    0x401117 <foo-9>:	pop    %rbp
> 
> I.e. prefer the minsym for offset 0, but use the function symbol for
> the non-zero offsets.

For the v2 version of this series, I've implemented the behavior shown
above.

I (hopefully) provide a good rationale for this behavior in the
commit comment.  (So, if you don't immediately like it, stay tuned
for the v2 patch series.)

> Another possibility:
> 
> (gdb) x/5i foo_cold
>    0x40110d <foo-19> <foo_cold>: push   %rbp
>    0x40110e <foo-18>:	mov    %rsp,%rbp
>    0x401111 <foo-15>:	callq  0x401106 <baz>
> => 0x401116 <foo-10>:	nop  
>    0x401117 <foo-9>:	pop    %rbp
> 
> I.e, show both the function symbol (plus/minus offset) AND the minsym,
> but only show the minsym for the zero offset.
> 
> I haven't tried implementing either of these approaches yet, but
> I can take a look at it if we have some concensus over what the output
> should look like.

I sort of like this one too, but it's harder to implement, causes some
of the lines to be longer, and will also make it less likely that all
of the instructions associated with a given function will line up.

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]