Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jonathan Larmour <jlarmour@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Elena Zannoni <ezannoni@cygnus.com>, gdb@sources.redhat.com
Subject: Re: SH breakpoint problem
Date: Thu, 09 Aug 2001 16:52:00 -0000	[thread overview]
Message-ID: <3B731D31.D2C2B57F@redhat.com> (raw)
In-Reply-To: <3B730568.6030003@cygnus.com>

Andrew Cagney wrote:
> I think there are two bugs:
> 
>         o       GCC is marking the end of the prologue
>                 and the start of the code proper
>                 with an instruction sitting in a delay slot.
> 
>                 Put simply OUTCH!
> 
>                 I'd consider that a GCC bug.  Especially
>                 if it was compiled without -O.

Maybe I didn't quite understand what was meant to happen then. In the case
of:

1: {
2: for (;;);
3: }

where is the compiler meant to mark the end of the first source line in the
debug info? You are saying it is 1, not 2 as I previously had been
assuming.

>         o       The SH has delay slots and the subsequent
>                 features.

So this bug _would_ be revealed if we set a breakpoint on line 2 above,
right?
 
> The delay slot problem tends to only occure when a user explicitly
> inserts a breakpoint at a specific address (or GCC gets nasty and starts
> outputting source-and-line info that contains delay slots).

So which source line _should_ the delay slot be associated with in the
above example, if GCC is being nasty?
 
> Any way, the first problem is handed by fixing GCC :-)

And I know even less about GCC than GDB. Oh dear.

> The second problem is more interesting, targets handle delay slots by:
> 
>         o       have code such as software
>                 instruction-step detect and skip
>                 both the jmp and the delay slot
> 
>         o       have the target when doing hardware
>                 single step skip both (I suspect
>                 the SH does this)

We've been doing both on our target.

>         o       have the hardware provide sufficient
>                 information to allow GDB to detect
>                 a delay-slot breakpoint.
> 
> If either of the first two options are taken (they are both reasonable!)
> then it is a ``the user is always right'' situtation when they enter:
> 
>         (gdb) break *address_of_delay_slot
> 
> This is because, in general, GDB can't tell if what looks like and
> smells like a delay slot really is.  GDB just has to assume that the
> USER (who is always right and in this case, since they are using
> assembler level features, must understand the ISA's delay slot :-)
> really is trying to debug something like:
> 
>         jump bar
>         nop
>         .....
>         jump foo
>    bar: move r1 to r2

Yuck, but I suppose it's possible. The implication of what you are saying
is that it is up to the target to detect that the trap occured in a delay
slot, and return the address of the delay slot instead of the reported
address at the time of the exception. Right?

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine


  reply	other threads:[~2001-08-09 16:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-06 19:45 Jonathan Larmour
2001-08-07  5:53 ` Jonathan Larmour
2001-08-07  7:26 ` Elena Zannoni
2001-08-07  7:33   ` Jonathan Larmour
2001-08-07  7:54     ` Elena Zannoni
2001-08-07  8:05       ` Jonathan Larmour
2001-08-09 14:49       ` Andrew Cagney
2001-08-09 16:52         ` Jonathan Larmour [this message]
2001-08-09 18:05           ` Andrew Cagney
2001-08-10 14:24             ` Jonathan Larmour
2001-08-07 15:42 ` Kevin Buettner
2001-08-07 21:54   ` Alexandre Oliva
2001-08-07 22:46     ` Kevin Buettner
2001-08-09 12:48       ` Jonathan Larmour
2001-08-09 13:29         ` Kevin Buettner
2001-08-09 14:05           ` Jonathan Larmour
2001-08-09 14:28             ` Andrew Cagney
2001-08-09 14:57             ` Kevin Buettner

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=3B731D31.D2C2B57F@redhat.com \
    --to=jlarmour@redhat.com \
    --cc=ac131313@cygnus.com \
    --cc=ezannoni@cygnus.com \
    --cc=gdb@sources.redhat.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