Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Ron McCall <ronald.mccall@snet.net>
To: gdb@sourceware.org
Subject: Hacking gdbserver to capture instruction-level code coverage
Date: Wed, 21 Jun 2006 15:31:00 -0000	[thread overview]
Message-ID: <20060621152810.56441.qmail@web80332.mail.yahoo.com> (raw)

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


             reply	other threads:[~2006-06-21 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21 15:31 Ron McCall [this message]
2006-06-21 16:51 ` Daniel Jacobowitz
2006-06-21 21:46   ` Ron McCall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060621152810.56441.qmail@web80332.mail.yahoo.com \
    --to=ronald.mccall@snet.net \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox