Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix gdb1476.exp on s390*
@ 2004-03-17 19:18 Ulrich Weigand
  2004-03-19  0:09 ` Ulrich Weigand
  2004-03-22 17:22 ` Andrew Cagney
  0 siblings, 2 replies; 7+ messages in thread
From: Ulrich Weigand @ 2004-03-17 19:18 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-03-22 22:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-17 19:18 [PATCH] Fix gdb1476.exp on s390* Ulrich Weigand
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox