public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: "Maciej W. Rozycki" <macro@mips.com>, Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tom@tromey.com>, <gdb-patches@sourceware.org>
Subject: Re: [RFA 1/2] Make line tables independent of progspace
Date: Thu, 29 Mar 2018 15:04:00 -0000	[thread overview]
Message-ID: <4ca333ee-44da-d086-e3c2-cd65b46a46c1@ericsson.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1803281943170.2163@tp.orcam.me.uk>

On 2018-03-28 03:27 PM, Maciej W. Rozycki wrote:
>  It's not clear to me offhand what the impact on processing that involves 
> `addr_bits_remove' the change proposed will have.  So what specifically 
> would you like me to comment on here?

Err sorry I wasn't very clear.  Currently, for addresses coming from the line
table, gdbarch_addr_bits_remove is called on the relocated address in
dwarf_record_line_1, before that address is put in the line table data structure.

In Tom's patch, since we store unrelocated addresses in the line table, relocation
happens "just in time" when reading the address from the table.
gdbarch_addr_bits_remove is called at this time:

CORE_ADDR
linetable_entry::address (struct symtab *symtab) const
{
  return gdbarch_addr_bits_remove
    (get_objfile_arch (SYMTAB_OBJFILE (symtab)),
     m_pc + ANOFFSET (SYMTAB_OBJFILE (symtab)->section_offsets,
		      SYMTAB_COMPUNIT (symtab)->block_line_section));
}

I just wanted to confirm it was still fine with mips' implementation of
addr_bits_remove.  But now I realize that other arches implement this callback too,
not only mips.  I think I originally meant to ask about gdbarch_adjust_dwarf2_line,
which is only implemented by mips.

Since adjust_dwarf2_line used to be passed the relocated address, Tom included a
"hack" where he relocates the address, passes it through gdbarch_adjust_dwarf2_line,
and unrelocates it:

  /* Handle DW_LNE_set_address.  */
  void handle_set_address (CORE_ADDR baseaddr, CORE_ADDR address)
  {
    m_op_index = 0;
    /* Pass the relocated address to the gdbarch for modification, but
       then only store the relative address.  */
    address += baseaddr;
    m_address = (gdbarch_adjust_dwarf2_line (m_gdbarch, address, false)
		 - baseaddr);
  }

I think right now this is necessary, because mips_adjust_dwarf2_line does a
minimal symbol lookup, which are relocated.  So if we passed an unrelocated
address, I guess it wouldn't find the symbol.

I just wanted to make sure there wasn't anything you saw that is obviously
wrong with this approach.  I think that eventually we'll be able to pass an
unrelocated address to adjust_dwarf2_line, but in the mean time we probably
need this hack.

Simon

  reply	other threads:[~2018-03-29 15:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 17:18 [RFA 0/2] " Tom Tromey
2018-03-21 17:18 ` [RFA 1/2] " Tom Tromey
2018-03-24  3:40   ` Simon Marchi
2018-03-27  4:16     ` Tom Tromey
2018-03-27  4:53       ` Tom Tromey
2018-03-27 20:22         ` Simon Marchi
2018-03-28  4:53           ` Tom Tromey
2018-03-28 12:30             ` Simon Marchi
2018-03-28  3:34         ` Simon Marchi
2018-03-28  5:02           ` Tom Tromey
2018-03-28 12:32             ` Simon Marchi
2018-03-28 19:33           ` Maciej W. Rozycki
2018-03-29 15:04             ` Simon Marchi [this message]
2018-03-29 21:07               ` Maciej W. Rozycki
2018-04-26 21:30                 ` Tom Tromey
2018-05-03 23:17                   ` Maciej W. Rozycki
2018-05-14 23:54                     ` Maciej W. Rozycki
2018-03-21 17:18 ` [RFA 2/2] Constify the line table Tom Tromey

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=4ca333ee-44da-d086-e3c2-cd65b46a46c1@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@mips.com \
    --cc=simark@simark.ca \
    --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).