40
40
#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
43
UNW_OBJ(dwarf_find_debug_frame) (int found, unw_dyn_info_t *di_debug,
46
const char *obj_name, unw_word_t start,
49
#define dwarf_find_debug_frame UNW_OBJ(dwarf_find_debug_frame)
42
51
#define DW_EH_PE_FORMAT_MASK 0x0f /* format of the encoded value */
43
52
#define DW_EH_PE_APPL_MASK 0x70 /* how the value is to be applied */
248
static int read_unwind_spec(struct dso *dso, struct machine *machine,
249
u64 *table_data, u64 *segbase, u64 *fde_count)
257
static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
258
u64 *table_data, u64 *segbase,
251
261
int ret = -EINVAL, fd;
263
274
table_data, segbase,
266
/* TODO .debug_frame check if eh_frame_hdr fails */
280
#ifndef NO_LIBUNWIND_DEBUG_FRAME
281
static int read_unwind_spec_debug_frame(struct dso *dso,
282
struct machine *machine, u64 *offset)
284
int fd = dso__data_fd(dso, machine);
289
/* Check the .debug_frame section for unwinding info */
290
*offset = elf_section_offset(fd, ".debug_frame");
270
300
static struct map *find_map(unw_word_t ip, struct unwind_info *ui)
272
302
struct addr_location al;
292
322
pr_debug("unwind: find_proc_info dso %s\n", map->dso->name);
294
if (read_unwind_spec(map->dso, ui->machine,
295
&table_data, &segbase, &fde_count))
298
memset(&di, 0, sizeof(di));
299
di.format = UNW_INFO_FORMAT_REMOTE_TABLE;
300
di.start_ip = map->start;
301
di.end_ip = map->end;
302
di.u.rti.segbase = map->start + segbase;
303
di.u.rti.table_data = map->start + table_data;
304
di.u.rti.table_len = fde_count * sizeof(struct table_entry)
305
/ sizeof(unw_word_t);
306
return dwarf_search_unwind_table(as, ip, &di, pi,
307
need_unwind_info, arg);
324
/* Check the .eh_frame section for unwinding info */
325
if (!read_unwind_spec_eh_frame(map->dso, ui->machine,
326
&table_data, &segbase, &fde_count)) {
327
memset(&di, 0, sizeof(di));
328
di.format = UNW_INFO_FORMAT_REMOTE_TABLE;
329
di.start_ip = map->start;
330
di.end_ip = map->end;
331
di.u.rti.segbase = map->start + segbase;
332
di.u.rti.table_data = map->start + table_data;
333
di.u.rti.table_len = fde_count * sizeof(struct table_entry)
334
/ sizeof(unw_word_t);
335
return dwarf_search_unwind_table(as, ip, &di, pi,
336
need_unwind_info, arg);
339
#ifndef NO_LIBUNWIND_DEBUG_FRAME
340
/* Check the .debug_frame section for unwinding info */
341
if (!read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
342
memset(&di, 0, sizeof(di));
343
dwarf_find_debug_frame(0, &di, ip, 0, map->dso->name,
344
map->start, map->end);
345
return dwarf_search_unwind_table(as, ip, &di, pi,
346
need_unwind_info, arg);
310
353
static int access_fpreg(unw_addr_space_t __maybe_unused as,
546
589
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
547
590
struct machine *machine, struct thread *thread,
548
u64 sample_uregs, struct perf_sample *data)
591
u64 sample_uregs, struct perf_sample *data,
551
595
struct unwind_info ui = {