380#if !defined(HAVE_DECL_STRNLEN) || !HAVE_DECL_STRNLEN
389 for (i = 0; i < maxlen; ++i)
395#define strnlen xstrnlen
751 snprintf (b,
sizeof b,
"%s in %s at %d",
792 const char *p = (
const char *)buf->
buf;
798 size_t count = len + 1;
811 const unsigned char *p = buf->
buf;
823 const unsigned char *p = buf->
buf;
827 return (*p ^ 0x80) - 0x80;
835 const unsigned char *p = buf->
buf;
850 const unsigned char *p = buf->
buf;
867 const unsigned char *p = buf->
buf;
884 const unsigned char *p = buf->
buf;
889 return (((uint64_t) p[0] << 56) | ((uint64_t) p[1] << 48)
890 | ((uint64_t) p[2] << 40) | ((uint64_t) p[3] << 32)
891 | ((uint64_t) p[4] << 24) | ((uint64_t) p[5] << 16)
892 | ((uint64_t) p[6] << 8) | (uint64_t) p[7]);
894 return (((uint64_t) p[7] << 56) | ((uint64_t) p[6] << 48)
895 | ((uint64_t) p[5] << 40) | ((uint64_t) p[4] << 32)
896 | ((uint64_t) p[3] << 24) | ((uint64_t) p[2] << 16)
897 | ((uint64_t) p[1] << 8) | (uint64_t) p[0]);
943 return address == (
unsigned char) -1;
949 return address == (uint64_t) -1;
970 const unsigned char *p;
977 ret |= ((uint64_t) (b & 0x7f)) << shift;
985 while ((b & 0x80) != 0);
1005 const unsigned char *p;
1012 val |= ((uint64_t) (b & 0x7f)) << shift;
1020 while ((b & 0x80) != 0);
1022 if ((b & 0x40) != 0 && shift < 64)
1023 val |= ((uint64_t) -1) << shift;
1025 return (int64_t) val;
1036 while ((*p & 0x80) != 0)
1052 if (len == 0xffffffff)
1089 struct dwarf_buf *buf,
int is_dwarf64,
int version,
1097 memset (val, 0,
sizeof *val);
1129 return val->
u.string == NULL ? 0 : 1;
1217 "DW_FORM_indirect to DW_FORM_implicit_const",
1267 val->
u.uint = offset;
1297 val->
u.uint = offset;
1310 val->
u.uint = implicit_val;
1332 if (altlink == NULL)
1344 if (altlink == NULL)
1373 int is_bigendian, uint64_t str_offsets_base,
1376 const char **
string)
1381 *
string = val->
u.string;
1389 offset = val->
u.uint * (is_dwarf64 ? 8 : 4) + str_offsets_base;
1390 if (offset + (is_dwarf64 ? 8 : 4)
1397 offset_buf.
name =
".debug_str_offsets";
1410 "DW_FORM_strx offset out of range",
1429 uint64_t addr_index,
1436 offset = addr_index * addrsize + addr_base;
1443 addr_buf.
name =
".debug_addr";
1452 *address = (uintptr_t)
read_address (&addr_buf, addrsize);
1461 const size_t *key = (
const size_t *) vkey;
1462 const struct unit *entry = *((
const struct unit *
const *) ventry);
1480 u = bsearch (&offset, pu, units_count,
sizeof (
struct unit *),
units_search);
1481 return u == NULL ? NULL : *u;
1513 const uintptr_t *key = (
const uintptr_t *) vkey;
1518 if (pc < entry->
low)
1520 else if (pc > (entry + 1)->low)
1531 uintptr_t lowpc, uintptr_t highpc,
1535 struct unit *u = (
struct unit *) rdata;
1543 if ((lowpc == p->
high || lowpc == p->
high + 1)
1546 if (highpc > p->
high)
1600 const uintptr_t *key = (
const uintptr_t *) vkey;
1605 if (pc < entry->
low)
1607 else if (pc > (entry + 1)->low)
1618 size_t *pfrom,
size_t *pto,
1632 old_count = old_vec->
count;
1635 for (from = *pfrom, to = *pto; from < old_count; from++, to++)
1640 if (enclosing != NULL
1641 && enclosing->
high <= old_addrs[from].
low)
1648 new_addrs[to] = old_addrs[from];
1656 if (enclosing != NULL
1657 && enclosing->
high > old_addrs[from].
high
1658 && old_addrs[from].
high < old_addrs[from + 1].
low)
1669 new_addrs[to].
low = old_addrs[from].
high;
1670 new_high = old_addrs[from + 1].
low;
1671 if (enclosing->
high < new_high)
1672 new_high = enclosing->
high;
1673 new_addrs[to].
high = new_high;
1674 new_addrs[to].
u = enclosing->
u;
1680 if (old_addrs[from].
high > old_addrs[from + 1].
high)
1685 &old_addrs[from], old_vec,
1697 if (enclosing == NULL)
1713 new_vec->
count = to;
1771 for (i = 0; i <
count - 1; i++)
1773 if (entry->
low < (entry + 1)->low
1774 && entry->
high > (entry + 1)->high)
1784 memset (&new_vec, 0,
sizeof new_vec);
1796 *addrs_vec = new_vec;
1809 const struct line *ln1 = (
const struct line *) v1;
1810 const struct line *ln2 = (
const struct line *) v2;
1812 if (ln1->
pc < ln2->
pc)
1814 else if (ln1->
pc > ln2->
pc)
1816 else if (ln1->
idx < ln2->
idx)
1818 else if (ln1->
idx > ln2->
idx)
1832 const uintptr_t *key = (
const uintptr_t *) vkey;
1833 const struct line *entry = (
const struct line *) ventry;
1839 else if (
pc >= (entry + 1)->pc)
1872 const unsigned char *dwarf_abbrev,
size_t dwarf_abbrev_size,
1883 if (abbrev_offset >= dwarf_abbrev_size)
1889 abbrev_buf.
name =
".debug_abbrev";
1890 abbrev_buf.
start = dwarf_abbrev;
1891 abbrev_buf.
buf = dwarf_abbrev + abbrev_offset;
1892 abbrev_buf.
left = dwarf_abbrev_size - abbrev_offset;
1900 count_buf = abbrev_buf;
1927 if (num_abbrevs == 0)
1932 num_abbrevs *
sizeof (
struct abbrev),
1958 count_buf = abbrev_buf;
1978 attrs = ((
struct attr *)
1998 attrs[num_attrs].val = 0;
2022static const struct abbrev *
2036 memset (&key, 0,
sizeof key);
2045 return (
const struct abbrev *) p;
2136 int is_bigendian,
struct unit *u,
2139 void *rdata, uintptr_t lowpc,
2142 void *
data,
void *vec),
2189 uintptr_t lowpc, uintptr_t highpc,
2204 ranges_buf.
name =
".debug_ranges";
2224 if (low == 0 && high == 0)
2228 base = (uintptr_t) high;
2257 uintptr_t lowpc, uintptr_t highpc,
2277 rnglists_buf.
name =
".debug_rnglists";
2336 if (!add_range (
state, rdata,
2357 if (!add_range (
state, rdata, low, low + length,
2370 if (!add_range (
state, rdata,
2389 if (!add_range (
state, rdata,
2405 if (!add_range (
state, rdata, low, low + length,
2435 uintptr_t lowpc, uintptr_t highpc,
2437 void *
data,
void *vec),
2477 while (unit_buf->
left > 0)
2485 int have_comp_dir_val;
2496 if (unit_tag != NULL)
2500 memset (&name_val, 0,
sizeof name_val);
2502 memset (&comp_dir_val, 0,
sizeof comp_dir_val);
2503 have_comp_dir_val = 0;
2509 unit_buf,
u->is_dwarf64,
u->version,
2524 u->lineoff = val.
u.uint;
2541 have_comp_dir_val = 1;
2549 u->str_offsets_base = val.
u.uint;
2556 u->addr_base = val.
u.uint;
2563 u->rnglists_base = val.
u.uint;
2576 u->str_offsets_base, &name_val,
2580 if (have_comp_dir_val)
2583 u->str_offsets_base, &comp_dir_val,
2627 int is_bigendian,
struct dwarf_data *altlink,
2637 size_t unit_offset = 0;
2640 memset (&addrs->
vec, 0,
sizeof addrs->
vec);
2641 memset (&unit_vec->
vec, 0,
sizeof unit_vec->
vec);
2643 unit_vec->
count = 0;
2649 info.name =
".debug_info";
2653 info.is_bigendian = is_bigendian;
2656 info.reported_underflow = 0;
2658 memset (&units, 0,
sizeof units);
2661 while (
info.left > 0)
2663 const unsigned char *unit_data_start;
2669 uint64_t abbrev_offset;
2674 if (
info.reported_underflow)
2677 unit_data_start =
info.buf;
2681 unit_buf.
left = len;
2687 if (version < 2 || version > 5)
2705 pu = ((
struct unit **)
2711 u = ((
struct unit *)
2773 u, addrs, &unit_tag))
2779 if (
info.reported_underflow)
2793 unit_vec->
vec = units;
2794 unit_vec->
count = units_count;
2798 if (units_count > 0)
2801 for (i = 0; i < units_count; i++)
2808 if (addrs->
count > 0)
2821 uintptr_t pc,
const char *
filename,
int lineno,
2836 ln = ((
struct line *)
2876 const unsigned char *p;
2877 const unsigned char *pend;
2883 pend = p + hdr_buf->
left;
2884 while (p < pend && *p !=
'\0')
2886 p +=
strnlen((
const char *) p, pend - p) + 1;
2894 hdr->
dirs = ((
const char **)
2899 if (hdr->
dirs == NULL)
2904 while (*hdr_buf->
buf !=
'\0')
2910 if (hdr->
dirs[i] == NULL)
2920 pend = p + hdr_buf->
left;
2921 while (p < pend && *p !=
'\0')
2923 p +=
strnlen ((
const char *) p, pend - p) + 1;
2943 while (*hdr_buf->
buf !=
'\0')
2956 || (dir_index < hdr->dirs_count && hdr->
dirs[dir_index] == NULL))
2962 size_t filename_len;
2965 if (dir_index < hdr->dirs_count)
2966 dir = hdr->
dirs[dir_index];
2970 (
"invalid directory index in "
2971 "line number program header"),
2975 dir_len = strlen (dir);
2982 memcpy (s, dir, dir_len);
2987 memcpy (s + dir_len + 1,
filename, filename_len + 1);
3008 const struct line_header *hdr,
size_t formats_count,
3017 for (i = 0; i < formats_count; i++)
3025 switch (formats[i].lnct)
3040 (
"invalid directory index in "
3041 "line number program header"),
3045 dir = hdr->
dirs[val.
u.uint];
3057 "missing file name in line number program header",
3070 dir_len = strlen (dir);
3071 path_len = strlen (path);
3076 memcpy (s, dir, dir_len);
3081 memcpy (s + dir_len + 1, path, path_len + 1);
3098 const char ***ppaths)
3100 size_t formats_count;
3108 if (formats_count == 0)
3118 if (formats == NULL)
3121 for (i = 0; i < formats_count; i++)
3129 if (paths_count == 0)
3137 paths = ((
const char **)
3145 for (i = 0; i < paths_count; i++)
3148 formats, &paths[i]))
3151 paths_count *
sizeof (
const char *),
3158 *pcount = paths_count;
3164 if (formats != NULL)
3199 "non-zero segment_selector_size not supported",
3207 hdr_buf = *line_buf;
3208 hdr_buf.
left = hdrlen;
3210 if (!
advance (line_buf, hdrlen))
3262 unsigned int op_index;
3263 const char *reset_filename;
3264 const char *filename;
3272 reset_filename =
"";
3273 filename = reset_filename;
3275 while (line_buf->
left > 0)
3308 filename = reset_filename;
3317 unsigned int dir_index;
3335 if (dir_index < hdr->dirs_count)
3336 dir = hdr->
dirs[dir_index];
3340 (
"invalid directory index "
3341 "in line number program"),
3345 dir_len = strlen (dir);
3353 memcpy (p, dir, dir_len);
3359 memcpy (p + dir_len + 1, f, f_len + 1);
3369 if (!
advance (line_buf, len - 1))
3403 (
"invalid file number in "
3404 "line number program"),
3462 size_t *lines_count)
3470 memset (&vec.
vec, 0,
sizeof vec.
vec);
3473 memset (hdr, 0,
sizeof *hdr);
3482 line_buf.
name =
".debug_line";
3492 line_buf.
left = len;
3512 ln = ((
struct line *)
3517 ln->
pc = (uintptr_t) -1;
3529 *lines_count = vec.
count;
3536 *lines = (
struct line *) (uintptr_t) -1;
3583 struct unit *alt_unit
3586 if (alt_unit == NULL)
3589 uint64_t offset = val->
u.uint - alt_unit->
low_offset;
3616 if (offset < u->unit_data_offset
3620 "abstract origin or specification out of range",
3627 unit_buf.
name =
".debug_info";
3640 "invalid abstract origin or specification",
3655 &unit_buf,
u->is_dwarf64,
u->version,
u->addrsize,
3715 uintptr_t lowpc, uintptr_t highpc,
3726 if ((lowpc == p->
high || lowpc == p->
high + 1)
3729 if (highpc > p->
high)
3761 while (unit_buf->
left > 0)
3770 int have_linkage_name;
3801 have_linkage_name = 0;
3807 unit_buf,
u->is_dwarf64,
u->version,
3819 base = (uintptr_t) val.
u.uint;
3823 u->addr_base,
u->addrsize,
3840 (
"invalid file number in "
3841 "DW_AT_call_file attribute"),
3858 if (have_linkage_name)
3878 u->str_offsets_base, &val,
3892 u->str_offsets_base, &val,
3898 have_linkage_name = 1;
3958 memset (&fvec, 0,
sizeof fvec);
4012 size_t *ret_addrs_count)
4026 memset (&lvec, 0,
sizeof lvec);
4030 unit_buf.
name =
".debug_info";
4039 while (unit_buf.
left > 0)
4046 if (pfvec->
count == 0)
4061 addrs_count = pfvec->
count;
4085 *ret_addrs_count = addrs_count;
4095 const char **filename,
int *lineno)
4123 while (pc == (p + 1)->low)
4135 if ((p - 1)->low < p->
low)
4153 ret = callback (
data, pc, *filename, *lineno, inlined->
name);
4185 const char *filename;
4210 while (pc == (entry + 1)->low)
4215 if (pc < entry->high)
4220 if (entry == ddata->
addrs)
4222 if ((entry - 1)->low < entry->
low)
4244 while (entry > ddata->
addrs
4245 && pc >= (entry - 1)->
low
4246 && pc < (entry - 1)->high)
4248 if (
state->threaded)
4251 if (lines != (
struct line *) (uintptr_t) -1)
4260 if (
state->threaded)
4267 size_t function_addrs_count;
4275 function_addrs_count = 0;
4283 if (
state->threaded)
4286 pfvec = &ddata->
fvec;
4289 &function_addrs_count);
4301 if (!
state->threaded)
4313 function_addrs_count);
4320 if (lines == (
struct line *) (uintptr_t) -1)
4328 return callback (
data, pc, NULL, 0, NULL);
4351 size_t filename_len;
4358 dir_len = strlen (dir);
4366 memcpy (s, dir, dir_len);
4369 memcpy (s + dir_len + 1,
filename, filename_len + 1);
4396 while (pc == (p + 1)->
low)
4408 if ((p - 1)->low < p->
low)
4421 &filename, &lineno);
4441 if (!
state->threaded)
4445 ddata = ddata->
next)
4449 if (ret != 0 || found)
4466 if (ret != 0 || found)
4475 return callback (
data, pc, NULL, 0, NULL);
4526 memset (&fdata->
fvec, 0,
sizeof fdata->
fvec);
4552 if (fileline_entry != NULL)
4553 *fileline_entry = fdata;
4555 if (!
state->threaded)
void * backtrace_vector_grow(struct backtrace_state *state ATTRIBUTE_UNUSED, size_t size, backtrace_error_callback error_callback, void *data, struct backtrace_vector *vec)
int backtrace_vector_release(struct backtrace_state *state ATTRIBUTE_UNUSED, struct backtrace_vector *vec, backtrace_error_callback error_callback, void *data)
void * backtrace_alloc(struct backtrace_state *state ATTRIBUTE_UNUSED, size_t size, backtrace_error_callback error_callback, void *data)
void backtrace_free(struct backtrace_state *state ATTRIBUTE_UNUSED, void *p, size_t size ATTRIBUTE_UNUSED, backtrace_error_callback error_callback ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED)
void * backtrace_vector_finish(struct backtrace_state *state, struct backtrace_vector *vec, backtrace_error_callback error_callback, void *data)
void(* backtrace_error_callback)(void *data, const char *msg, int errnum)
int(* backtrace_full_callback)(void *data, uintptr_t pc, const char *filename, int lineno, const char *function)
static void error_callback(void *data, const char *msg, int errnum)
struct backtrace_vector vec
static int resolve_unit_addrs_overlap(struct backtrace_state *state, backtrace_error_callback error_callback, void *data, struct unit_addrs_vector *addrs_vec)
static int resolve_string(const struct dwarf_sections *dwarf_sections, int is_dwarf64, int is_bigendian, uint64_t str_offsets_base, const struct attr_val *val, backtrace_error_callback error_callback, void *data, const char **string)
static int add_function_range(struct backtrace_state *state, void *rdata, uintptr_t lowpc, uintptr_t highpc, backtrace_error_callback error_callback, void *data, void *pvec)
const unsigned char * opcode_lengths
static int is_highest_address(uint64_t address, int addrsize)
static int read_v2_paths(struct backtrace_state *state, struct unit *u, struct dwarf_buf *hdr_buf, struct line_header *hdr)
const unsigned char * start
static uint64_t read_uleb128(struct dwarf_buf *buf)
static int require(struct dwarf_buf *buf, size_t count)
static int read_line_header_format_entries(struct backtrace_state *state, struct dwarf_data *ddata, struct unit *u, struct dwarf_buf *hdr_buf, struct line_header *hdr, size_t *pcount, const char ***ppaths)
static size_t leb128_len(const unsigned char *p)
@ DW_LNS_set_epilogue_begin
@ DW_LNS_fixed_advance_pc
@ DW_LNS_set_prologue_end
static struct unit * find_unit(struct unit **pu, size_t units_count, size_t offset)
static const char * read_referenced_name(struct dwarf_data *, struct unit *, uint64_t, backtrace_error_callback, void *)
static int report_inlined_functions(uintptr_t pc, struct function *function, backtrace_full_callback callback, void *data, const char **filename, int *lineno)
struct backtrace_vector vec
static int read_function_entry(struct backtrace_state *state, struct dwarf_data *ddata, struct unit *u, uintptr_t base, struct dwarf_buf *unit_buf, const struct line_header *lhdr, backtrace_error_callback error_callback, void *data, struct function_vector *vec_function, struct function_vector *vec_inlined)
static size_t xstrnlen(const char *s, size_t maxlen)
static void update_pcrange(const struct attr *attr, const struct attr_val *val, struct pcrange *pcrange)
backtrace_error_callback error_callback
static void free_line_header(struct backtrace_state *state, struct line_header *hdr, backtrace_error_callback error_callback, void *data)
struct dwarf_sections dwarf_sections
static void read_function_info(struct backtrace_state *state, struct dwarf_data *ddata, const struct line_header *lhdr, backtrace_error_callback error_callback, void *data, struct unit *u, struct function_vector *fvec, struct function_addrs **ret_addrs, size_t *ret_addrs_count)
static int read_line_header(struct backtrace_state *state, struct dwarf_data *ddata, struct unit *u, int is_dwarf64, struct dwarf_buf *line_buf, struct line_header *hdr)
static int abbrev_compare(const void *v1, const void *v2)
int backtrace_dwarf_add(struct backtrace_state *state, struct libbacktrace_base_address base_address, const struct dwarf_sections *dwarf_sections, int is_bigendian, struct dwarf_data *fileline_altlink, backtrace_error_callback error_callback, void *data, fileline *fileline_fn, struct dwarf_data **fileline_entry)
static int function_addrs_search(const void *vkey, const void *ventry)
static int add_ranges_from_rnglists(struct backtrace_state *state, const struct dwarf_sections *dwarf_sections, struct libbacktrace_base_address base_address, int is_bigendian, struct unit *u, uintptr_t base, const struct pcrange *pcrange, int(*add_range)(struct backtrace_state *state, void *rdata, uintptr_t lowpc, uintptr_t highpc, backtrace_error_callback error_callback, void *data, void *vec), void *rdata, backtrace_error_callback error_callback, void *data, void *vec)
static int build_address_map(struct backtrace_state *state, struct libbacktrace_base_address base_address, const struct dwarf_sections *dwarf_sections, int is_bigendian, struct dwarf_data *altlink, backtrace_error_callback error_callback, void *data, struct unit_addrs_vector *addrs, struct unit_vector *unit_vec)
static uint16_t read_uint16(struct dwarf_buf *buf)
static int find_address_ranges(struct backtrace_state *state, struct libbacktrace_base_address base_address, struct dwarf_buf *unit_buf, const struct dwarf_sections *dwarf_sections, int is_bigendian, struct dwarf_data *altlink, backtrace_error_callback error_callback, void *data, struct unit *u, struct unit_addrs_vector *addrs, enum dwarf_tag *unit_tag)
const char * caller_filename
static int add_ranges_from_ranges(struct backtrace_state *state, const struct dwarf_sections *dwarf_sections, struct libbacktrace_base_address base_address, int is_bigendian, struct unit *u, uintptr_t base, const struct pcrange *pcrange, int(*add_range)(struct backtrace_state *state, void *rdata, uintptr_t lowpc, uintptr_t highpc, backtrace_error_callback error_callback, void *data, void *vec), void *rdata, backtrace_error_callback error_callback, void *data, void *vec)
enum attr_val_encoding encoding
const char * abs_filename
size_t function_addrs_count
static const char * read_referenced_name_from_attr(struct dwarf_data *ddata, struct unit *u, struct attr *attr, struct attr_val *val, backtrace_error_callback error_callback, void *data)
static int read_abbrevs(struct backtrace_state *state, uint64_t abbrev_offset, const unsigned char *dwarf_abbrev, size_t dwarf_abbrev_size, int is_bigendian, backtrace_error_callback error_callback, void *data, struct abbrevs *abbrevs)
static int dwarf_fileline(struct backtrace_state *state, uintptr_t pc, backtrace_full_callback callback, backtrace_error_callback error_callback, void *data)
const unsigned char * unit_data
static int unit_addrs_search(const void *vkey, const void *ventry)
static int unit_addrs_compare(const void *v1, const void *v2)
struct function_vector fvec
struct function_addrs * function_addrs
struct unit_addrs * addrs
const unsigned char * buf
static void dwarf_buf_error(struct dwarf_buf *buf, const char *msg, int errnum)
dwarf_extended_line_number_op
@ DW_LNE_set_discriminator
static int64_t read_sleb128(struct dwarf_buf *buf)
static int read_lnct(struct backtrace_state *state, struct dwarf_data *ddata, struct unit *u, struct dwarf_buf *hdr_buf, const struct line_header *hdr, size_t formats_count, const struct line_header_format *formats, const char **string)
static int add_unit_addr(struct backtrace_state *state, void *rdata, uintptr_t lowpc, uintptr_t highpc, backtrace_error_callback error_callback, void *data, void *pvec)
unsigned int max_ops_per_insn
static uint64_t read_address(struct dwarf_buf *buf, int addrsize)
static uint64_t read_offset(struct dwarf_buf *buf, int is_dwarf64)
static int resolve_unit_addrs_overlap_walk(struct backtrace_state *state, size_t *pfrom, size_t *pto, struct unit_addrs *enclosing, struct unit_addrs_vector *old_vec, backtrace_error_callback error_callback, void *data, struct unit_addrs_vector *new_vec)
static struct dwarf_data * build_dwarf_data(struct backtrace_state *state, struct libbacktrace_base_address base_address, const struct dwarf_sections *dwarf_sections, int is_bigendian, struct dwarf_data *altlink, backtrace_error_callback error_callback, void *data)
static int function_addrs_compare(const void *v1, const void *v2)
static int line_compare(const void *v1, const void *v2)
enum dwarf_attribute name
static int dwarf_lookup_pc(struct backtrace_state *state, struct dwarf_data *ddata, uintptr_t pc, backtrace_full_callback callback, backtrace_error_callback error_callback, void *data, int *found)
@ ATTR_VAL_RNGLISTS_INDEX
static const char * read_string(struct dwarf_buf *buf)
struct dwarf_data * altlink
dwarf_line_number_content_type
@ DW_LNCT_directory_index
static unsigned char read_byte(struct dwarf_buf *buf)
@ DW_TAG_inlined_subroutine
uint64_t str_offsets_base
struct function_addrs * function_addrs
static void free_abbrevs(struct backtrace_state *state, struct abbrevs *abbrevs, backtrace_error_callback error_callback, void *data)
static const struct abbrev * lookup_abbrev(struct abbrevs *abbrevs, uint64_t code, backtrace_error_callback error_callback, void *data)
struct libbacktrace_base_address base_address
static uint64_t read_initial_length(struct dwarf_buf *buf, int *is_dwarf64)
static int read_line_program(struct backtrace_state *state, struct dwarf_data *ddata, const struct line_header *hdr, struct dwarf_buf *line_buf, struct line_vector *vec)
struct backtrace_vector vec
static uint32_t read_uint24(struct dwarf_buf *buf)
static int add_ranges(struct backtrace_state *state, const struct dwarf_sections *dwarf_sections, struct libbacktrace_base_address base_address, int is_bigendian, struct unit *u, uintptr_t base, const struct pcrange *pcrange, int(*add_range)(struct backtrace_state *state, void *rdata, uintptr_t lowpc, uintptr_t highpc, backtrace_error_callback error_callback, void *data, void *vec), void *rdata, backtrace_error_callback error_callback, void *data, void *vec)
struct function * function
static int line_search(const void *vkey, const void *ventry)
static uint64_t read_uint64(struct dwarf_buf *buf)
static int read_attribute(enum dwarf_form form, uint64_t implicit_val, struct dwarf_buf *buf, int is_dwarf64, int version, int addrsize, const struct dwarf_sections *dwarf_sections, struct dwarf_data *altlink, struct attr_val *val)
static int read_line_info(struct backtrace_state *state, struct dwarf_data *ddata, backtrace_error_callback error_callback, void *data, struct unit *u, struct line_header *hdr, struct line **lines, size_t *lines_count)
struct backtrace_vector vec
static int advance(struct dwarf_buf *buf, size_t count)
size_t function_addrs_count
static int resolve_addr_index(const struct dwarf_sections *dwarf_sections, uint64_t addr_base, int addrsize, int is_bigendian, uint64_t addr_index, backtrace_error_callback error_callback, void *data, uintptr_t *address)
static int add_line(struct backtrace_state *state, struct dwarf_data *ddata, uintptr_t pc, const char *filename, int lineno, backtrace_error_callback error_callback, void *data, struct line_vector *vec)
static signed char read_sbyte(struct dwarf_buf *buf)
static int add_low_high_range(struct backtrace_state *state, const struct dwarf_sections *dwarf_sections, struct libbacktrace_base_address base_address, int is_bigendian, struct unit *u, const struct pcrange *pcrange, int(*add_range)(struct backtrace_state *state, void *rdata, uintptr_t lowpc, uintptr_t highpc, backtrace_error_callback error_callback, void *data, void *vec), void *rdata, backtrace_error_callback error_callback, void *data, void *vec)
static uint32_t read_uint32(struct dwarf_buf *buf)
@ DW_AT_string_length_byte_size
@ DW_AT_GNU_template_name
@ DW_AT_HP_cold_region_low_pc
@ DW_AT_GNU_pt_guarded_by
@ DW_AT_APPLE_property_name
@ DW_AT_string_length_bit_size
@ DW_AT_GNU_odr_signature
@ DW_AT_call_target_clobbered
@ DW_AT_GNU_exclusive_locks_required
@ DW_AT_GNU_call_site_target_clobbered
@ DW_AT_GNU_all_source_call_sites
@ DW_AT_GNU_call_site_data_value
@ DW_AT_MIPS_tail_loop_begin
@ DW_AT_call_all_tail_calls
@ DW_AT_GNU_call_site_target
@ DW_AT_GNU_all_tail_call_sites
@ DW_AT_GNU_shared_locks_required
@ DW_AT_APPLE_major_runtime_vers
@ DW_AT_HP_definition_points
@ DW_AT_HP_actuals_stmt_list
@ DW_AT_GNU_all_call_sites
@ DW_AT_APPLE_objc_complete_type
@ DW_AT_upc_threads_scaled
@ DW_AT_calling_convention
@ DW_AT_HP_default_location
@ DW_AT_HP_is_result_param
@ DW_AT_data_member_location
@ DW_AT_HP_pass_by_reference
@ DW_AT_MIPS_loop_unroll_factor
@ DW_AT_HP_widened_byte_size
@ DW_AT_GNU_locks_excluded
@ DW_AT_MIPS_epilog_begin
@ DW_AT_APPLE_property_setter
@ DW_AT_HP_all_variables_modifiable
@ DW_AT_GNU_call_site_value
@ DW_AT_HP_prof_version_id
@ DW_AT_GNAT_descriptive_type
@ DW_AT_APPLE_property_getter
@ DW_AT_MIPS_abstract_name
@ DW_AT_APPLE_omit_frame_ptr
@ DW_AT_GNU_discriminator
@ DW_AT_call_all_source_calls
@ DW_AT_APPLE_property_attribute
@ DW_AT_MIPS_linkage_name
@ DW_AT_HP_cold_region_high_pc
@ DW_AT_use_GNAT_descriptive_type
@ DW_AT_MIPS_software_pipeline_depth
@ DW_AT_vtable_elem_location
@ DW_AT_HP_proc_per_section
@ DW_AT_call_data_location
@ DW_AT_VMS_rtnbeg_pd_address
@ DW_AT_variable_parameter
@ DW_AT_MIPS_clone_origin
@ DW_AT_APPLE_runtime_class
unsigned int min_insn_len
static int units_search(const void *vkey, const void *ventry)
#define IS_ABSOLUTE_PATH(f)
void backtrace_qsort(void *base, size_t count, size_t size, int(*compar)(const void *, const void *))
#define backtrace_atomic_store_size_t(p, v)
#define backtrace_atomic_load_pointer(p)
int(* fileline)(struct backtrace_state *state, uintptr_t pc, backtrace_full_callback callback, backtrace_error_callback error_callback, void *data)
#define libbacktrace_add_base(pc, base)
const unsigned char * data[DEBUG_MAX]
static void backtrace_vector_free(struct backtrace_state *state, struct backtrace_vector *vec, backtrace_error_callback error_callback, void *data)
#define backtrace_atomic_store_pointer(p, v)
#define __sync_bool_compare_and_swap(A, B, C)
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
const char * base(const char *p)
Functions to help with cleanup.