This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix gdb1476.exp on s390*


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]