This is the mail archive of the
mailing list for the GDB project.
Re: [patch, gdbserver] Uninsert bpkt when regular and fast tracepoint are set at the same address
- From: Stan Shebs <stanshebs at earthlink dot net>
- To: gdb-patches at sourceware dot org
- Date: Thu, 27 Oct 2011 11:38:31 -0700
- Subject: Re: [patch, gdbserver] Uninsert bpkt when regular and fast tracepoint are set at the same address
- References: <4EA8C851.firstname.lastname@example.org>
On 10/26/11 7:56 PM, Yao Qi wrote:
I find a program will receive segv fault when I set a regular tracepoint
and a fast tracepoint at the same address, start tracing and resume program.
gdbserver has taken care of this situation in many places of the code,
when uninserting breakpoint or fast tracepoint, write_inferior_memory is
called to take care of layering breakpoints on top of fast tracepoints.
However, it is not right to me. Here is an example to illustrate this
Supposing I set a regular tracepoint and a fast tracepoint on 0x080484fc,
0x080484fc<+3>: e8 f3 ff ff ff call 0x80484f4<func>
During insertion, trap insn (for regular tracepoint) and jmp insn (for
fast tracepoint) are inserted, and gdbserver takes care of them to make
sure trap insn is *always* inserted on top of jmp insn.
I'm looking at this and wondering, why are we inserting the fast
tracepoint jump insn at all?
Shouldn't be it sufficient to let the trap handler do the work of both
slow and fast tracepoints at that location? Since hitting the trap has
already put us on the slow path, there's not going to any noticeable
additional penalty for not going to the IPA and interpreting conditional
bytecodes instead of compiled ones, etc. We may not even need to sync
trace buffers (I'm not sure about that, code is tricky).