public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Tom Tromey <tom@tromey.com>, <gdb-patches@sourceware.org>
Subject: Re: [RFA 2/6] Allocate abbrev_table with new
Date: Sun, 07 Jan 2018 16:55:00 -0000	[thread overview]
Message-ID: <67e2a403-b51f-8ac3-2bae-0973a2e22ee4@ericsson.com> (raw)
In-Reply-To: <b735c70f-8170-2ad1-ebef-04678c3a066c@ericsson.com>

On 2018-01-07 12:28 AM, Simon Marchi wrote:
> On 2018-01-05 07:26 PM, Tom Tromey wrote:
>> This changes dwarf2read.c to allocate abbrev tables using "new", and
>> then updates the users.
>>
>> This is somewhat complicated because ownership rules for abbrev tables
>> are obscure and involve a more than usual amount of cleanup
>> manipulation.
> 
> Hi Tom,
> 
> After staring at this code for longer than I had planned, I came to the
> conclusion that it would be much simpler if dwarf2_cu did not contain a
> pointer to the abbrev_table.  In fact, I think that dwarf2_cu::abbrev_table
> is actually a disguised function parameter that should be passed alongside
> the cu, not in it.
> 
> This is made clear by the fact that we are setting cu->abbrev_table just
> before calling the DIE-reading function, and reset it just after (with a
> cleanup).  The dwarf2_cu::abbrev_table is only useful for the duration of
> a function call, and then reset.
> 
> The dwarf2_cu structure never actually owns the abbrev_table, it's always
> some frame in the call stack that does.  But they own it indirectly via
> dwarf2_cu::abbrev_table and some cleanup that will free the table and
> reset that field (dwarf2_free_abbrev_table, or auto_free_abbrev_table with
> your patch).
> 
> The parameters for the DIE-reading operations are passed through the
> die_reader_specs structure, so I think it would make sense to put the
> reference to the abbrev_table there (this structure really exists to
> avoid having super long parameter lists).  This way, each frame that
> reads in an abbrev_table owns it through a unique_ptr and passes it to
> DIE-reading functions through parameter (through die_reader_specs).  That
> seems more straightforward.
> 
> Here's a patch that applies over this one, that illustrates the idea.  Let
> me know what you think.
> 
> Simon

Hi Tom,

I just pushed some dwarf2read cleanup patches I had posted a while ago, that
I wanted to push after the 8.1 branch creation.  It impacts this series a little
bit, so I thought I would help you rebase it.  Here's your original series rebased
on master:

https://github.com/simark/binutils-gdb/tree/tromey/dwarf

and here's your series plus my suggestion, rebased on master:

https://github.com/simark/binutils-gdb/tree/tromey/dwarf-plus-suggestion

Simon

  reply	other threads:[~2018-01-07 16:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-06  0:26 [RFA 0/6] Some DWARF reader polishing Tom Tromey
2018-01-06  0:26 ` [RFA 4/6] Change dwarf2_cu::method_info to be a std::vector Tom Tromey
2018-01-16 15:30   ` Simon Marchi
2018-01-17 17:15     ` Tom Tromey
2018-01-17 17:29       ` Simon Marchi
2018-01-06  0:26 ` [RFA 2/6] Allocate abbrev_table with new Tom Tromey
2018-01-07  5:29   ` Simon Marchi
2018-01-07 16:55     ` Simon Marchi [this message]
2018-01-09 18:56       ` Tom Tromey
2018-01-10 12:02         ` Yao Qi
2018-01-10 16:10           ` Tom Tromey
2018-01-10 12:45         ` Simon Marchi
2018-01-06  0:26 ` [RFA 6/6] Remove symbolp typedef Tom Tromey
2018-01-16 15:33   ` Simon Marchi
2018-01-06  0:26 ` [RFA 5/6] Remove objfile argument from add_dyn_prop Tom Tromey
2018-01-10 13:01   ` Yao Qi
2018-01-10 16:32     ` Tom Tromey
2018-01-16 16:00       ` Yao Qi
2018-01-16 15:33   ` Simon Marchi
2018-01-17 17:16     ` Tom Tromey
2018-01-06  0:26 ` [RFA 3/6] Allocate dwarf2_cu with new Tom Tromey
2018-01-10 12:17   ` Yao Qi
2018-01-10 16:14     ` Tom Tromey
2018-01-10 16:28       ` Tom Tromey
2018-01-16 15:04         ` Simon Marchi
2018-01-17 17:10           ` Tom Tromey
2018-01-06  0:26 ` [RFA 1/6] Unify new_symbol and new_symbol_full Tom Tromey
2018-01-07  5:33   ` 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=67e2a403-b51f-8ac3-2bae-0973a2e22ee4@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --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).