From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] Remove munmap_listp_free_cleanup
Date: Mon, 17 Sep 2018 01:37:00 -0000 [thread overview]
Message-ID: <04207066-48a5-b93e-540e-b6bfefb3f07b@simark.ca> (raw)
In-Reply-To: <20180915222411.24764-2-tom@tromey.com>
On 2018-09-15 6:24 p.m., Tom Tromey wrote:
> diff --git a/gdb/compile/compile-object-load.h b/gdb/compile/compile-object-load.h
> index 6f62535878a..7569c42bf5c 100644
> --- a/gdb/compile/compile-object-load.h
> +++ b/gdb/compile/compile-object-load.h
> @@ -18,8 +18,31 @@
> #define GDB_COMPILE_OBJECT_LOAD_H
>
> #include "compile-internal.h"
> +#include <list>
>
> -struct munmap_list;
> +struct munmap_list
> +{
> +public:
> +
> + munmap_list () = default;
> + ~munmap_list ();
> +
> + DISABLE_COPY_AND_ASSIGN (munmap_list);
> +
> + /* Add a region to the list. */
> + void add (CORE_ADDR addr, CORE_ADDR size);
> +
> +private:
> +
> + /* Track inferior memory reserved by inferior mmap. */
> +
> + struct munmap_item
> + {
> + CORE_ADDR addr, size;
> + };
> +
> + std::list<munmap_item> items;
Not a big deal, but we might as well use a vector. The objects are cheap to copy, so there's probably less overhead overall (memory and time) to use a vector than a doubly linked list.
I was going to say:
1. Why not use munmap_list as directly as field of setup_sections_data, instead
of a unique_ptr, and
2. std::move it to the compile_module object.
But that would require C++ifying compile_module and probably do_module_cleanup too,
and that's perhaps a too big of a step for this patch.
Simon
next prev parent reply other threads:[~2018-09-17 1:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-15 22:24 [PATCH 0/2] remove the remaining cleanups from gdb/compile Tom Tromey
2018-09-15 22:24 ` [PATCH 1/2] Remove munmap_listp_free_cleanup Tom Tromey
2018-09-17 1:37 ` Simon Marchi [this message]
2018-09-17 6:23 ` Tom Tromey
2018-09-17 10:58 ` Pedro Alves
2018-09-17 21:21 ` Tom Tromey
2018-09-18 14:19 ` Pedro Alves
2018-09-15 22:24 ` [PATCH 2/2] Remove remaining cleanups from compile-object-load.c Tom Tromey
2018-09-17 1:39 ` 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=04207066-48a5-b93e-540e-b6bfefb3f07b@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