Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Add sparc64-linux sigtramp support
Date: Sat, 23 Apr 2005 17:47:00 -0000	[thread overview]
Message-ID: <20050423103928.52d3c5e2.davem@davemloft.net> (raw)
In-Reply-To: <200504231232.j3NCWuZT029533@elgar.sibelius.xs4all.nl>

On Sat, 23 Apr 2005 14:32:56 +0200 (CEST)
Mark Kettenis <mark.kettenis@xs4all.nl> wrote:

> Hmm, the SCD 2.4.1 document that I'm looking at now says there are 32K
> entries of 32 bytes followed by sections of 160 24-byte entries
> followed by 160 pointers.

The first part is correct, there are 32K pure code entries.
The latter section is "160 24-byte entries followed by
160 pointers" for every full group of 160 entries, for the
final group that has less than 160 entries (say N entries) it is
N 24-byte entries followed by N pointers.

The formulas to compute this stuff are pretty well described
in the sparc64 BFD backend support code.  Search for
"h->plt.offset" and "build_plt_entry" in the current bfd/elfxx-sparc.c
code.

> I'm not sure it really matters though.
> IIRC the most important thing is to avoid thinking that the PLT is a
> proper function that starts with setting up a stack frame.  Did you
> notice any problems with the current code.

Yes, there is a test case that fails on sparc32 for at least the
past 8 years that's been bugging me like crazy.

Basically it's trying to step over an integer multiply in a piece
of C code, via a watchpoint.  It's 32-bit Sparc compiled code with
no hw multiply support, so to implement the multiply it calls ".umul"
in the C library via a PLT entry.

GDB outside of my own trees has never handled this test correctly
and it's because of the PLT frame handling.

The PLT trampoline _does_ have a frame, the issue is only to teach
the Sparc target dependant code where to find the restore which
releases the frame.

Anyways, let me dig through my old patches and notes I took on this
matter.  I'll use that to come up with a solution proposal.

> Looks to me as if the sparc PLT entries are deliberately constructed a
> way to avoid the PLT breakpoint issue the ppc-linux-tdep.c code tries
> to solve.  That said, moving that code into a common file is probably
> a good idea.

It has the same problem.  If you set a breakpoint in the second instruction
of a PLT entry while we're in the dynamic linker resolve code, the dynamic
linker will write the new instructions in the PLT entry, then GDB will
restore the old out-of-date instruction when it removes the breakpoint it
had there, thus corrupting the PLT entry and causing a crash the next time
the child calls that function via that PLT entry.

Like the above, I'll come up some specific test cases and fix proposals
over the next few days for this stuff.


      reply	other threads:[~2005-04-23 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-21  3:51 David S. Miller
2005-04-21 19:23 ` Mark Kettenis
2005-04-21 19:29   ` David S. Miller
2005-04-21 21:20     ` Mark Kettenis
2005-04-21 21:41       ` David S. Miller
2005-04-21 21:57         ` Mark Kettenis
2005-04-21 22:04           ` David S. Miller
2005-04-21 21:55       ` David S. Miller
2005-04-21 22:09         ` Mark Kettenis
2005-04-22 22:45           ` David S. Miller
2005-04-23 12:33             ` Mark Kettenis
2005-04-23 17:47               ` David S. Miller [this message]

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=20050423103928.52d3c5e2.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=gdb-patches@sources.redhat.com \
    --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