aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-delegates.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2014-05-20 15:22:53 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2014-06-25 09:57:16 +0200
commit5fff78c4e0d938bb4fc1375792ffae02a134943c (patch)
tree21331de5e48cb6494002c76afa174a00051ea1ed /gdb/target-delegates.c
parent1d1f1ccb331f1fe9825c3bb6f6231a3aeb560d6f (diff)
downloadgdb-5fff78c4e0d938bb4fc1375792ffae02a134943c.zip
gdb-5fff78c4e0d938bb4fc1375792ffae02a134943c.tar.gz
gdb-5fff78c4e0d938bb4fc1375792ffae02a134943c.tar.bz2
gcore, target: allow target to prepare/cleanup for/after core file generation
Add new target functions to_prepare_to_generate_core and to_done_generating_core that are called before and after generating a core file, respectively. This allows targets to prepare for core file generation and to clean up afterwards. gdb/ * target.h (target_ops) <to_prepare_to_generate_core> <to_done_generating_core>: New. (target_prepare_to_generate_core, target_done_generating_core): New. * target.c (target_prepare_to_generate_core) (target_done_generating_core): New. * target-delegates.c: Regenerate. * gcore.c: (write_gcore_file): Rename to ... (write_gcore_file_1): ...this. (write_gcore_file): Call target_prepare_to_generate_core and target_done_generating_core.
Diffstat (limited to 'gdb/target-delegates.c')
-rw-r--r--gdb/target-delegates.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 4eefae8..eaab916 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -1625,6 +1625,30 @@ delegate_decr_pc_after_break (struct target_ops *self, struct gdbarch *arg1)
}
static void
+delegate_prepare_to_generate_core (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_prepare_to_generate_core (self);
+}
+
+static void
+tdefault_prepare_to_generate_core (struct target_ops *self)
+{
+}
+
+static void
+delegate_done_generating_core (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_done_generating_core (self);
+}
+
+static void
+tdefault_done_generating_core (struct target_ops *self)
+{
+}
+
+static void
install_delegators (struct target_ops *ops)
{
if (ops->to_post_attach == NULL)
@@ -1897,6 +1921,10 @@ install_delegators (struct target_ops *ops)
ops->to_get_tailcall_unwinder = delegate_get_tailcall_unwinder;
if (ops->to_decr_pc_after_break == NULL)
ops->to_decr_pc_after_break = delegate_decr_pc_after_break;
+ if (ops->to_prepare_to_generate_core == NULL)
+ ops->to_prepare_to_generate_core = delegate_prepare_to_generate_core;
+ if (ops->to_done_generating_core == NULL)
+ ops->to_done_generating_core = delegate_done_generating_core;
}
static void
@@ -2037,4 +2065,6 @@ install_dummy_methods (struct target_ops *ops)
ops->to_get_unwinder = tdefault_get_unwinder;
ops->to_get_tailcall_unwinder = tdefault_get_tailcall_unwinder;
ops->to_decr_pc_after_break = default_target_decr_pc_after_break;
+ ops->to_prepare_to_generate_core = tdefault_prepare_to_generate_core;
+ ops->to_done_generating_core = tdefault_done_generating_core;
}