* remote.c (struct remote_state): <install_in_trace> new field.
	(PACKET_InstallInTrace): New enum value.
	(remote_install_in_trace_feature): Support InstallInTrace.
	(remote_supports_install_in_trace): Likewise.
	(remote_protocol_features): Likewise.
	(_initialize_remote): Likewise.
	(remote_can_download_tracepoint): New.
	* target.h (struct target): New field
	`to_can_download_tracepoint'.
	(target_can_download_tracepoint): New macro.
	* target.c (update_current_target): Update.
	* breakpoint.h (struct bp_location): Add comment on field
	`duplicate'.
	(should_be_inserted): Don't differentiate breakpoint and tracepoint.
	(remove_breakpoints): Don't remove tracepoints.
	(tracepoint_locations_match ): New.
	(breakpoint_locations_match): Call it.
	(disable_breakpoints_in_unloaded_shlib): Handle tracepoint.
	(download_tracepoint_locations): New.
	(update_global_location_list): Call it.
	* tracepoint.c (find_matching_tracepoint): Delete.
	(find_matching_tracepoint_location): Renamed from
	find_matching_tracepoint.  Return bp_location rather than
	tracepoint.
	(merge_uploaded_tracepoints): Set `inserted' field to 1 if
	tracepoint is found.

gdb/doc/
	* gdb.texinfo (Create and Delete Tracepoints): Describe changed
	behavior of tracepoint.
	(General Query Packets): New feature InstallInTrace.
	(Remote Configuration): Document "set remote
	install-in-trace-packet".

gdb/gdbserver/
	* server.c (handle_query): Handle InstallInTrace for qSupported.
	* tracepoint.c (add_tracepoint): Sort list.
	(install_tracepoint, download_tracepoint): New.
	(cmd_qtdp): Call them to install and download tracepoints.
	(sort_tracepoints): Removed.
	(cmd_qtstart): Update.

gdb/testsuite/
	* gdb.trace/change-loc-1.c: New.
	* gdb.trace/change-loc-2.c: New.
	* gdb.trace/change-loc.c: New.
	* gdb.trace/change-loc.exp:  New.
	* gdb.trace/change-loc.h:  New.
	* gdb.trace/trace-break.c (marker): Define new symbol.
	* gdb.trace/trace-break.exp (break_trace_same_addr_5):
        New.
	(break_trace_same_addr_6): New.
This commit is contained in:
Yao Qi 2011-11-14 15:18:54 +00:00
parent 5c73ff4ec2
commit 1e4d17643d
20 changed files with 944 additions and 93 deletions

View file

@ -1711,7 +1711,15 @@ start_tracing (void)
t->number_on_target = 0;
for (loc = b->loc; loc; loc = loc->next)
target_download_tracepoint (loc);
{
/* Since tracepoint locations are never duplicated, `inserted'
flag should be zero. */
gdb_assert (!loc->inserted);
target_download_tracepoint (loc);
loc->inserted = 1;
}
t->number_on_target = b->number;
}
@ -3203,10 +3211,10 @@ cond_string_is_same (char *str1, char *str2)
/* Look for an existing tracepoint that seems similar enough to the
uploaded one. Enablement isn't compared, because the user can
toggle that freely, and may have done so in anticipation of the
next trace run. */
next trace run. Return the location of matched tracepoint. */
struct tracepoint *
find_matching_tracepoint (struct uploaded_tp *utp)
struct bp_location *
find_matching_tracepoint_location (struct uploaded_tp *utp)
{
VEC(breakpoint_p) *tp_vec = all_tracepoints ();
int ix;
@ -3228,7 +3236,7 @@ find_matching_tracepoint (struct uploaded_tp *utp)
for (loc = b->loc; loc; loc = loc->next)
{
if (loc->address == utp->addr)
return t;
return loc;
}
}
}
@ -3243,17 +3251,24 @@ void
merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
{
struct uploaded_tp *utp;
struct tracepoint *t;
/* Look for GDB tracepoints that match up with our uploaded versions. */
for (utp = *uploaded_tps; utp; utp = utp->next)
{
t = find_matching_tracepoint (utp);
if (t)
printf_filtered (_("Assuming tracepoint %d is same "
"as target's tracepoint %d at %s.\n"),
t->base.number, utp->number,
paddress (get_current_arch (), utp->addr));
struct bp_location *loc;
struct tracepoint *t;
loc = find_matching_tracepoint_location (utp);
if (loc)
{
/* Mark this location as already inserted. */
loc->inserted = 1;
t = (struct tracepoint *) loc->owner;
printf_filtered (_("Assuming tracepoint %d is same "
"as target's tracepoint %d at %s.\n"),
loc->owner->number, utp->number,
paddress (loc->gdbarch, utp->addr));
}
else
{
t = create_tracepoint_from_upload (utp);