public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/5] Change linetables to be objfile-independent
Date: Fri, 10 Mar 2023 22:48:47 -0500	[thread overview]
Message-ID: <f7445f02-258b-6635-ed79-b604b7c2e39d@simark.ca> (raw)
In-Reply-To: <20230308-submit-constify-linetable-v1-2-ca4057478141@tromey.com>

> diff --git a/gdb/objfiles.c b/gdb/objfiles.c
> index 8e7be8e2e25..2c8f5d14444 100644
> --- a/gdb/objfiles.c
> +++ b/gdb/objfiles.c
> @@ -616,22 +616,6 @@ objfile_relocate1 (struct objfile *objfile,
>  
>    /* OK, get all the symtabs.  */
>    {
> -    for (compunit_symtab *cust : objfile->compunits ())
> -      {
> -	for (symtab *s : cust->filetabs ())
> -	  {
> -	    struct linetable *l;
> -
> -	    /* First the line table.  */
> -	    l = s->linetable ();
> -	    if (l)
> -	      {
> -		for (int i = 0; i < l->nitems; ++i)
> -		  l->item[i].pc += delta[SECT_OFF_TEXT (objfile)];
> -	      }
> -	  }
> -      }
> -
It's nice to see the objfile_relocate1 function shrinking, it's like a
progress meter of your project :).

> diff --git a/gdb/symmisc.c b/gdb/symmisc.c
> index 6ff06ccaa93..d1458784e5c 100644
> --- a/gdb/symmisc.c
> +++ b/gdb/symmisc.c
> @@ -263,7 +263,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
>        for (int i = 0; i < len; i++)
>  	{
>  	  gdb_printf (outfile, " line %d at ", l->item[i].line);
> -	  gdb_puts (paddress (gdbarch, l->item[i].pc), outfile);
> +	  gdb_puts (paddress (gdbarch, l->item[i].raw_pc ()), outfile);

Here, do we want to see the raw of the relocated PC?  Maybe both, if
different?  The one you want depends if you are trying to match this
information against addresses from the ELF file (unrelocated) or against
addresses from the inferior (relocated).

> diff --git a/gdb/symtab.h b/gdb/symtab.h
> index 69f0eaa0f88..84d12617f31 100644
> --- a/gdb/symtab.h
> +++ b/gdb/symtab.h
> @@ -1547,18 +1547,29 @@ struct rust_vtable_symbol : public symbol
>  
>  struct linetable_entry
>  {
> +  /* Set the (unrelocated) PC for this entry.  */
> +  void set_pc (CORE_ADDR pc)
> +  { m_pc = pc; }

For symmetry with the getter, should this one be named "set_raw_pc"?

Simon


  reply	other threads:[~2023-03-11  3:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 15:42 [PATCH 0/5] Make line tables independent of objfile Tom Tromey
2023-03-08 15:42 ` [PATCH 1/5] Add operator< and operator== to linetable_entry Tom Tromey
2023-03-11  3:21   ` Simon Marchi
2023-03-08 15:42 ` [PATCH 2/5] Change linetables to be objfile-independent Tom Tromey
2023-03-11  3:48   ` Simon Marchi [this message]
2023-03-11 15:36     ` Tom Tromey
2023-03-11 19:13       ` Simon Marchi
2023-03-12  3:24         ` Tom Tromey
2023-03-12 13:40           ` Simon Marchi
2023-03-16 14:02             ` Tom Tromey
2023-03-16 14:45               ` Simon Marchi
2023-03-16 23:43                 ` Tom Tromey
2023-03-17  2:45                   ` Simon Marchi
2023-03-17 13:09                     ` Tom Tromey
2023-03-17 22:21                       ` Tom Tromey
2023-03-20 14:57                         ` Simon Marchi
2023-03-08 15:42 ` [PATCH 3/5] Constify linetables Tom Tromey
2023-03-08 15:42 ` [PATCH 4/5] Remove extra scopes from objfile_relocate1 Tom Tromey
2023-03-08 15:42 ` [PATCH 5/5] Change linetable_entry::is_stmt to bool Tom Tromey
2023-03-11  3:51 ` [PATCH 0/5] Make line tables independent of objfile Simon Marchi

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=f7445f02-258b-6635-ed79-b604b7c2e39d@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).