From: Roland McGrath Date: Sat, 28 Mar 2009 23:49:53 +0000 (-0700) Subject: Make Dwarf_Frame point to fde record, not cie record. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49ff43d083757e05c86eea25971124fb7b44f302;p=thirdparty%2Felfutils.git Make Dwarf_Frame point to fde record, not cie record. --- diff --git a/libdw/dwarf_frame_return_address_register.c b/libdw/dwarf_frame_return_address_register.c index 0ca38840b..ef2d7e112 100644 --- a/libdw/dwarf_frame_return_address_register.c +++ b/libdw/dwarf_frame_return_address_register.c @@ -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; } diff --git a/libdw/frame-cache.c b/libdw/frame-cache.c index 784d014d5..179870c56 100644 --- a/libdw/frame-cache.c +++ b/libdw/frame-cache.c @@ -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); } diff --git a/libdw/unwind.c b/libdw/unwind.c index 1328ba74f..82380cb1d 100644 --- a/libdw/unwind.c +++ b/libdw/unwind.c @@ -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); diff --git a/libdw/unwindP.h b/libdw/unwindP.h index 893726c99..b42964197 100644 --- a/libdw/unwindP.h +++ b/libdw/unwindP.h @@ -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;