/* Tracing functionality for remote targets in custom GDB protocol
- Copyright (C) 1997-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-2014 Free Software Foundation, Inc.
This file is part of GDB.
#include "gdbcmd.h"
#include "value.h"
#include "target.h"
+#include "target-dcache.h"
#include "language.h"
-#include "gdb_string.h"
+#include <string.h>
#include "inferior.h"
#include "breakpoint.h"
#include "tracepoint.h"
/* readline defines this. */
#undef savestring
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
/* Tracepoint for last traceframe collected. */
static int tracepoint_number;
-/* Symbol for function for last traceframe collected. */
-static struct symbol *traceframe_fun;
-
-/* Symtab and line for last traceframe collected. */
-static struct symtab_and_line traceframe_sal;
-
/* The traceframe info of the current traceframe. NULL if we haven't
yet attempted to fetch it, or if the target does not support
fetching this object, or if we're not inspecting a traceframe
set_traceframe_context (struct frame_info *trace_frame)
{
CORE_ADDR trace_pc;
+ struct symbol *traceframe_fun;
+ struct symtab_and_line traceframe_sal;
/* Save as globals for internal use. */
if (trace_frame != NULL
else
print_what = SRC_AND_LOC;
- print_stack_frame (get_selected_frame (NULL), 1, print_what);
+ print_stack_frame (get_selected_frame (NULL), 1, print_what, 1);
do_displays ();
}
}
tracepoint_number, traceframe_number);
old_chain = make_cleanup (null_cleanup, NULL);
+
+ /* This command only makes sense for the current frame, not the
+ selected frame. */
+ make_cleanup_restore_current_thread ();
+ select_frame (get_current_frame ());
+
actions = all_tracepoint_actions_and_cleanup (loc->owner);
trace_dump_actions (actions, 0, stepping_frame, from_tty);
writer->fp = gdb_fopen_cloexec (writer->pathname, "wb");
if (writer->fp == NULL)
error (_("Unable to open file '%s' for saving trace data (%s)"),
- filename, safe_strerror (errno));
+ writer->pathname, safe_strerror (errno));
}
/* This is the implementation of trace_file_write_ops method
}
if (ex.reason < 0)
{
- /* Pop the partially set up target. */
- pop_target ();
+ /* Remove the partially set up target. */
+ unpush_target (&tfile_ops);
throw_exception (ex);
}