* breakpoint.c (break_command_really): Change return type to int.

Return false if no breakpoint was created, true otherwise.
	(trace_command): Don't set the tracepoint count if no tracepoint
	was created.
	(ftrace_command): Ditto.
	(create_tracepoint_from_upload): Bail out if the tracepoint wasn't
	created in the breakpoints table.
This commit is contained in:
Pedro Alves
2010-02-12 00:47:53 +00:00
parent 28ed0eccaa
commit fd9b8c249a
2 changed files with 61 additions and 47 deletions

View File

@@ -1,3 +1,13 @@
2010-02-12 Pedro Alves <pedro@codesourcery.com>
* breakpoint.c (break_command_really): Change return type to int.
Return false if no breakpoint was created, true otherwise.
(trace_command): Don't set the tracepoint count if no tracepoint
was created.
(ftrace_command): Ditto.
(create_tracepoint_from_upload): Bail out if the tracepoint wasn't
created in the breakpoints table.
2010-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Ulrich Weigand <uweigand@de.ibm.com>

View File

@@ -6722,17 +6722,16 @@ find_condition_and_thread (char *tok, CORE_ADDR pc,
}
}
/* Set a breakpoint. This function is shared between
CLI and MI functions for setting a breakpoint.
This function has two major modes of operations,
selected by the PARSE_CONDITION_AND_THREAD parameter.
If non-zero, the function will parse arg, extracting
breakpoint location, address and thread. Otherwise,
ARG is just the location of breakpoint, with condition
and thread specified by the COND_STRING and THREAD
parameters. */
/* Set a breakpoint. This function is shared between CLI and MI
functions for setting a breakpoint. This function has two major
modes of operations, selected by the PARSE_CONDITION_AND_THREAD
parameter. If non-zero, the function will parse arg, extracting
breakpoint location, address and thread. Otherwise, ARG is just the
location of breakpoint, with condition and thread specified by the
COND_STRING and THREAD parameters. Returns true if any breakpoint
was created; false otherwise. */
static void
static int
break_command_really (struct gdbarch *gdbarch,
char *arg, char *cond_string, int thread,
int parse_condition_and_thread,
@@ -6793,7 +6792,7 @@ break_command_really (struct gdbarch *gdbarch,
selects no, then simply return the error code. */
if (pending_break_support == AUTO_BOOLEAN_AUTO
&& !nquery ("Make breakpoint pending on future shared library load? "))
return;
return 0;
/* At this point, either the user was queried about setting
a pending breakpoint and selected yes, or pending
@@ -6811,7 +6810,7 @@ break_command_really (struct gdbarch *gdbarch,
}
default:
if (!sals.nelts)
return;
return 0;
}
/* Create a chain of things that always need to be cleaned up. */
@@ -6923,6 +6922,8 @@ break_command_really (struct gdbarch *gdbarch,
/* error call may happen here - have BKPT_CHAIN already discarded. */
update_global_location_list (1);
return 1;
}
/* Set a breakpoint.
@@ -9789,33 +9790,33 @@ set_tracepoint_count (int num)
void
trace_command (char *arg, int from_tty)
{
break_command_really (get_current_arch (),
arg,
NULL, 0, 1 /* parse arg */,
0 /* tempflag */, 0 /* hardwareflag */,
1 /* traceflag */,
0 /* Ignore count */,
pending_break_support,
NULL,
from_tty,
1 /* enabled */);
set_tracepoint_count (breakpoint_count);
if (break_command_really (get_current_arch (),
arg,
NULL, 0, 1 /* parse arg */,
0 /* tempflag */, 0 /* hardwareflag */,
1 /* traceflag */,
0 /* Ignore count */,
pending_break_support,
NULL,
from_tty,
1 /* enabled */))
set_tracepoint_count (breakpoint_count);
}
void
ftrace_command (char *arg, int from_tty)
{
break_command_really (get_current_arch (),
arg,
NULL, 0, 1 /* parse arg */,
0 /* tempflag */, 1 /* hardwareflag */,
1 /* traceflag */,
0 /* Ignore count */,
pending_break_support,
NULL,
from_tty,
1 /* enabled */);
set_tracepoint_count (breakpoint_count);
if (break_command_really (get_current_arch (),
arg,
NULL, 0, 1 /* parse arg */,
0 /* tempflag */, 1 /* hardwareflag */,
1 /* traceflag */,
0 /* Ignore count */,
pending_break_support,
NULL,
from_tty,
1 /* enabled */))
set_tracepoint_count (breakpoint_count);
}
/* Given information about a tracepoint as recorded on a target (which
@@ -9829,24 +9830,27 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
{
char buf[100];
struct breakpoint *tp;
/* In the absence of a source location, fall back to raw address. */
sprintf (buf, "*%s", paddress (get_current_arch(), utp->addr));
break_command_really (get_current_arch (),
buf,
NULL, 0, 1 /* parse arg */,
0 /* tempflag */,
(utp->type == bp_fast_tracepoint) /* hardwareflag */,
1 /* traceflag */,
0 /* Ignore count */,
pending_break_support,
NULL,
0 /* from_tty */,
utp->enabled /* enabled */);
if (!break_command_really (get_current_arch (),
buf,
NULL, 0, 1 /* parse arg */,
0 /* tempflag */,
(utp->type == bp_fast_tracepoint) /* hardwareflag */,
1 /* traceflag */,
0 /* Ignore count */,
pending_break_support,
NULL,
0 /* from_tty */,
utp->enabled /* enabled */))
return NULL;
set_tracepoint_count (breakpoint_count);
tp = get_tracepoint (tracepoint_count);
tp = get_tracepoint (tracepoint_count);
gdb_assert (tp != NULL);
if (utp->pass > 0)
{