Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Tzu-Chien Chiu" <tzuchien.chiu@gmail.com>
To: gdb@sourceware.org
Subject: remote software breakpoint technical detail
Date: Wed, 03 May 2006 17:43:00 -0000	[thread overview]
Message-ID: <4d77c5f20605031043t256b1c05o3d9bb27beef8ed33@mail.gmail.com> (raw)

Hi, all. I'm new to gdb. I have a question on the remote software
breakpoint implementation. Either my porting of gdb or there is a bug
in our hardware implementation.

We have an OpenRISC silicon (http://www.opencores.org). I'm using GDB 5.0.

Suppose the instruction cache has been disabled in the very beginning.

Here is what I observed:
1) the user set a breakpoint ('b') at instruction foo
2) the user continue ('c') the execution
3) gdb replaces instruction foo with a 'breakpoint instruction", which
will stall the processor
4) gdb unstall the processor
5) the processor fetches the breakpoint instruction into the execution
pipeline, and point pc to the next instruction
6) the breakpoint instruction is decoded, recognized, and the processor stalls
7) gdb restores instruction foo
8) the user issues the single instruction step ('si'), and he expects
instruction foo be executed next, but...

The question is:

What value of pc should be expected after step 5 completes?

if $pc==foo+4, foo won't be executed but the following instruction,
which is incorrect.

if $pc==foo, the breakpoint instruction _has been_ fetched into the
execution pipeline at step 5, what makes the cpu to *fetch again* the
instruction restored by gdb at step 7? GDB or the hardware must be
designed to do so?

--
Tzu-Chien Chiu - SMedia Technology Corp.
URL: http://www.csie.nctu.edu.tw/~jwchiu/


             reply	other threads:[~2006-05-03 17:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-03 17:43 Tzu-Chien Chiu [this message]
2006-05-03 18:08 ` Daniel Jacobowitz
2006-05-03 18:49 ` Paul Koning

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=4d77c5f20605031043t256b1c05o3d9bb27beef8ed33@mail.gmail.com \
    --to=tzuchien.chiu@gmail.com \
    --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