Patchwork [Ada] fix traceback computation stop condition for ppc-aix

login
register
mail settings
Submitter Arnaud Charlet
Date Aug. 3, 2011, 8:33 a.m.
Message ID <20110803083306.GA30161@adacore.com>
Download mbox | patch
Permalink /patch/108047/
State New
Headers show

Comments

Arnaud Charlet - Aug. 3, 2011, 8:33 a.m.
This change adjusts the traceback stop condition for ppc-aix to stop
at null return addresses, sometimes encountered alone (with the associated
backchain pointer not null) to indicate a toplevel frame. 

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-03  Olivier Hainque  <hainque@adacore.com>

	* tracebak.c (STOP_FRAME ppc AIX): Stop at null return address as well.

Patch

Index: tracebak.c
===================================================================
--- tracebak.c	(revision 176998)
+++ tracebak.c	(working copy)
@@ -219,8 +219,15 @@ 
 
 #define FRAME_OFFSET(FP) 0
 #define PC_ADJUST -4
-#define STOP_FRAME(CURRENT, TOP_STACK) ((void *) (CURRENT) < (TOP_STACK))
 
+/* Eventhough the base PPC ABI states that a toplevel frame entry
+   should to feature a null backchain, AIX might expose a null return
+   address instead.  */
+
+#define STOP_FRAME(CURRENT, TOP_STACK) \
+  (((void *) (CURRENT) < (TOP_STACK)) \
+   || (CURRENT)->return_address == NULL)
+
 /* The PPC ABI has an interesting specificity: the return address saved by a
    function is located in it's caller's frame, and the save operation only
    takes place if the function performs a call.