public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Hacking gdbserver to capture instruction-level code coverage
@ 2006-06-21 15:31 Ron McCall
  2006-06-21 16:51 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Ron McCall @ 2006-06-21 15:31 UTC (permalink / raw)
  To: gdb

Hi,

I have attempted to hack gdbserver 6.5 to log
instruction-level code coverage on a powerpc-linux
system and it seems to work except that examining
variables is broken as a result.  Turning on remote
debugging in gdb and comparing a run using an
unmodified gdbserver and the modified gdbserver seems
to show a difference with the DBAT0 register mapping
in the 'g' packet responses.  It would seem that my
changes have somehow violated something and perhaps
has confused the Linux kernel?

More specifically, I have changed handle_v_cont() in
server.c to do a repeated single step rather than a
continue.  I let the resume_info get built as usual
(and only once), except in the 'c' or 'C' case where I
set resume_info[i].step=1 (since we'll be stepping
repeatedly instead).  Then, at the bottom of the
function, I loop repeatedly, resuming the inferior,
waiting for it to stop, getting the PC of the inferior
and logging it, and then determining whether to repeat
or break out of the loop (based on whether we are
single stepping, continuing or there's a breakpoint at
the current PC location).  After the loop, I free the
resume_info and prepare the resume reply as usual.

Does any of this sound particularly evil?  I can
provide the small patch against the 6.5 source if
anyone needs to see the changes in more detail.

Thanks!
Ron McCall

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-21 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-21 15:31 Hacking gdbserver to capture instruction-level code coverage Ron McCall
2006-06-21 16:51 ` Daniel Jacobowitz
2006-06-21 21:46   ` Ron McCall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).