From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: Re: [RFA 1/2] Make line tables independent of progspace
Date: Sat, 24 Mar 2018 03:40:00 -0000 [thread overview]
Message-ID: <e5b4de97-2720-56b9-5d0b-9f6e9bd22a9e@simark.ca> (raw)
In-Reply-To: <20180321171809.13115-2-tom@tromey.com>
Hi Tom,
I haven't looked at in details, but I just have one comment for now:
On 2018-03-21 01:18 PM, Tom Tromey wrote:
> diff --git a/gdb/symtab.h b/gdb/symtab.h
> index f9d52e7697..2b3d8018a7 100644
> --- a/gdb/symtab.h
> +++ b/gdb/symtab.h
> @@ -1228,9 +1228,23 @@ struct rust_vtable_symbol : public symbol
> struct linetable_entry
> {
> int line;
> - CORE_ADDR pc;
> +
> + /* Note that the PC as stored is unrelocated. The appropriate
> + offset must be applied before it can be used. */
> + CORE_ADDR m_pc;
> };
>
> +#define SET_LINETABLE_ENTRY_ADDRESS(ENTRY, PC) \
> + ((ENTRY).m_pc = (PC))
> +#define LINETABLE_ENTRY_RAW_ADDRESS(ENTRY) \
> + ((ENTRY).m_pc + 0)
> +#define LINETABLE_ENTRY_ADDRESS(SYMTAB, ENTRY) \
> + gdbarch_addr_bits_remove \
> + (get_objfile_arch (SYMTAB_OBJFILE (SYMTAB)), \
> + ((ENTRY).m_pc \
> + + ANOFFSET (SYMTAB_OBJFILE (SYMTAB)->section_offsets, \
> + SYMTAB_COMPUNIT (SYMTAB)->block_line_section)))
Is it possible to make these functions instead of macros? They could even be
made into methods of struct linetable_entry without making the structure
non-pod. I think it would also make the code more readable:
LINETABLE_ENTRY_RAW_ADDRESS (e)
SET_LINETABLE_ENTRY_ADDRESS (e, pc);
LINETABLE_ENTRY_ADDRESS (s, e)
vs
e.raw_address ()
e.set_address (pc)
e.address (s)
I think it makes a good difference in terms of readability in those big ifs:
if (LINETABLE_ENTRY_ADDRESS (iter_s, *item) > pc
&& (!alt || (LINETABLE_ENTRY_ADDRESS (iter_s, *item)
< LINETABLE_ENTRY_ADDRESS (alt_symtab, *alt))))
Simon
next prev parent reply other threads:[~2018-03-24 3:40 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 [this message]
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
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=e5b4de97-2720-56b9-5d0b-9f6e9bd22a9e@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
--cc=tromey@redhat.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