summaryrefslogtreecommitdiffstats
path: root/libdw/cfi.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2010-06-16 03:40:56 -0700
committerRoland McGrath <[email protected]>2010-06-16 11:16:45 -0700
commit3e4b5bbeca8987527c11a1ea048459a7ebd4ab5e (patch)
tree3d50b9a1c32c4c41eac398d9d6bd91b16e26c858 /libdw/cfi.c
parent5f4b5089e1e3ca3c696cb420a6e215006691cf95 (diff)
Add new dwarf_cfi_validate_fde call.
Diffstat (limited to 'libdw/cfi.c')
-rw-r--r--libdw/cfi.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libdw/cfi.c b/libdw/cfi.c
index aeb48e69..e49335dd 100644
--- a/libdw/cfi.c
+++ b/libdw/cfi.c
@@ -504,3 +504,42 @@ __libdw_frame_at_address (Dwarf_CFI *cache, struct dwarf_fde *fde,
}
return result;
}
+
+int
+dwarf_cfi_validate_fde (cache, offset, start, end, signalp, encoding)
+ Dwarf_CFI *cache;
+ Dwarf_Off offset;
+ Dwarf_Addr *start;
+ Dwarf_Addr *end;
+ bool *signalp;
+ uint8_t *encoding;
+{
+ if (cache == NULL)
+ return -1;
+
+ struct dwarf_fde *fde = __libdw_fde_by_offset (cache, offset);
+ if (unlikely (fde == NULL))
+ return -1;
+
+ Dwarf_Frame *fs;
+ int result = __libdw_frame_at_address (cache, fde, fde->end, &fs);
+ if (unlikely (result != DWARF_E_NOERROR))
+ {
+ __libdw_seterrno (result);
+ return -1;
+ }
+
+ result = fs->nregs + 1;
+ free (fs);
+
+ if (start != NULL)
+ *start = fde->start;
+ if (end != NULL)
+ *end = fde->end;
+ if (signalp != NULL)
+ *signalp = fde->cie->signal_frame;
+ if (encoding != NULL)
+ *encoding = fde->cie->fde_encoding;
+
+ return result;
+}