From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, <gdb-patches@sourceware.org>
Subject: Re: [RFA 1/2] mips: Switch inferior function calls to ON_STACK method.
Date: Wed, 09 May 2012 06:21:00 -0000 [thread overview]
Message-ID: <alpine.DEB.1.10.1205082254390.18334@tp.orcam.me.uk> (raw)
In-Reply-To: <20120508204257.GC15555@adacore.com>
On Tue, 8 May 2012, Joel Brobecker wrote:
> > You set bp_addr to SP here, so you rely on the stack pointer to have
> > been implicitly adjusted down below the current frame [...]
>
> I was actually confused, as I thought that SP pointed to the first
> unused slot in the stack.
Correct, but stack grows downwards. So SP points to the end of the first
unused slot. This is best shown with an illustration, e.g. for 32 bits:
| | +12
+ +
| . . . | +8
+ +
| current | +4
+ +
| frame | 0
SP --> +-----------+
| free | -4
+ +
| . . . | -8
+ +
| | -12
For example for a nested o32 function at SP + 0 you'll have the next
frame's $a0 argument save slot.
This is really no different to how some architectures with hardware stack
support interpret the SP register, e.g. Intel pieces like 8080 or x86 or
DEC VAX.
> I will make the changes that you suggest and re-test.
Great!
> One thing that just occured to me while driving home is why not
> also use the AT_ENTRY_POINT approach. I figured that there must
> have been a reason why we used AT_SYMBOL instead of AT_ENTRY_POINT.
> But then, there is your comment that makes me think that the symbol
> isn't usually defined, which means that most of (all?) the time,
> we actually end up using AT_ENTRY_POINT. Do we know of any reason
> why AT_ENTRY_POINT would not work? I'd assume that as long as the
> object format is ELF, we'd have one, and so we could use that as
> well.
I mentioned that in one of the replies -- there was a comment originally
that stated that AT_ENTRY_POINT wouldn't work if it was located in a ROM.
With software breakpoints that is, but support for hardware breakpoints is
not mandatory in MIPS processors (and I think we don't use them for
internal breakpoints anyway). The comment was removed with the addition
of AT_SYMBOL. Presumably that magic symbol would be arranged by a ROM
image generation toolkit. As I say, I've never actually encountered it.
> Geee, are we ever going to reach a conclusion on this discussion? :-/
Well, we'll die off eventually, so certainly there's some finite limit.
Maciej
next prev parent reply other threads:[~2012-05-09 6:21 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 19:03 Getting rid of AT_SYMBOL inferior call method Joel Brobecker
2012-05-03 19:03 ` [commit 2/2] Remove AT_SYMBOL Joel Brobecker
2012-05-09 14:37 ` Joel Brobecker
2012-05-03 19:03 ` [RFA 1/2] mips: Switch inferior function calls to ON_STACK method Joel Brobecker
2012-05-03 21:09 ` Maciej W. Rozycki
2012-05-03 21:50 ` Joel Brobecker
2012-05-03 23:29 ` Maciej W. Rozycki
2012-05-04 20:58 ` Joel Brobecker
2012-05-04 21:19 ` Mark Kettenis
2012-05-04 23:25 ` Maciej W. Rozycki
2012-05-05 11:45 ` Mark Kettenis
2012-05-08 15:08 ` Maciej W. Rozycki
2012-05-08 16:06 ` Joel Brobecker
2012-05-08 20:26 ` Maciej W. Rozycki
2012-05-08 20:43 ` Joel Brobecker
2012-05-08 22:08 ` Joel Brobecker
2012-05-09 7:32 ` Maciej W. Rozycki
2012-05-09 8:24 ` Mark Kettenis
2012-05-09 9:14 ` Maciej W. Rozycki
2012-05-09 16:08 ` Tom Tromey
2012-05-09 14:35 ` Joel Brobecker
2012-05-14 9:44 ` Maciej W. Rozycki
2012-05-14 15:01 ` Joel Brobecker
2012-05-14 16:48 ` Maciej W. Rozycki
2012-06-11 10:14 ` Maciej W. Rozycki
2012-05-09 6:21 ` Maciej W. Rozycki [this message]
2012-05-04 22:41 ` Maciej W. Rozycki
2012-05-04 21:34 ` Mark Kettenis
2012-05-05 1:31 ` Maciej W. Rozycki
2012-05-03 21:44 ` Mark Kettenis
2012-05-03 21:58 ` Joel Brobecker
2012-05-04 2:11 ` Yao Qi
2012-05-03 22:03 ` Joel Brobecker
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=alpine.DEB.1.10.1205082254390.18334@tp.orcam.me.uk \
--to=macro@codesourcery.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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