diff options
author | Stan Shebs <shebs@codesourcery.com> | 2010-01-06 04:20:27 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 2010-01-06 04:20:27 +0000 |
commit | 7a697b8dd7ac3c14e35ae3026d955aeae3ecc054 (patch) | |
tree | 62009f9b707ae6f18c12be8956f7b1e5fc586a7a /gdb/tracepoint.c | |
parent | 737a160ed9bb7bbe1ac8ebea1cdc27438213c247 (diff) | |
download | gdb-7a697b8dd7ac3c14e35ae3026d955aeae3ecc054.zip gdb-7a697b8dd7ac3c14e35ae3026d955aeae3ecc054.tar.gz gdb-7a697b8dd7ac3c14e35ae3026d955aeae3ecc054.tar.bz2 |
Add fast tracepoints.
* arch-utils.h (default_fast_tracepoint_valid_at): Declare.
* arch-utils.c (default_fast_tracepoint_valid_at): New function.
* breakpoint.h (enum bptype): Add bp_fast_tracepoint.
* breakpoint.c (tracepoint_type): New function.
(ALL_TRACEPOINTS): Use it.
(should_be_inserted): Ditto.
(bpstat_check_location): Ditto.
(print_one_breakpoint_location): Ditto.
(user_settable_breakpoint): Ditto.
(set_breakpoint_location_function): Ditto.
(disable_breakpoints_in_shlibs): Ditto.
(delete_trace_command): Ditto.
(print_it_typical): Add bp_fast_tracepoint case.
(bpstat_what): Ditto.
(print_one_breakpoint_location): Ditto.
(allocate_bp_location): Ditto.
(mention): Ditto.
(breakpoint_re_set_one): Ditto.
(disable_command): Ditto.
(enable_command): Ditto.
(check_fast_tracepoint_sals): New function.
(break_command_really): Call it.
(ftrace_command): New function.
(_initialize_breakpoint): Add ftrace command.
* gdbarch.sh (fast_tracepoint_valid_at): New.
* gdbarch.h, gdbarch.c: Regenerate.
* i386-tdep.c (i386_fast_tracepoint_valid_at): New function.
(i386_gdbarch_init): Use it.
* remote.c (struct remote_state): New field fast_tracepoints.
(PACKET_FastTracepoints): New packet config type.
(remote_fast_tracepoint_feature): New function.
(remote_protocol_features): Add FastTracepoints.
(remote_supports_fast_tracepoints): New function.
(_initialize_remote): Add FastTracepoints.
* tracepoint.c (download_tracepoint): Add fast tracepoint option.
* NEWS: Mention fast tracepoints.
* gdb.texinfo (Create and Delete Tracepoints): Describe fast
tracepoints.
(Tracepoint Packets): Describe remote protocol for fast
tracepoints.
* gdb.trace/tracecmd.exp: Test ftrace.
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r-- | gdb/tracepoint.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index b61362f..8ec81a3 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -34,6 +34,7 @@ #include "tracepoint.h" #include "remote.h" extern int remote_supports_cond_tracepoints (void); +extern int remote_supports_fast_tracepoints (void); extern char *unpack_varlen_hex (char *buff, ULONGEST *result); #include "linespec.h" #include "regcache.h" @@ -1690,6 +1691,7 @@ trace_start_command (char *args, int from_tty) void download_tracepoint (struct breakpoint *t) { + CORE_ADDR tpaddr; char tmp[40]; char buf[2048]; char **tdp_actions; @@ -1699,11 +1701,38 @@ download_tracepoint (struct breakpoint *t) struct agent_expr *aexpr; struct cleanup *aexpr_chain = NULL; - sprintf_vma (tmp, (t->loc ? t->loc->address : 0)); + tpaddr = t->loc->address; + sprintf_vma (tmp, (t->loc ? tpaddr : 0)); sprintf (buf, "QTDP:%x:%s:%c:%lx:%x", t->number, tmp, /* address */ (t->enable_state == bp_enabled ? 'E' : 'D'), t->step_count, t->pass_count); + /* Fast tracepoints are mostly handled by the target, but we can + tell the target how big of an instruction block should be moved + around. */ + if (t->type == bp_fast_tracepoint) + { + /* Only test for support at download time; we may not know + target capabilities at definition time. */ + if (remote_supports_fast_tracepoints ()) + { + int isize; + + if (gdbarch_fast_tracepoint_valid_at (get_current_arch (), + tpaddr, &isize, NULL)) + sprintf (buf + strlen (buf), ":F%x", isize); + else + /* If it passed validation at definition but fails now, + something is very wrong. */ + internal_error (__FILE__, __LINE__, + "Fast tracepoint not valid during download"); + } + else + /* Fast tracepoints are functionally identical to regular + tracepoints, so don't take lack of support as a reason to + give up on the trace run. */ + warning (_("Target does not support fast tracepoints, downloading %d as regular tracepoint"), t->number); + } /* If the tracepoint has a conditional, make it into an agent expression and append to the definition. */ if (t->loc->cond) |