aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2017-06-10 00:24:05 +0200
committerSimon Marchi <simon.marchi@ericsson.com>2017-06-10 00:24:50 +0200
commit6d45d4b42b5b360c0b80259e101c01d650d0be23 (patch)
tree5cb8bbfb7fcc2b47f9b0749bc16b4cd8362bfab4 /gdb
parent9845682bda4149b5b3648f2d49a041aef5bc1af5 (diff)
downloadgdb-6d45d4b42b5b360c0b80259e101c01d650d0be23.zip
gdb-6d45d4b42b5b360c0b80259e101c01d650d0be23.tar.gz
gdb-6d45d4b42b5b360c0b80259e101c01d650d0be23.tar.bz2
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/aarch64-linux-tdep.c2
-rw-r--r--gdb/amd64-linux-tdep.c2
-rw-r--r--gdb/arch-utils.c8
-rw-r--r--gdb/arch-utils.h7
-rw-r--r--gdb/arm-linux-tdep.c2
-rw-r--r--gdb/gdbarch.c24
-rw-r--r--gdb/gdbarch.h15
-rwxr-xr-xgdb/gdbarch.sh12
-rw-r--r--gdb/i386-linux-tdep.c2
-rw-r--r--gdb/infrun.c8
-rw-r--r--gdb/rs6000-aix-tdep.c1
-rw-r--r--gdb/rs6000-tdep.c2
-rw-r--r--gdb/s390-linux-tdep.c2
14 files changed, 19 insertions, 85 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5ebc7f8..c48fb92 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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] !=
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index b94ccb2..d2ca70a 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -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);
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 0e2f285..4ef0f78 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -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);
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index c011b0f..2ae3413 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -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)
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 040afca..2aa9159 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -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 *,
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 094ed72..95c5260 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -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. */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 257c39f..e5efdfb 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -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. */
@@ -912,9 +908,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *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));
fprintf_unfiltered (file,
@@ -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)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 15a8141..ab7561f 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -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
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 7992cbe..22f5715 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -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
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 1909d61..d381e41 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -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);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d0504de..5e4cd51 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 6cbfdbe..e9b3f10 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -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);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 57faa67..97a975e 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -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);
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 6d68260..8840c2f 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -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);