[Ada] Adjust traceback data stored for the pc symbolizer on alpha-vms

Arnaud Charlet charlet@adacore.com
Wed Dec 19 17:54:00 GMT 2007


Tested on i686-linux, committed on trunk

The VMS service we use to symbolize a callstack traceback entry is
advertized as expecting a PC and a frame pointer to identify an
invocation and we were honoring this.

Expectedly, this only works for live invocations, which represents
a fairly severe restriction on the possible uses of this service.

We are switching back to providing a procedure value instead of a frame
pointer to circumvent this limitation, and will rely on a vms service
accepting that instead.

2007-12-19  Olivier Hainque  <hainque@adacore.com>

	* tb-alvms.c (struct tb_entry_t, __gnat_backtrace): Revert back to use
	of Procedure Value instead of Frame Pointer as the invocation
	identifier associated with the instruction pointer in each traceback
	entry.

	* g-trasym-vms-alpha.adb (Traceback_Entry, PV_For, FP_For,
	TB_Entry_For): Revert back to use of Procedure Value instead of Frame
	Pointer as the invocation identifier passed to tbk$symbolize.

	* s-traent-vms.ads, s-traent-vms.adb
	(Traceback_Entry, PV_For, FP_For, TB_Entry_For): Revert back to use of
	Procedure Value instead of Frame Pointer as the invocation identifier
	passed to tbk$symbolize.

-------------- next part --------------
Index: tb-alvms.c
===================================================================
--- tb-alvms.c	(revision 130811)
+++ tb-alvms.c	(working copy)
@@ -337,8 +337,8 @@ unwind_kernel_handler (frame_state_t * f
    system functions need more than just a mere PC to compute info on a frame
    (e.g. for non-symbolic->symbolic translation purposes).  */
 typedef struct {
-  ADDR pc; /* instruction pointer */
-  ADDR fp; /* frame pointer */
+  ADDR pc;  /* Program Counter.  */
+  ADDR pv;  /* Procedure Value.  */
 } tb_entry_t;
 
 /********************
@@ -383,7 +383,7 @@ __gnat_backtrace (void **array, int size
 	  && (frame_state.pc < exclude_min || frame_state.pc > exclude_max))
 	{
 	  tbe->pc = (ADDR) frame_state.pc;
-	  tbe->fp = (ADDR) frame_state.fp;
+	  tbe->pv = (ADDR) PV_FOR (frame_state.fp);
 
 	  cnt ++;
 	  tbe ++;
Index: g-trasym-vms-alpha.adb
===================================================================
--- g-trasym-vms-alpha.adb	(revision 130811)
+++ g-trasym-vms-alpha.adb	(working copy)
@@ -229,7 +229,7 @@ package body GNAT.Traceback.Symbolic is
               (Status,
                PC_For (Traceback (J)),
                PC_For (Traceback (J)),
-               FP_For (Traceback (J)),
+               PV_For (Traceback (J)),
                Return_Address,
                Image_Name_Addr,
                Module_Name_Addr,
Index: s-traent-vms.ads
===================================================================
--- s-traent-vms.ads	(revision 130811)
+++ s-traent-vms.ads	(working copy)
@@ -40,22 +40,22 @@
 package System.Traceback_Entries is
    pragma Preelaborate;
 
-   --  Symbolization is done by a VMS service which requires an instruction
-   --  and a frame pointer for each traceback entry.
+   --  Symbolization is performed by a VMS service which requires more
+   --  than an instruction pointer.
 
    type Traceback_Entry is record
-      PC : System.Address;
-      FP : System.Address;
+      PC : System.Address;  --  Program Counter
+      PV : System.Address;  --  Procedure Value
    end record;
 
    pragma Suppress_Initialization (Traceback_Entry);
 
    Null_TB_Entry : constant Traceback_Entry :=
                      (PC => System.Null_Address,
-                      FP => System.Null_Address);
+                      PV => System.Null_Address);
 
    function PC_For (TB_Entry : Traceback_Entry) return System.Address;
-   function FP_For (TB_Entry : Traceback_Entry) return System.Address;
+   function PV_For (TB_Entry : Traceback_Entry) return System.Address;
 
    function TB_Entry_For (PC : System.Address) return Traceback_Entry;
 
Index: s-traent-vms.adb
===================================================================
--- s-traent-vms.adb	(revision 130811)
+++ s-traent-vms.adb	(working copy)
@@ -43,13 +43,13 @@ package body System.Traceback_Entries is
    end PC_For;
 
    ------------
-   -- FP_For --
+   -- PV_For --
    ------------
 
-   function FP_For (TB_Entry : Traceback_Entry) return System.Address is
+   function PV_For (TB_Entry : Traceback_Entry) return System.Address is
    begin
-      return TB_Entry.FP;
-   end FP_For;
+      return TB_Entry.PV;
+   end PV_For;
 
    ------------------
    -- TB_Entry_For --
@@ -57,7 +57,7 @@ package body System.Traceback_Entries is
 
    function TB_Entry_For (PC : System.Address) return Traceback_Entry is
    begin
-      return (PC => PC, FP => System.Null_Address);
+      return (PC => PC, PV => System.Null_Address);
    end TB_Entry_For;
 
 end System.Traceback_Entries;


More information about the Gcc-patches mailing list