Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@gnu.org>
To: randolph@tausq.org
Cc: cagney@gnu.org, gdb-patches@sources.redhat.com
Subject: Re: [patch/RFA] multiarch INSTRUCTION_NULLIFIED
Date: Thu, 18 Nov 2004 16:56:00 -0000	[thread overview]
Message-ID: <200411181655.iAIGthDa026050@juw15.nfra.nl> (raw)
In-Reply-To: <20041118162108.GK15714@tausq.org> (message from Randolph Chung on Thu, 18 Nov 2004 08:21:08 -0800)

   Date: Thu, 18 Nov 2004 08:21:08 -0800
   From: Randolph Chung <randolph@tausq.org>

   > I'm wondering about:
   > 
   > # Return non-zero if the processor is executing a delay slot and a
   > # further single-step is needed before the instruction finishes.
   > M::int:single_step_through_delay:struct frame_info *frame:frame

   I was too, but actually this seems to do something slightly different.

   single_step_through_delay seems to be asking: "does the current
   instruction have a delay slot"? This is used to tell gdb that if we
   wanted to do a step on a branch-insn-with-a-delay-slot, then after we
   step through the branch insn, we will step one more insn.

   Is that correct?

I think the description is misleading.

   The comment is confusing because it talks about "executing a delay slot"
   but at least mips-tdep.c, the only implementation of this method,
   doesn't test that. It tests "executing a branch insn with a delay slot".

The problem on MIPS is that if you trap on a delay slot, the processor
backs up the PC to the preceding branch instruction.  As a result,
naively single-stepping will re-execute the branch instruction again
and again.  Therefore, operating systems and GDB's software
single-stepping machinery will step over the delay slot, effectively
executing two instructions in a row instead of one.  Now if there
would be a breakpoint-instruction in the delay slot, this won't work.
That's why we had the STEP_SKIPS_DELAY macro that makes sure the
single-step is done without any breakpoints inserted.  This was
replaced by single_step_through_delay which presumably will also be
used on a new CRISv32 port.

Another problem is when there is a breakpoint in the delay slot.
Hitting it would thoroughly confuse GDB since after hitting the
breakpoint instruction the PC will not point at the breakpoint, but at
the branch instruction.  Continuing from that point will hit the
breakpoint again and again.  I'm not sure the current code handles
this correctly.

   i was trying to figure out that piece of commented out code too and why
   it was changed. looked through cvs history but didn't find it. I'm not
   particularly fond of introducing new almost-arch-specific gdbarch
   methods either, but this does seem to be doing slightly different things
   than the existing ones. OTOH this is almost a "cosmetic" feature, so one
   alternative is to drop the INSTRUCTION_NULLIFIED logic completely....

Perhaps that isn't such a bad idea if it doesn't confuse GDB too much.

Mark


  reply	other threads:[~2004-11-18 16:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-18  0:02 Randolph Chung
2004-11-18 14:26 ` Andrew Cagney
2004-11-18 16:21   ` Randolph Chung
2004-11-18 16:56     ` Mark Kettenis [this message]
2004-11-19  9:25       ` Orjan Friberg
2004-11-23 17:50       ` Randolph Chung
2004-11-23 19:33         ` Mark Kettenis
2004-11-28 17:26         ` Andrew Cagney
2004-11-28 18:41           ` Randolph Chung
2004-11-28 19:55             ` Andrew Cagney
2004-11-29  3:30               ` Randolph Chung
2004-11-29 15:12                 ` Andrew Cagney
2004-11-30  6:56                   ` Randolph Chung
2004-11-30 14:51                     ` Andrew Cagney
2004-11-30 16:44                       ` Randolph Chung
2004-11-30 16:59                         ` Andrew Cagney
2004-11-30 17:38                           ` Randolph Chung
2004-12-01 21:29                             ` Andrew Cagney
2004-12-01 22:33                               ` Randolph Chung
2004-12-01 23:32                                 ` Andrew Cagney
2004-12-02  5:24                                   ` Randolph Chung
2004-12-02 14:27                                     ` Daniel Jacobowitz
2004-12-03 18:11                                     ` Andrew Cagney
2004-12-03 18:15                                       ` Randolph Chung
2004-12-03 18:57                                         ` Daniel Jacobowitz
2004-12-03 19:57                                           ` Randolph Chung
2004-12-03 21:40                                       ` Randolph Chung
2004-12-03 21:58                                         ` Andrew Cagney
2004-12-03 22:52                                           ` Daniel Jacobowitz
2004-12-04  0:00                                           ` Randolph Chung
2004-12-04  0:55                                           ` Randolph Chung
2004-12-04 11:27                                             ` Mark Kettenis
2004-12-01  6:19                   ` Randolph Chung
2004-12-01 17:11                     ` Daniel Jacobowitz
2004-12-01 17:17                       ` Randolph Chung
2004-12-01 17:19                         ` Daniel Jacobowitz
2004-12-01 17:25                           ` Randolph Chung
2004-12-01 17:28                             ` Daniel Jacobowitz
2004-12-01 17:30                               ` Randolph Chung
2004-12-01 17:35                               ` Randolph Chung
2004-12-01 18:14                                 ` Randolph Chung
2004-12-01 21:25                       ` Andrew Cagney
2004-12-01 13:32 Paul Schlie
2004-12-01 16:25 Randolph Chung

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=200411181655.iAIGthDa026050@juw15.nfra.nl \
    --to=kettenis@gnu.org \
    --cc=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=randolph@tausq.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