Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 4/4] [gdb/symtab] Use unrelocated addresses in call_site
Date: Fri, 01 Oct 2021 16:56:41 -0400	[thread overview]
Message-ID: <82e1a4ada2d2fbef2b436f707c9cf435@polymtl.ca> (raw)
In-Reply-To: <20211001123328.22314-4-tdevries@suse.de>

On 2021-10-01 08:33, Tom de Vries via Gdb-patches wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
> 
> Consider test-case gdb.trace/entry-values.exp with target board
> unix/-fPIE/-pie.
> 
> Using this command we have an abbreviated version, and can see the 
> correct
> @entry values for foo:
> ...
> $ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \
>   -ex start \
>   -ex "break foo" \
>   -ex "set print entry-values both" \
>   -ex continue
> Temporary breakpoint 1 at 0x679
> 
> Temporary breakpoint 1, 0x0000555555554679 in main ()
> Breakpoint 2 at 0x55555555463e
> 
> Breakpoint 2, 0x000055555555463e in foo (i=0, i@entry=2, j=2, 
> j@entry=3)
> ...
> 
> Now, let's try the same again, but run directly to foo rather than 
> stopping at
> main:
> ...
> $ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \
>   -ex "break foo" \
>   -ex "set print entry-values both" \
>   -ex run
> Breakpoint 1 at 0x63e
> 
> Breakpoint 1, 0x000055555555463e in foo (i=0, i@entry=<optimized out>, 
> \
>   j=2, j@entry=<optimized out>)
> ...
> 
> So, what explains the difference?  Noteworthy, this is a dwarf assembly
> test-case, with debug info for foo and bar, but not for main.
> 
> In the first case:
> - we run to main
> - this does not trigger expanding debug info, because there's none for 
> main
> - we set a breakpoint at foo
> - this triggers expanding debug info.  Relocated addresses are used in
>   call_site info (because the exec is started)
> - we continue to foo, and manage to find the call_site info
> 
> In the second case:
> - we set a breakpoint at foo
> - this triggers expanding debug info.  Unrelocated addresses are used 
> in
>   call_site info (because the exec is not started)
> - we run to foo
> - this triggers objfile_relocate1, but it doesn't update the call_site
>   info addresses
> - we don't manage to find the call_site info

Thanks for this explanation, I had not realized the difference in 
behavior here.

The patch LGTM.

Simon

  reply	other threads:[~2021-10-01 20:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 12:33 [PATCH 1/4] [gdb/symtab] Fix htab_find_slot call in read_call_site_scope Tom de Vries via Gdb-patches
2021-10-01 12:33 ` [PATCH 2/4] [gdb/symtab] Remove COMPUNIT_CALL_SITE_HTAB Tom de Vries via Gdb-patches
2021-10-01 13:13   ` Simon Marchi via Gdb-patches
2021-10-01 12:33 ` [PATCH 3/4] [gdb/symtab] Add call_site::pc () Tom de Vries via Gdb-patches
2021-10-01 18:10   ` Simon Marchi
2021-10-04 16:45     ` Tom de Vries via Gdb-patches
2021-10-01 12:33 ` [PATCH 4/4] [gdb/symtab] Use unrelocated addresses in call_site Tom de Vries via Gdb-patches
2021-10-01 20:56   ` Simon Marchi via Gdb-patches [this message]
2021-10-04 16:47     ` Tom de Vries via Gdb-patches
2021-10-01 13:09 ` [PATCH 1/4] [gdb/symtab] Fix htab_find_slot call in read_call_site_scope Simon Marchi via Gdb-patches
2021-10-03 19:34   ` Tom de Vries via Gdb-patches
2021-10-04 12:05     ` Simon Marchi via Gdb-patches
2021-10-04 12:46       ` Tom de Vries via Gdb-patches
2021-10-04 15:41         ` Simon Marchi via Gdb-patches
2021-10-04 16:14           ` Tom de Vries via Gdb-patches
2021-10-04 16:34             ` Simon Marchi via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82e1a4ada2d2fbef2b436f707c9cf435@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox