From: Ulrich Weigand <weigand@i1.informatik.uni-erlangen.de>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix gdb1476.exp on s390*
Date: Wed, 17 Mar 2004 19:18:00 -0000 [thread overview]
Message-ID: <200403171918.UAA09549@faui1d.informatik.uni-erlangen.de> (raw)
Hello,
this patch fixes the gdb.base/gdb1476.exp test case (backtrace from NULL
function pointer call).
When calling via an invalid function pointer, what we should do is simply
unwind the PC from the return address register and continue. This is
exactly what is done to unwind from a PLT stub as well, so the patch
simply uses the PLT frame unwinder to handle this case as well.
Tested with no regressions on s390-ibm-linux and s390x-ibm-linux.
Bye,
Ulrich
ChangeLog:
* s390-tdep.c (s390_pltstub_frame_sniffer): Handle invalid function
pointer calls like PLT calls.
Index: gdb/s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.129
diff -c -p -r1.129 s390-tdep.c
*** gdb/s390-tdep.c 26 Feb 2004 23:48:01 -0000 1.129
--- gdb/s390-tdep.c 15 Mar 2004 19:36:47 -0000
*************** static const struct frame_unwind s390_pl
*** 2103,2109 ****
static const struct frame_unwind *
s390_pltstub_frame_sniffer (struct frame_info *next_frame)
{
! if (!in_plt_section (frame_pc_unwind (next_frame), NULL))
return NULL;
return &s390_pltstub_frame_unwind;
--- 2103,2116 ----
static const struct frame_unwind *
s390_pltstub_frame_sniffer (struct frame_info *next_frame)
{
! CORE_ADDR pc = frame_pc_unwind (next_frame);
! bfd_byte insn[S390_MAX_INSTR_SIZE];
!
! /* If the current PC points to non-readable memory, we assume we have
! trapped due to an invalid function pointer call. We handle the
! non-existing current function like a PLT stub. */
! if (!in_plt_section (pc, NULL)
! && s390_readinstruction (insn, pc) > 0)
return NULL;
return &s390_pltstub_frame_unwind;
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de
WARNING: multiple messages have this Message-ID
From: Ulrich Weigand <weigand@i1.informatik.uni-erlangen.de>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix gdb1476.exp on s390*
Date: Fri, 19 Mar 2004 00:09:00 -0000 [thread overview]
Message-ID: <200403171918.UAA09549@faui1d.informatik.uni-erlangen.de> (raw)
Message-ID: <20040319000900.Or_PAe4wvKOwxRb5Fy392d40RqUCpE2aJy7_9JWR54Q@z> (raw)
Hello,
this patch fixes the gdb.base/gdb1476.exp test case (backtrace from NULL
function pointer call).
When calling via an invalid function pointer, what we should do is simply
unwind the PC from the return address register and continue. This is
exactly what is done to unwind from a PLT stub as well, so the patch
simply uses the PLT frame unwinder to handle this case as well.
Tested with no regressions on s390-ibm-linux and s390x-ibm-linux.
Bye,
Ulrich
ChangeLog:
* s390-tdep.c (s390_pltstub_frame_sniffer): Handle invalid function
pointer calls like PLT calls.
Index: gdb/s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.129
diff -c -p -r1.129 s390-tdep.c
*** gdb/s390-tdep.c 26 Feb 2004 23:48:01 -0000 1.129
--- gdb/s390-tdep.c 15 Mar 2004 19:36:47 -0000
*************** static const struct frame_unwind s390_pl
*** 2103,2109 ****
static const struct frame_unwind *
s390_pltstub_frame_sniffer (struct frame_info *next_frame)
{
! if (!in_plt_section (frame_pc_unwind (next_frame), NULL))
return NULL;
return &s390_pltstub_frame_unwind;
--- 2103,2116 ----
static const struct frame_unwind *
s390_pltstub_frame_sniffer (struct frame_info *next_frame)
{
! CORE_ADDR pc = frame_pc_unwind (next_frame);
! bfd_byte insn[S390_MAX_INSTR_SIZE];
!
! /* If the current PC points to non-readable memory, we assume we have
! trapped due to an invalid function pointer call. We handle the
! non-existing current function like a PLT stub. */
! if (!in_plt_section (pc, NULL)
! && s390_readinstruction (insn, pc) > 0)
return NULL;
return &s390_pltstub_frame_unwind;
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de
next reply other threads:[~2004-03-17 19:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-17 19:18 Ulrich Weigand [this message]
2004-03-19 0:09 ` Ulrich Weigand
2004-03-22 17:22 ` Andrew Cagney
2004-03-22 19:05 ` Ulrich Weigand
2004-03-22 21:58 ` Andrew Cagney
2004-03-22 22:20 ` Ulrich Weigand
2004-03-22 22:37 ` 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=200403171918.UAA09549@faui1d.informatik.uni-erlangen.de \
--to=weigand@i1.informatik.uni-erlangen.de \
--cc=gdb-patches@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