This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Create a displaced_step_closure class hierarchy
- From: Simon Marchi <simon dot marchi at polymtl dot ca>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Sat, 21 Oct 2017 11:51:50 -0400
- Subject: Re: [PATCH] Create a displaced_step_closure class hierarchy
- Authentication-results: sourceware.org; auth=none
- References: <1507905290-9405-1-git-send-email-simon.marchi@ericsson.com>
On 2017-10-13 10:34 AM, Simon Marchi wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> displaced_step_closure is a type defined in multiple -tdep.c files.
> Trying to xfree it from the common code (infrun.c) is a problem when we
> try to poison xfree for non-POD types. Because there can be multiple of
> these types in the same build, this patch makes a hierarchy of classes
> with a virtual destructor. When the common code deletes the object
> through a displaced_step_closure pointer, it will invoke the right
> destructor.
>
> The amd64 used a last-member array with a variable size. That doesn't
> work with new, so I changed it for an std::vector. Other architectures
> which used a simple byte buffer as a closure now use a shared
> buf_displaced_step_closure, a closure type that only contains a
> gdb::byte_vector.
>
> Reg-tested on the buildbot.
I pushed this in.
Simon