Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA 1/2] mips: Switch inferior function calls to ON_STACK method.
Date: Thu, 03 May 2012 21:50:00 -0000	[thread overview]
Message-ID: <20120503214933.GJ15555@adacore.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1205032047100.18334@tp.orcam.me.uk>

Thanks for the detailed feedback :)

>  Thanks for this work -- can you give me a reference to some background 
> information as to why exactly we want to remove the AT_SYMBOL method?

I do not have a specific reference. Only the fact that it's always
been a method that we wanted to deprecate and then remove support for...

>  For the record: the respective ABIs mandate that the stack is aligned
>  to 8 bytes for 32-bit targets and to 16 bytes for 64-bit targets.

Ah, that explains why mips_frame_align aligned to 16 bytes boundaries...
I googled that question instead of looking that information up in my
manuals - my bad.

> There's one fundamental problem with this change -- software breakpoints 
> must not be used unconditionally, because some configurations do not 
> expect or support them.

I think that we will be fine, because the code is not actually inserting
the breakpoint, merely reserving the room for it on the stack. Later
on, the target layer then inserts the breakpoint for us, using the
appropriate method. If you're connected to a board via JTAG, it should
do the right thing.

>  I can address all these microMIPS issues if you like as I'm likely
>  more familiar with that stuff,

I'd feel more comfortable if you did. I think I understand a little
better what you mean by microMIPS, although I thought it was what
the code called mips16. But I realize now that it's something
different, because IIRC you can switch between mips16 and mips32
by simply using odd addresses (or not).

> > @@ -6906,10 +6936,8 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
> >  
> >    /* MIPS version of CALL_DUMMY.  */
> >  
> > -  /* NOTE: cagney/2003-08-05: Eventually call dummy location will be
> > -     replaced by a command, and all targets will default to on stack
> > -     (regardless of the stack's execute status).  */
> > -  set_gdbarch_call_dummy_location (gdbarch, AT_SYMBOL);
> > +  set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
> > +  set_gdbarch_push_dummy_code (gdbarch, mips_push_dummy_code);
> >    set_gdbarch_frame_align (gdbarch, mips_frame_align);
> >  
> >    set_gdbarch_convert_register_p (gdbarch, mips_convert_register_p);
> 
>  So what if the stack pages are indeed not executable (their page entries 
> have the XI aka Execute Inhibit bit set)?

The only time when we are executing an instruction on the stack is
when the function being called returns and hits the breakpoint.
IIRC, there has been some testing done against this situation,
and things just worked. I suspect that we get a trap, and that trap
correctly gets interpreted. I can see ourselves receiving a signal
instead, but I think this can also be correctly interpreted. Maybe
we'll have to make some adjustement to GDB's core, but I'd rather
fix that if I have a way to reproduce and therefore test...

Cheers,
-- 
Joel


  reply	other threads:[~2012-05-03 21:50 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 [this message]
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
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=20120503214933.GJ15555@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@codesourcery.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