-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracepoints support #157
Comments
@daniel5151 in line with the discussion thread, my current extension trait looks like pub trait Tracepoints: Target {
fn tracepoints_init(&mut self)
-> TargetResult<(), Self>;
fn tracepoint_create(&self, tdp: NewTracepoint<<Self::Arch as Arch>::Usize>)
-> TargetResult<(), Self>;
fn tracepoint_define(&self, dtdp: DefineTracepoint<'_>)
-> TargetResult<(), Self>;
fn tracepoint_status(&self, tp: Tracepoint, addr: <Self::Arch as Arch>::Usize)
-> TargetResult<(u64, u64), Self>;
fn tracepoint_enumerate_start(&mut self)
-> TargetResult<Option<NewTracepoint<<Self::Arch as Arch>::Usize>>, Self>;
fn tracepoint_enumerate_step(&mut self)
-> TargetResult<Option<DefineTracepoint<'_>>, Self>;
fn trace_buffer_configure(&mut self, tb: TraceBuffer)
-> TargetResult<(), Self>;
fn trace_buffer_request(&mut self, offset: u64, len: usize, buf: &mut [u8])
-> TargetResult<Option<usize>, Self>;
fn trace_experiment_status(&self)
-> TargetResult<ExperimentStatus<'_>, Self>;
fn trace_experiment_start(&mut self)
-> TargetResult<(), Self>;
fn trace_experiment_stop(&mut self)
-> TargetResult<(), Self>;
fn select_frame(&mut self, frame: FrameRequest<<Self::Arch as Arch>::Usize>,
report: &mut dyn FnMut(FrameDescription))
-> TargetResult<(), Self>; Most of them are fairly 1:1 with the corresponding packets in https://sourceware.org/gdb/current/onlinedocs/gdb.html/Tracepoint-Packets.html. I haven't yet implemented |
Some of the APIs here are fairly annoying to wrap: the |
I'm sure once there's an actual PR with code I can review, I'll have some more ideas / refinements to this proposed API, but this current sketch seems like a great jumping off point. I must say though - its quite unfortunate that the current docs on these tracepoint packets simply say
Skimming through the other packets gdbstub already supports, I wonder if looking at For now, I think your proposed split API seems reasonable. Maybe once there's a PR out, I can suggest a better approach. |
GDB has support for tracepoints (https://sourceware.org/gdb/current/onlinedocs/gdb.html/Tracepoints.html) for collecting information on the agent without needing to be driven by GDB. gdbstub currently doesn't support tracepoints in any capacity.
I'm currently working on a patch that adds "barebones" tracepoint support, which corresponds to parsing the packets related to setting up tracing experiments and reading the data back. Tracepoints are able to be configured with agent bytecode programs that record arbitrary information instead of only purely hitcounts as well, which is currently out of scope of the patch (and would possibly desire integration into with something like #40).
The text was updated successfully, but these errors were encountered: