gdbarch: Remove displaced_step_free_closure
The displaced_step_free_closure gdbarch hook allows architectures to free data they might have allocated to complete a displaced step. However, all architectures using that hook use the simple_displaced_step_free_closure provided in arch-utils.{c,h}, which does a simple xfree. We can remove it and do an xfree directly instead of calling the hook. gdb/ChangeLog: * gdbarch.sh (displaced_step_free_closure): Remove. * gdbarch.h, gdbarch.c: Re-generate. * aarch64-linux-tdep.c (aarch64_linux_init_abi): Don't set displaced_step_free_closure. * amd64-linux-tdep.c (amd64_linux_init_abi_common): Likewise. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * arch-utils.h (simple_displaced_step_free_closure): Remove. * arch-utils.c (simple_displaced_step_free_closure): Remove. * infrun.c (displaced_step_clear): Call xfree instead of gdbarch_displaced_step_free_closure.
This commit is contained in:
parent
9845682bda
commit
6d45d4b42b
@ -1,3 +1,20 @@
|
||||
2017-06-10 Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
* gdbarch.sh (displaced_step_free_closure): Remove.
|
||||
* gdbarch.h, gdbarch.c: Re-generate.
|
||||
* aarch64-linux-tdep.c (aarch64_linux_init_abi): Don't set
|
||||
displaced_step_free_closure.
|
||||
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Likewise.
|
||||
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
|
||||
* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
|
||||
* rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise.
|
||||
* rs6000-tdep.c (rs6000_gdbarch_init): Likewise.
|
||||
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
|
||||
* arch-utils.h (simple_displaced_step_free_closure): Remove.
|
||||
* arch-utils.c (simple_displaced_step_free_closure): Remove.
|
||||
* infrun.c (displaced_step_clear): Call xfree instead of
|
||||
gdbarch_displaced_step_free_closure.
|
||||
|
||||
2017-06-08 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
|
||||
* common/common-utils.c (stringify_argv): Check for "arg[0] !=
|
||||
|
@ -1204,8 +1204,6 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_displaced_step_copy_insn (gdbarch,
|
||||
aarch64_displaced_step_copy_insn);
|
||||
set_gdbarch_displaced_step_fixup (gdbarch, aarch64_displaced_step_fixup);
|
||||
set_gdbarch_displaced_step_free_closure (gdbarch,
|
||||
simple_displaced_step_free_closure);
|
||||
set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
|
||||
set_gdbarch_displaced_step_hw_singlestep (gdbarch,
|
||||
aarch64_displaced_step_hw_singlestep);
|
||||
|
@ -1848,8 +1848,6 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_displaced_step_copy_insn (gdbarch,
|
||||
amd64_displaced_step_copy_insn);
|
||||
set_gdbarch_displaced_step_fixup (gdbarch, amd64_displaced_step_fixup);
|
||||
set_gdbarch_displaced_step_free_closure (gdbarch,
|
||||
simple_displaced_step_free_closure);
|
||||
set_gdbarch_displaced_step_location (gdbarch,
|
||||
linux_displaced_step_location);
|
||||
|
||||
|
@ -60,14 +60,6 @@ simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
|
||||
return (struct displaced_step_closure *) buf;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
simple_displaced_step_free_closure (struct gdbarch *gdbarch,
|
||||
struct displaced_step_closure *closure)
|
||||
{
|
||||
xfree (closure);
|
||||
}
|
||||
|
||||
int
|
||||
default_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
|
||||
struct displaced_step_closure *closure)
|
||||
|
@ -85,13 +85,6 @@ extern struct displaced_step_closure *
|
||||
CORE_ADDR from, CORE_ADDR to,
|
||||
struct regcache *regs);
|
||||
|
||||
/* Simple implementation of gdbarch_displaced_step_free_closure: Call
|
||||
xfree.
|
||||
This is appropriate for use with simple_displaced_step_copy_insn. */
|
||||
extern void
|
||||
simple_displaced_step_free_closure (struct gdbarch *gdbarch,
|
||||
struct displaced_step_closure *closure);
|
||||
|
||||
/* Default implementation of gdbarch_displaced_hw_singlestep. */
|
||||
extern int
|
||||
default_displaced_step_hw_singlestep (struct gdbarch *,
|
||||
|
@ -1812,8 +1812,6 @@ arm_linux_init_abi (struct gdbarch_info info,
|
||||
set_gdbarch_displaced_step_copy_insn (gdbarch,
|
||||
arm_linux_displaced_step_copy_insn);
|
||||
set_gdbarch_displaced_step_fixup (gdbarch, arm_displaced_step_fixup);
|
||||
set_gdbarch_displaced_step_free_closure (gdbarch,
|
||||
simple_displaced_step_free_closure);
|
||||
set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
|
||||
|
||||
/* Reversible debugging, process record. */
|
||||
|
@ -295,7 +295,6 @@ struct gdbarch
|
||||
gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn;
|
||||
gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep;
|
||||
gdbarch_displaced_step_fixup_ftype *displaced_step_fixup;
|
||||
gdbarch_displaced_step_free_closure_ftype *displaced_step_free_closure;
|
||||
gdbarch_displaced_step_location_ftype *displaced_step_location;
|
||||
gdbarch_relocate_instruction_ftype *relocate_instruction;
|
||||
gdbarch_overlay_update_ftype *overlay_update;
|
||||
@ -443,7 +442,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
|
||||
gdbarch->skip_permanent_breakpoint = default_skip_permanent_breakpoint;
|
||||
gdbarch->displaced_step_hw_singlestep = default_displaced_step_hw_singlestep;
|
||||
gdbarch->displaced_step_fixup = NULL;
|
||||
gdbarch->displaced_step_free_closure = NULL;
|
||||
gdbarch->displaced_step_location = NULL;
|
||||
gdbarch->relocate_instruction = NULL;
|
||||
gdbarch->has_shared_address_space = default_has_shared_address_space;
|
||||
@ -656,8 +654,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
|
||||
/* Skip verify of displaced_step_copy_insn, has predicate. */
|
||||
/* Skip verify of displaced_step_hw_singlestep, invalid_p == 0 */
|
||||
/* Skip verify of displaced_step_fixup, has predicate. */
|
||||
if ((! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn))
|
||||
log.puts ("\n\tdisplaced_step_free_closure");
|
||||
if ((! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn))
|
||||
log.puts ("\n\tdisplaced_step_location");
|
||||
/* Skip verify of relocate_instruction, has predicate. */
|
||||
@ -911,9 +907,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: displaced_step_fixup = <%s>\n",
|
||||
host_address_to_string (gdbarch->displaced_step_fixup));
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: displaced_step_free_closure = <%s>\n",
|
||||
host_address_to_string (gdbarch->displaced_step_free_closure));
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: displaced_step_hw_singlestep = <%s>\n",
|
||||
host_address_to_string (gdbarch->displaced_step_hw_singlestep));
|
||||
@ -3970,23 +3963,6 @@ set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch,
|
||||
gdbarch->displaced_step_fixup = displaced_step_fixup;
|
||||
}
|
||||
|
||||
void
|
||||
gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, struct displaced_step_closure *closure)
|
||||
{
|
||||
gdb_assert (gdbarch != NULL);
|
||||
gdb_assert (gdbarch->displaced_step_free_closure != NULL);
|
||||
if (gdbarch_debug >= 2)
|
||||
fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_free_closure called\n");
|
||||
gdbarch->displaced_step_free_closure (gdbarch, closure);
|
||||
}
|
||||
|
||||
void
|
||||
set_gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch,
|
||||
gdbarch_displaced_step_free_closure_ftype displaced_step_free_closure)
|
||||
{
|
||||
gdbarch->displaced_step_free_closure = displaced_step_free_closure;
|
||||
}
|
||||
|
||||
CORE_ADDR
|
||||
gdbarch_displaced_step_location (struct gdbarch *gdbarch)
|
||||
{
|
||||
|
@ -1039,21 +1039,6 @@ typedef void (gdbarch_displaced_step_fixup_ftype) (struct gdbarch *gdbarch, stru
|
||||
extern void gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
|
||||
extern void set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, gdbarch_displaced_step_fixup_ftype *displaced_step_fixup);
|
||||
|
||||
/* Free a closure returned by gdbarch_displaced_step_copy_insn.
|
||||
|
||||
If you provide gdbarch_displaced_step_copy_insn, you must provide
|
||||
this function as well.
|
||||
|
||||
If your architecture uses closures that don't need to be freed, then
|
||||
you can use simple_displaced_step_free_closure here.
|
||||
|
||||
For a general explanation of displaced stepping and how GDB uses it,
|
||||
see the comments in infrun.c. */
|
||||
|
||||
typedef void (gdbarch_displaced_step_free_closure_ftype) (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
|
||||
extern void gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
|
||||
extern void set_gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, gdbarch_displaced_step_free_closure_ftype *displaced_step_free_closure);
|
||||
|
||||
/* Return the address of an appropriate place to put displaced
|
||||
instructions while we step over them. There need only be one such
|
||||
place, since we're only stepping one thread over a breakpoint at a
|
||||
|
@ -833,18 +833,6 @@ m;int;displaced_step_hw_singlestep;struct displaced_step_closure *closure;closur
|
||||
# see the comments in infrun.c.
|
||||
M;void;displaced_step_fixup;struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs;closure, from, to, regs;;NULL
|
||||
|
||||
# Free a closure returned by gdbarch_displaced_step_copy_insn.
|
||||
#
|
||||
# If you provide gdbarch_displaced_step_copy_insn, you must provide
|
||||
# this function as well.
|
||||
#
|
||||
# If your architecture uses closures that don't need to be freed, then
|
||||
# you can use simple_displaced_step_free_closure here.
|
||||
#
|
||||
# For a general explanation of displaced stepping and how GDB uses it,
|
||||
# see the comments in infrun.c.
|
||||
m;void;displaced_step_free_closure;struct displaced_step_closure *closure;closure;;NULL;;(! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn)
|
||||
|
||||
# Return the address of an appropriate place to put displaced
|
||||
# instructions while we step over them. There need only be one such
|
||||
# place, since we're only stepping one thread over a breakpoint at a
|
||||
|
@ -1059,8 +1059,6 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_displaced_step_copy_insn (gdbarch,
|
||||
i386_linux_displaced_step_copy_insn);
|
||||
set_gdbarch_displaced_step_fixup (gdbarch, i386_displaced_step_fixup);
|
||||
set_gdbarch_displaced_step_free_closure (gdbarch,
|
||||
simple_displaced_step_free_closure);
|
||||
set_gdbarch_displaced_step_location (gdbarch,
|
||||
linux_displaced_step_location);
|
||||
|
||||
|
@ -1710,12 +1710,8 @@ displaced_step_clear (struct displaced_step_inferior_state *displaced)
|
||||
/* Indicate that there is no cleanup pending. */
|
||||
displaced->step_ptid = null_ptid;
|
||||
|
||||
if (displaced->step_closure)
|
||||
{
|
||||
gdbarch_displaced_step_free_closure (displaced->step_gdbarch,
|
||||
displaced->step_closure);
|
||||
displaced->step_closure = NULL;
|
||||
}
|
||||
xfree (displaced->step_closure);
|
||||
displaced->step_closure = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1048,7 +1048,6 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
software single-stepping. */
|
||||
set_gdbarch_displaced_step_copy_insn (gdbarch, NULL);
|
||||
set_gdbarch_displaced_step_fixup (gdbarch, NULL);
|
||||
set_gdbarch_displaced_step_free_closure (gdbarch, NULL);
|
||||
set_gdbarch_displaced_step_location (gdbarch, NULL);
|
||||
|
||||
set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call);
|
||||
|
@ -6522,8 +6522,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
set_gdbarch_displaced_step_hw_singlestep (gdbarch,
|
||||
ppc_displaced_step_hw_singlestep);
|
||||
set_gdbarch_displaced_step_fixup (gdbarch, ppc_displaced_step_fixup);
|
||||
set_gdbarch_displaced_step_free_closure (gdbarch,
|
||||
simple_displaced_step_free_closure);
|
||||
set_gdbarch_displaced_step_location (gdbarch,
|
||||
displaced_step_at_entry_point);
|
||||
|
||||
|
@ -8005,8 +8005,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
set_gdbarch_displaced_step_copy_insn (gdbarch,
|
||||
s390_displaced_step_copy_insn);
|
||||
set_gdbarch_displaced_step_fixup (gdbarch, s390_displaced_step_fixup);
|
||||
set_gdbarch_displaced_step_free_closure (gdbarch,
|
||||
simple_displaced_step_free_closure);
|
||||
set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
|
||||
set_gdbarch_max_insn_length (gdbarch, S390_MAX_INSTR_SIZE);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user