From: Andrew Cagney <cagney@gnu.org>
To: Orjan Friberg <orjan.friberg@axis.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: STEP_SKIPS_DELAY question, sort of
Date: Mon, 07 Jun 2004 15:08:00 -0000 [thread overview]
Message-ID: <40C484FE.5080702@gnu.org> (raw)
In-Reply-To: <40C46919.2060802@axis.com>
> Orjan Friberg wrote:
>
>>
>> Gah. Please ignore the previous patch (and sorry); what I posted only works when doing a continue when stopped at the branch instruction. Doing a step (which leaves us in the delay slot) followed by another step (or continue for that matter) prematurely inserts the breakpoint.
>
>
> Ok, second try (still concept patch though): the change in proceed is needed for when we resume from the delay slot - in that case we need to single-step again before re-inserting the breakpoint (similar to the MIPS case). The change in handle_inferior_event (and I'll happily agree it's far more questionable) is needed for when we resume at the branch instruction itself. Comments?
Can this new mechanism somehow superseed STEP_SKIPS_DELAY - it seems to
be the exact oposite but there could be common ground here.
> Index: infrun.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infrun.c,v
> retrieving revision 1.156
> diff -u -p -r1.156 infrun.c
> --- infrun.c 11 May 2004 23:30:31 -0000 1.156
> +++ infrun.c 7 Jun 2004 12:59:10 -0000
> @@ -748,6 +748,14 @@ proceed (CORE_ADDR addr, enum target_sig
> && breakpoint_here_p (read_pc () + 4)
> && STEP_SKIPS_DELAY (read_pc ()))
> oneproc = 1;
> +
> + /* If we stepped into a delay slot, and the preceding instruction
> + will be re-executed when resuming, step again before re-inserting
> + the breakpoint. */
> + if (STEP_SKIPS_IN_DELAY_P
> + && "
> + && STEP_SKIPS_IN_DELAY (read_pc ()))
> + oneproc = 1;
> }
> else
> {
They both seem to be asking the question: "given PC and a list of
breakpoints, should the inferior be h/w single-stepped?". That would
mean pushing the alternative:
breakpoint_here_p (read_pc () - 2)
breakpoint_here_p (read_pc () + 4)
calls into that architecture method.
> @@ -1975,7 +1983,17 @@ handle_inferior_event (struct execution_
> /* Don't even think about breakpoints if just proceeded over a
> breakpoint. */
> if (stop_signal == TARGET_SIGNAL_TRAP && trap_expected)
> - bpstat_clear (&stop_bpstat);
> + {
> + bpstat_clear (&stop_bpstat);
> +
> + /* If we stepped into a delay slot, and the preceding instruction
> + will be re-executed when resuming, step again before re-inserting
> + the breakpoint. */
> + if (STEP_SKIPS_IN_DELAY_P
> + && breakpoint_here_p (read_pc () - 2)
> + && STEP_SKIPS_IN_DELAY (read_pc ()))
> + ecs->another_trap = 1;
> + }
> else
> {
> /* See if there is a breakpoint at the current PC. */
>
I'm just not sure how this bit of logic should fit in. I'm guessing its
the second half of the state m/c sequence:
1. step off breakpoint at `PC'
2. step through delay
Andrew
next prev parent reply other threads:[~2004-06-07 15:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-21 17:14 Orjan Friberg
2004-05-21 20:25 ` Andrew Cagney
2004-05-24 9:15 ` Orjan Friberg
2004-05-24 18:15 ` Andrew Cagney
2004-05-25 11:53 ` Orjan Friberg
2004-05-25 21:14 ` Andrew Cagney
2004-05-26 9:39 ` Orjan Friberg
2004-05-26 17:39 ` Andrew Cagney
2004-06-07 12:12 ` Orjan Friberg
2004-06-07 12:42 ` Orjan Friberg
2004-06-07 13:09 ` Orjan Friberg
2004-06-07 15:08 ` Andrew Cagney [this message]
2004-06-09 9:48 ` Orjan Friberg
2004-06-09 16:00 ` Andrew Cagney
2004-06-14 12:09 ` Orjan Friberg
2004-06-16 14:53 ` Orjan Friberg
2004-06-24 18:25 ` Andrew Cagney
2004-10-01 11:26 ` Orjan Friberg
2004-10-25 20:18 ` Andrew Cagney
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=40C484FE.5080702@gnu.org \
--to=cagney@gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=orjan.friberg@axis.com \
/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