2014-06-25 Markus Metzger <markus.t.metzger@intel.com>
+ * record-btrace.c (record_btrace_generating_corefile)
+ (record_btrace_prepare_to_generate_core)
+ (record_btrace_done_generating_core): New.
+ (record_btrace_xfer_partial, record_btrace_fetch_registers)
+ (record_btrace_store_registers, record_btrace_prepare_to_store):
+ Forward request when generating a core file.
+ (record_btrace_open): Set record_btrace_generating_corefile to zero.
+ (init_record_btrace_ops): Set to_prepare_to_generate_core and
+ to_done_generating_core.
+
+2014-06-25 Markus Metzger <markus.t.metzger@intel.com>
+
* target.h (target_ops) <to_prepare_to_generate_core>
<to_done_generating_core>: New.
(target_prepare_to_generate_core, target_done_generating_core): New.
/* The async event handler for reverse/replay execution. */
static struct async_event_handler *record_btrace_async_inferior_event_handler;
+/* A flag indicating that we are currently generating a core file. */
+static int record_btrace_generating_corefile;
+
/* Print a record-btrace debug message. Use do ... while (0) to avoid
ambiguities when used in if statements. */
record_btrace_async_inferior_event_handler
= create_async_event_handler (record_btrace_handle_async_inferior_event,
NULL);
+ record_btrace_generating_corefile = 0;
observer_notify_record_changed (current_inferior (), 1);
/* Filter out requests that don't make sense during replay. */
if (replay_memory_access == replay_memory_access_read_only
+ && !record_btrace_generating_corefile
&& record_btrace_is_replaying (ops))
{
switch (object)
gdb_assert (tp != NULL);
replay = tp->btrace.replay;
- if (replay != NULL)
+ if (replay != NULL && !record_btrace_generating_corefile)
{
const struct btrace_insn *insn;
struct gdbarch *gdbarch;
{
struct target_ops *t;
- if (record_btrace_is_replaying (ops))
+ if (!record_btrace_generating_corefile && record_btrace_is_replaying (ops))
error (_("This record target does not allow writing registers."));
gdb_assert (may_write_registers != 0);
{
struct target_ops *t;
- if (record_btrace_is_replaying (ops))
+ if (!record_btrace_generating_corefile && record_btrace_is_replaying (ops))
return;
for (t = ops->beneath; t != NULL; t = t->beneath)
return record_btrace_resume_exec_dir;
}
+/* The to_prepare_to_generate_core target method. */
+
+static void
+record_btrace_prepare_to_generate_core (struct target_ops *self)
+{
+ record_btrace_generating_corefile = 1;
+}
+
+/* The to_done_generating_core target method. */
+
+static void
+record_btrace_done_generating_core (struct target_ops *self)
+{
+ record_btrace_generating_corefile = 0;
+}
+
/* Initialize the record-btrace target ops. */
static void
ops->to_can_execute_reverse = record_btrace_can_execute_reverse;
ops->to_decr_pc_after_break = record_btrace_decr_pc_after_break;
ops->to_execution_direction = record_btrace_execution_direction;
+ ops->to_prepare_to_generate_core = record_btrace_prepare_to_generate_core;
+ ops->to_done_generating_core = record_btrace_done_generating_core;
ops->to_stratum = record_stratum;
ops->to_magic = OPS_MAGIC;
}
+2014-06-25 Markus Metzger <markus.t.metzger@intel.com>
+
+ * gdb.btrace/gcore.exp: New.
+
2014-06-23 Pedro Alves <palves@redhat.com>
* gdb.base/watchpoint-reuse-slot.c: New file.
--- /dev/null
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile x86-record_goto.S
+if [prepare_for_testing gcore.exp $testfile $srcfile] {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+# trace the call to the test function
+gdb_test_no_output "record btrace"
+gdb_test "next" ".*main\.3.*"
+
+# start replaying
+gdb_test "record goto begin" ".*main\.2.*"
+
+# generate a core file - this used to assert
+gdb_test "generate-core-file core" "Saved corefile core"