Lines Matching +full:file +full:- +full:entry +full:- +full:cache
2 Copyright (C) 2009-2010, 2014, 2015 Red Hat, Inc.
3 This file is part of elfutils.
5 This file is free software; you can redistribute it and/or modify
37 #include "encoded-value.h"
47 if (fde1->end == 0) in compare_fde()
49 if (fde1->start < fde2->start) in compare_fde()
50 return -1; in compare_fde()
51 if (fde1->start >= fde2->end) in compare_fde()
56 if (fde2->start < fde1->start) in compare_fde()
58 if (fde2->start >= fde1->end) in compare_fde()
59 return -1; in compare_fde()
66 intern_fde (Dwarf_CFI *cache, const Dwarf_FDE *entry) in intern_fde() argument
68 /* Look up the new entry's CIE. */ in intern_fde()
69 struct dwarf_cie *cie = __libdw_find_cie (cache, entry->CIE_pointer); in intern_fde()
71 return (void *) -1l; in intern_fde()
80 fde->instructions = entry->start; in intern_fde()
81 fde->instructions_end = entry->end; in intern_fde()
82 if (unlikely (read_encoded_value (cache, cie->fde_encoding, in intern_fde()
83 &fde->instructions, &fde->start)) in intern_fde()
84 || unlikely (read_encoded_value (cache, cie->fde_encoding & 0x0f, in intern_fde()
85 &fde->instructions, &fde->end))) in intern_fde()
91 fde->end += fde->start; in intern_fde()
94 if (fde->start >= fde->end) in intern_fde()
97 return (void *) -1; in intern_fde()
100 fde->cie = cie; in intern_fde()
102 if (cie->sized_augmentation_data) in intern_fde()
107 if (fde->instructions >= fde->instructions_end) in intern_fde()
109 get_uleb128 (len, fde->instructions, fde->instructions_end); in intern_fde()
110 if ((Dwarf_Word) (fde->instructions_end - fde->instructions) < len) in intern_fde()
117 fde->instructions += len; in intern_fde()
122 fde->instructions += cie->fde_augmentation_data_size; in intern_fde()
124 /* Add the new entry to the search tree. */ in intern_fde()
125 struct dwarf_fde **tres = tsearch (fde, &cache->fde_tree, &compare_fde); in intern_fde()
134 /* There is already an FDE in the cache that covers the same in intern_fde()
136 the one in the cache for consistency. */ in intern_fde()
146 __libdw_fde_by_offset (Dwarf_CFI *cache, Dwarf_Off offset) in __libdw_fde_by_offset() argument
148 Dwarf_CFI_Entry entry; in __libdw_fde_by_offset() local
150 int result = INTUSE(dwarf_next_cfi) (cache->e_ident, in __libdw_fde_by_offset()
151 &cache->data->d, CFI_IS_EH (cache), in __libdw_fde_by_offset()
152 offset, &next_offset, &entry); in __libdw_fde_by_offset()
161 if (unlikely (dwarf_cfi_cie_p (&entry))) in __libdw_fde_by_offset()
165 struct dwarf_fde *fde = intern_fde (cache, &entry.fde); in __libdw_fde_by_offset()
166 if (fde == (void *) -1l || fde == NULL) in __libdw_fde_by_offset()
170 if (cache->next_offset == offset) in __libdw_fde_by_offset()
171 cache->next_offset = next_offset; in __libdw_fde_by_offset()
178 binary_search_fde (Dwarf_CFI *cache, Dwarf_Addr address) in binary_search_fde() argument
180 const size_t size = 2 * encoded_value_size (&cache->data->d, cache->e_ident, in binary_search_fde()
181 cache->search_table_encoding, in binary_search_fde()
184 return (Dwarf_Off) -1l; in binary_search_fde()
189 .d = { .d_buf = (void *) cache->search_table, in binary_search_fde()
190 .d_size = cache->search_table_len } in binary_search_fde()
195 .e_ident = cache->e_ident, in binary_search_fde()
196 .datarel = cache->search_table_vaddr, in binary_search_fde()
197 .frame_vaddr = cache->search_table_vaddr, in binary_search_fde()
201 size_t l = 0, u = cache->search_table_entries; in binary_search_fde()
208 const uint8_t *p = &cache->search_table[idx * size]; in binary_search_fde()
211 cache->search_table_encoding, &p, in binary_search_fde()
222 cache->search_table_encoding, &p, in binary_search_fde()
226 /* If this is the last entry, its upper bound is assumed to be in binary_search_fde()
229 if (l < cache->search_table_entries) in binary_search_fde()
231 /* Look at the start address in the following entry. */ in binary_search_fde()
234 (&dummy_cfi, cache->search_table_encoding, &p, in binary_search_fde()
241 return fde - cache->frame_vaddr; in binary_search_fde()
245 return (Dwarf_Off) -1l; in binary_search_fde()
250 __libdw_find_fde (Dwarf_CFI *cache, Dwarf_Addr address) in __libdw_find_fde() argument
255 struct dwarf_fde **found = tfind (&fde_key, &cache->fde_tree, &compare_fde); in __libdw_find_fde()
260 if (cache->search_table != NULL) in __libdw_find_fde()
262 Dwarf_Off offset = binary_search_fde (cache, address); in __libdw_find_fde()
263 if (offset == (Dwarf_Off) -1l) in __libdw_find_fde()
265 struct dwarf_fde *fde = __libdw_fde_by_offset (cache, offset); in __libdw_find_fde()
269 if (unlikely (address < fde->start)) in __libdw_find_fde()
275 if (unlikely (address >= fde->end)) in __libdw_find_fde()
284 Dwarf_Off last_offset = cache->next_offset; in __libdw_find_fde()
285 Dwarf_CFI_Entry entry; in __libdw_find_fde() local
286 int result = INTUSE(dwarf_next_cfi) (cache->e_ident, in __libdw_find_fde()
287 &cache->data->d, CFI_IS_EH (cache), in __libdw_find_fde()
288 last_offset, &cache->next_offset, in __libdw_find_fde()
289 &entry); in __libdw_find_fde()
294 if (cache->next_offset == last_offset) in __libdw_find_fde()
297 /* Skip the loser and look at the next entry. */ in __libdw_find_fde()
301 if (dwarf_cfi_cie_p (&entry)) in __libdw_find_fde()
305 __libdw_intern_cie (cache, last_offset, &entry.cie); in __libdw_find_fde()
310 struct dwarf_fde *fde = intern_fde (cache, &entry.fde); in __libdw_find_fde()
312 if (fde == (void *) -1l) /* Bad FDE, but we can keep looking. */ in __libdw_find_fde()
319 if (fde->start <= address && fde->end > address) in __libdw_find_fde()