Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix frame ID comparison problem on s390
@ 2004-05-20 13:31 Ulrich Weigand
  2004-05-20 14:17 ` Daniel Jacobowitz
  0 siblings, 1 reply; 13+ messages in thread
From: Ulrich Weigand @ 2004-05-20 13:31 UTC (permalink / raw)
  To: gdb-patches

Hello,

even after the siglongjmp patch, there was still one failure reported
with the signull test case on s390(x).

The reason turned out to be a problem with frame ID comparison.  In
the back trace we have
  handler
  <sigtramp>
  <NULL call>
  caller

As the NULL call doesn't set up a stack frame, and because our CFA is
determined by stack pointer at function entry, this means that the 
NULL call frame and the sigtramp frame have the same 'stack_addr'
component of their respective frame IDs.

Furthermore, the NULL call frame has 0 as 'code_addr' component of the
frame ID, because the current PC is in fact 0.

Due to the way frame ID comparison works, this causes the two IDs to
compare equal: the stack_addr is equal, and a zero code_addr is
considered a wild card matching any code_addr.

This in turn causes the backtrace to abort since it encounters two
frames with the same frame ID ...

The patch below is a simple fix (cheating a bit ...) in the s390 back
end: we simply set the code_addr component to 1 if the PC is 0.  (Note
that this can never happen normally because code addresses are always
2-aligned on our platform.)

Tested on s390-ibm-linux and s390x-ibm-linux, fixes one test suite
failure.

OK?

ChangeLog:

	* s390-tdep.c (s390_stub_frame_this_id): Set code_addr part of ID
	to 1 if the PC is 0.

Index: gdb/s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.132
diff -c -p -r1.132 s390-tdep.c
*** gdb/s390-tdep.c	4 May 2004 18:50:26 -0000	1.132
--- gdb/s390-tdep.c	20 May 2004 13:23:44 -0000
*************** s390_stub_frame_this_id (struct frame_in
*** 2078,2086 ****
  			 void **this_prologue_cache,
  			 struct frame_id *this_id)
  {
    struct s390_stub_unwind_cache *info
      = s390_stub_frame_unwind_cache (next_frame, this_prologue_cache);
!   *this_id = frame_id_build (info->frame_base, frame_pc_unwind (next_frame));
  }
  
  static void
--- 2078,2089 ----
  			 void **this_prologue_cache,
  			 struct frame_id *this_id)
  {
+   CORE_ADDR pc = frame_pc_unwind (next_frame);
    struct s390_stub_unwind_cache *info
      = s390_stub_frame_unwind_cache (next_frame, this_prologue_cache);
!   /* For 'call via NULL function pointer' stubs we use 1 as code address
!      in order to avoid the '0 matches everything' special case.  */
!   *this_id = frame_id_build (info->frame_base, pc? pc : 1);
  }
  
  static void
-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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

end of thread, other threads:[~2004-06-27 23:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-20 13:31 [PATCH] Fix frame ID comparison problem on s390 Ulrich Weigand
2004-05-20 14:17 ` Daniel Jacobowitz
2004-05-24 13:45   ` Ulrich Weigand
2004-05-24 18:52     ` Andrew Cagney
2004-06-09 14:12       ` Ulrich Weigand
2004-06-09 14:55         ` Andrew Cagney
2004-06-16 13:48           ` Ulrich Weigand
2004-06-16 17:33             ` Andrew Cagney
2004-06-27 20:48               ` Ulrich Weigand
2004-06-27 21:48                 ` Daniel Jacobowitz
2004-06-27 22:35                   ` Ulrich Weigand
2004-06-27 22:59                   ` Andreas Schwab
2004-06-27 23:11                     ` Daniel Jacobowitz

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