]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Make Dwarf_Frame point to fde record, not cie record.
authorRoland McGrath <roland@redhat.com>
Sat, 28 Mar 2009 23:49:53 +0000 (16:49 -0700)
committerRoland McGrath <roland@redhat.com>
Sat, 28 Mar 2009 23:49:53 +0000 (16:49 -0700)
libdw/dwarf_frame_return_address_register.c
libdw/frame-cache.c
libdw/unwind.c
libdw/unwindP.h

index 0ca38840bb5087ddbb8a5f6cc0d41231238b8398..ef2d7e1127d875e2d7dc643b7d0877729618f4a9 100644 (file)
@@ -1,5 +1,5 @@
 /* Get return address register for frame.
-   Copyright (C) 2006 Red Hat, Inc.
+   Copyright (C) 2006, 2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -58,6 +58,6 @@ dwarf_frame_return_address_register (fs, signalp)
      Dwarf_Frame *fs;
      bool *signalp;
 {
-  *signalp = fs->cie->signal_frame;
-  return fs->cie->return_address_register;
+  *signalp = fs->fde->cie->signal_frame;
+  return fs->fde->cie->return_address_register;
 }
index 784d014d5734d4124b0f95c437eca2a1a05fec64..179870c562b507cd533d1c09443eaca331846ff5 100644 (file)
@@ -61,7 +61,7 @@ free_cie (void *arg)
 {
   struct dwarf_cie *cie = arg;
 
-  free (cie->initial_state);
+  free ((Dwarf_Frame *) cie->initial_state);
   free (cie);
 }
 
index 1328ba74fd29e77e03ec64add7451fe6537f92ea..82380cb1d7673ee164d4a3a56795d67f6ffee855 100644 (file)
@@ -63,7 +63,7 @@
 #define CFI_PRIMARY_MAX        0x3f
 
 static Dwarf_Frame *
-duplicate_frame_state (Dwarf_Frame *original,
+duplicate_frame_state (const Dwarf_Frame *original,
                       Dwarf_Frame *prev)
 {
   size_t size = offsetof (Dwarf_Frame, regs[original->nregs]);
@@ -432,7 +432,6 @@ __libdw_frame_at_address (Dwarf_CFI *cache, struct dwarf_fde *fde,
       /* Now we have the initial state of things that all
         FDEs using this CIE will start from.  */
       cie_fs->cache = cache;
-      cie_fs->cie = fde->cie;
       fde->cie->initial_state = cie_fs;
     }
 
@@ -440,6 +439,8 @@ __libdw_frame_at_address (Dwarf_CFI *cache, struct dwarf_fde *fde,
   if (unlikely (fs == NULL))
     return DWARF_E_NOMEM;
 
+  fs->fde = fde;
+
   int result = execute_cfi (cache, fde->cie, &fs,
                            fde->instructions, fde->instructions_end, false,
                            fde->start, address);
index 893726c9951358f7e7aa1402096b5e7a1f6a036a..b429641970d0f66cc5ca206f60a02eccb1a800c3 100644 (file)
@@ -69,7 +69,7 @@ struct dwarf_cie
   const uint8_t *initial_instructions;
   const uint8_t *initial_instructions_end;
 
-  Dwarf_Frame *initial_state;
+  const Dwarf_Frame *initial_state;
 
   uint8_t fde_encoding;                /* DW_EH_PE_* for addresses in FDEs.  */
   uint8_t lsda_encoding;    /* DW_EH_PE_* for LSDA in FDE augmentation.  */
@@ -178,11 +178,13 @@ struct Dwarf_Frame_s
 {
   Dwarf_CFI *cache;
 
+  /* Previous state saved by DW_CFA_remember_state, or .cie->initial_state,
+     or NULL in an initial_state pseudo-frame.  */
   Dwarf_Frame *prev;
 
-  /* The CIE we got this FDE from.
-     This has the return_address_register and signal_frame flag.  */
-  struct dwarf_cie *cie;
+  /* The FDE that generated this frame state.  This points to its CIE,
+     which has the return_address_register and signal_frame flag.  */
+  struct dwarf_fde *fde;
 
   /* The CFA is unknown, is R+N, or is computed by a DWARF expression.  */
   enum { cfa_undefined, cfa_offset, cfa_expr } cfa_rule;