/* Tracing functionality for remote targets in custom GDB protocol
- Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "target.h"
#include "target-dcache.h"
#include "language.h"
-#include <string.h>
#include "inferior.h"
#include "breakpoint.h"
#include "tracepoint.h"
#include "ax.h"
#include "ax-gdb.h"
#include "memrange.h"
-#include "exceptions.h"
#include "cli/cli-utils.h"
#include "probe.h"
#include "ctf.h"
struct tracepoint *t;
struct command_line *l;
- t = get_tracepoint_by_number (&args, NULL, 1);
+ t = get_tracepoint_by_number (&args, NULL);
if (t)
{
char *tmpbuf =
long frame_regno, long frame_offset, int type,
int trace_string)
{
- struct block *block;
+ const struct block *block;
struct add_local_symbols_data cb_data;
cb_data.collect = collect;
t->number_on_target = b->number;
for (loc = b->loc; loc; loc = loc->next)
- if (loc->probe != NULL)
- loc->probe->pops->set_semaphore (loc->probe, loc->gdbarch);
+ if (loc->probe.probe != NULL
+ && loc->probe.probe->pops->set_semaphore != NULL)
+ loc->probe.probe->pops->set_semaphore (loc->probe.probe,
+ loc->probe.objfile,
+ loc->gdbarch);
if (bp_location_downloaded)
observer_notify_breakpoint_modified (b);
but we don't really care if this semaphore goes out of sync.
That's why we are decrementing it here, but not taking care
in other places. */
- if (loc->probe != NULL)
- loc->probe->pops->clear_semaphore (loc->probe, loc->gdbarch);
+ if (loc->probe.probe != NULL
+ && loc->probe.probe->pops->clear_semaphore != NULL)
+ loc->probe.probe->pops->clear_semaphore (loc->probe.probe,
+ loc->probe.objfile,
+ loc->gdbarch);
}
}
}
}
+/* Error on looking at traceframes while trace is running. */
+
+void
+check_trace_running (struct trace_status *status)
+{
+ if (status->running && status->filename == NULL)
+ error (_("May not look at trace frames while trace is running."));
+}
+
/* trace_find_command takes a trace frame number n,
sends "QTFrame:<n>" to the target,
and accepts a reply that may contain several optional pieces
{ /* This should only be called with a numeric argument. */
int frameno = -1;
- if (current_trace_status ()->running
- && current_trace_status ()->filename == NULL)
- error (_("May not look at trace frames while trace is running."));
+ check_trace_running (current_trace_status ());
if (args == 0 || *args == 0)
{ /* TFIND with no args means find NEXT trace frame. */
{
CORE_ADDR pc;
- if (current_trace_status ()->running
- && current_trace_status ()->filename == NULL)
- error (_("May not look at trace frames while trace is running."));
+ check_trace_running (current_trace_status ());
if (args == 0 || *args == 0)
pc = regcache_read_pc (get_current_regcache ());
int tdp;
struct tracepoint *tp;
- if (current_trace_status ()->running
- && current_trace_status ()->filename == NULL)
- error (_("May not look at trace frames while trace is running."));
+ check_trace_running (current_trace_status ());
if (args == 0 || *args == 0)
{
struct symtab_and_line sal;
struct cleanup *old_chain;
- if (current_trace_status ()->running
- && current_trace_status ()->filename == NULL)
- error (_("May not look at trace frames while trace is running."));
+ check_trace_running (current_trace_status ());
if (args == 0 || *args == 0)
{
static CORE_ADDR start, stop;
char *tmp;
- if (current_trace_status ()->running
- && current_trace_status ()->filename == NULL)
- error (_("May not look at trace frames while trace is running."));
+ check_trace_running (current_trace_status ());
if (args == 0 || *args == 0)
{ /* XXX FIXME: what should default behavior be? */
struct symtabs_and_lines sals;
struct symbol *sym;
struct bound_minimal_symbol msym;
- struct block *block;
+ const struct block *block;
const char *symname;
char *save_args = args;
struct block_iterator iter;
if (symname == NULL || *symname == '\0')
continue; /* Probably botched, certainly useless. */
- gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile);
+ gdbarch = symbol_arch (sym);
printf_filtered ("Symbol %s is ", symname);
printf_filtered ("static storage at address ");
printf_filtered ("%s",
paddress (gdbarch,
- MSYMBOL_VALUE_ADDRESS (msym.minsym)));
+ BMSYMBOL_VALUE_ADDRESS (msym)));
}
break;
case LOC_OPTIMIZED_OUT:
clear_traceframe_info ();
}
-/* Make the traceframe NUM be the current trace frame, and do nothing
- more. */
-
-void
-set_traceframe_number (int num)
-{
- traceframe_number = num;
-}
-
/* A cleanup used when switching away and back from tfind mode. */
struct current_traceframe_cleanup
restore_current_traceframe_cleanup_dtor);
}
-struct cleanup *
-make_cleanup_restore_traceframe_number (void)
-{
- return make_cleanup_restore_integer (&traceframe_number);
-}
-
/* Given a number and address, return an uploaded tracepoint with that
number, creating if necessary. */
end = hex2bin (p, (gdb_byte *) buf, strlen (p) / 2);
buf[end] = '\0';
- if (strncmp (srctype, "at:", strlen ("at:")) == 0)
+ if (startswith (srctype, "at:"))
utp->at_string = xstrdup (buf);
- else if (strncmp (srctype, "cond:", strlen ("cond:")) == 0)
+ else if (startswith (srctype, "cond:"))
utp->cond_string = xstrdup (buf);
- else if (strncmp (srctype, "cmd:", strlen ("cmd:")) == 0)
+ else if (startswith (srctype, "cmd:"))
VEC_safe_push (char_ptr, utp->cmd_strings, xstrdup (buf));
}
else if (piece == 'V')