mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-10 09:59:06 +08:00
Fix PR16508
This patch fixes PR16508, which is about MI "-trace-find frame-number 0" behaves differently from CLI "tfind 0". In CLI, we check both status->running and status->filename, but in MI, we only check status->running, which looks wrong to me. This patch moves the code of checking to a new function check_trace_running, and use it in both CLI and MI. This patch also adds a test case pr16508.exp, which fails without this fix, and passes with the fix applied. FAIL: gdb.trace/pr16508.exp: interpreter-exec mi "-trace-find frame-number 0" gdb: 2014-03-06 Yao Qi <yao@codesourcery.com> PR breakpoints/16508 * tracepoint.c (check_trace_running): New function. (trace_find_command): Move code to check_trace_running and call check_trace_running. (trace_find_pc_command): Likewise. (trace_find_tracepoint_command): Likewise. (trace_find_line_command): Likewise. (trace_find_range_command): Likewise. * tracepoint.h (check_trace_running): Likewise. * mi/mi-main.c (mi_cmd_trace_find): Call check_trace_running. gdb/testsuite: 2014-03-06 Yao Qi <yao@codesourcery.com> * gdb.trace/pr16508.exp: New file.
This commit is contained in:
@ -2443,6 +2443,15 @@ tfind_1 (enum trace_find_type type, int num,
|
||||
}
|
||||
}
|
||||
|
||||
/* 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
|
||||
@ -2463,9 +2472,7 @@ trace_find_command (char *args, int from_tty)
|
||||
{ /* 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. */
|
||||
@ -2515,9 +2522,7 @@ trace_find_pc_command (char *args, int from_tty)
|
||||
{
|
||||
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 ());
|
||||
@ -2534,9 +2539,7 @@ trace_find_tracepoint_command (char *args, int from_tty)
|
||||
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)
|
||||
{
|
||||
@ -2574,9 +2577,7 @@ trace_find_line_command (char *args, int from_tty)
|
||||
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)
|
||||
{
|
||||
@ -2640,9 +2641,7 @@ trace_find_range_command (char *args, int from_tty)
|
||||
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? */
|
||||
|
Reference in New Issue
Block a user