From: Simon Marchi <simon.marchi@ericsson.com>
To: Kevin Buettner <kevinb@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/8] Add block range data structure for blocks with non-contiguous address ranges
Date: Wed, 01 Aug 2018 01:36:00 -0000 [thread overview]
Message-ID: <45fb2e70-3924-b89b-0777-758c5e2715a7@ericsson.com> (raw)
In-Reply-To: <20180625234210.1dbf3a9a@pinnacle.lan>
On 2018-06-26 02:42 AM, Kevin Buettner wrote:
> This patch does the following:
>
> - Introduces a block range data structure which is accessed via
> a new field in struct block.
> - Defines several macros for accessing block ranges.
> - Defines a new function, make_blockrange, which is responsible for
> creating the new data structure.
> - Defines a predicate (function) which checks to see if an address
> is present in a block.
>
> It should be noted that some support for non-contiguous ranges already
> existed in GDB in the form of blockvector addrmaps. This support
> allowed GDB to quickly find a block containing a particular address
> even when the block consists of non-contiguous addresses. See
> find_block_in_blockvector() in block.c, dwarf2_record_block_ranges()
> in dwarf2read.c, and record_block_range() in buildsym.c.
>
> Addrmaps do not provide a convenient way to examine address ranges
> associated with a particular block. This data structure (and its
> interface) is set up for quickly finding the value (which in this case
> is a block) associated with a particular address. The interface
> does not include a method for doing a reverse mapping from blocks to
> addresses. A linear time mapping might be attempted via use of the
> addrmap's foreach method, but this is not as straightforward as it
> might first appear due to the fact that blocks corresponding to inline
> function instances and lexical blocks w/ variables end up getting
> interspersed in in the set of transitions.
>
> Note: If this approach is deemed to be too expensive in terms of
> space, an alternate approach might be to attempt the linear time
> mapping noted above. find_pc_partial_function() needs to be able to
> quickly know whether there are discontiguous ranges (for determining
> cache validity), so a flag for this property would have to be added to
> struct block. Also integral to this set of changes is the concept of
> an "entry pc" which might be different than the block's start address.
> An entry_pc field would also need to be added to struct block. This
> does not result in any space savings in struct block though since the
> space for the flag and entry_pc use more space than the blockranges
> struct pointer that I've added. There would, however, be some space
> savings due to the fact that the new data structures that I've added
> for this patch would not need to be allocated. (I happen to like the
> approach I've come up with, but I wanted to mention another possibility
> just in case someone does not.)
I assume the impact won't be too big (there probably isn't a ton of ranges
per block), but some actual data would be interesting.
Just two nits below, otherwise it LGTM.
> @@ -807,3 +822,27 @@ block_find_non_opaque_type_preferred (struct symbol *sym, void *data)
> *best = sym;
> return 0;
> }
> +
> +/* See block.h. */
> +
> +struct blockranges *
> +make_blockranges (struct objfile * objfile,
Spurious space after the *.
> @@ -322,4 +401,9 @@ extern int block_find_non_opaque_type_preferred (struct symbol *sym,
> (sym) != NULL; \
> (sym) = block_iter_match_next ((name), &(iter)))
>
> +/* Given a vector of pairs, allocate and build an obstack allocated
> + blockranges struct for a block. */
> +struct blockranges *make_blockranges (struct objfile *objfile,
> + std::vector<std::pair<CORE_ADDR, CORE_ADDR>> &);
Can you please name the second parameter, and make it const?
Thanks,
Simon
next prev parent reply other threads:[~2018-08-01 1:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 6:32 [PATCH 0/8] Non-contiguous address range support Kevin Buettner
2018-06-26 6:42 ` [PATCH 1/8] Add block range data structure for blocks with non-contiguous address ranges Kevin Buettner
2018-08-01 1:36 ` Simon Marchi [this message]
2018-08-01 23:57 ` Kevin Buettner
2018-08-01 1:40 ` Simon Marchi
2018-06-26 6:44 ` [PATCH 2/8] Record explicit block ranges from dwarf2read.c Kevin Buettner
2018-08-01 1:41 ` Simon Marchi
2018-06-26 6:47 ` [PATCH 3/8] Add support for non-contiguous blocks to find_pc_partial_function Kevin Buettner
2018-07-19 18:52 ` Kevin Buettner
2018-08-01 2:01 ` Simon Marchi
2018-08-01 23:40 ` Kevin Buettner
2018-06-26 6:49 ` [PATCH 4/8] Disassemble blocks with non-contiguous ranges Kevin Buettner
2018-08-01 2:08 ` Simon Marchi
2018-06-26 6:51 ` [PATCH 5/8] Use BLOCK_ENTRY_PC in place of most uses of BLOCK_START Kevin Buettner
2018-08-01 2:22 ` Simon Marchi
2018-08-02 0:07 ` Kevin Buettner
2018-06-26 6:53 ` [PATCH 6/8] Use BLOCK_ENTRY_PC to find function entry pc in infrun.c Kevin Buettner
2018-08-01 2:28 ` Simon Marchi
2018-06-26 6:55 ` [PATCH 7/8] Relocate block range start and end addresses Kevin Buettner
2018-08-01 2:30 ` Simon Marchi
2018-06-26 6:57 ` [PATCH 8/8] Test case for functions with non-contiguous ranges Kevin Buettner
2018-08-01 2:56 ` Simon Marchi
2018-07-11 15:27 ` [PATCH 0/8] Non-contiguous address range support Kevin Buettner
2018-07-11 15:32 ` Keith Seitz
2018-07-12 19:12 ` Simon Marchi
2018-07-17 2:00 ` Kevin Buettner
2018-07-19 15:55 ` Simon Marchi
2018-07-19 19:07 ` Kevin Buettner
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=45fb2e70-3924-b89b-0777-758c5e2715a7@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@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