a2l
if (write(a2l->in, ",\n", 2) != 2)
io__init(&io, a2l->out, buf, sizeof(buf));
struct child_process *a2l = dso__a2l(dso);
if (!a2l) {
a2l = dso__a2l(dso);
if (a2l == NULL) {
cmd_a2l_style = cmd_addr2line_configure(a2l, dso_name);
written = len > 0 ? write(a2l->in, buf, len) : -1;
io__init(&io, a2l->out, buf, sizeof(buf));
addr2line_subprocess_cleanup(a2l);
struct child_process *a2l = dso__a2l(dso);
if (!a2l)
addr2line_subprocess_cleanup(a2l);
static void addr2line_subprocess_cleanup(struct child_process *a2l)
if (a2l->pid != -1) {
kill(a2l->pid, SIGKILL);
finish_command(a2l); /* ignore result, we don't care */
a2l->pid = -1;
close(a2l->in);
close(a2l->out);
free(a2l);
struct child_process *a2l = zalloc(sizeof(*a2l));
if (a2l == NULL) {
a2l->pid = -1;
a2l->in = -1;
a2l->out = -1;
a2l->no_stderr = 1;
a2l->argv = argv;
start_command_status = start_command(a2l);
a2l->argv = NULL; /* it's not used after start_command; avoid dangling pointers */
addr2line_subprocess_cleanup(a2l);
return a2l;
static enum cmd_a2l_style cmd_addr2line_configure(struct child_process *a2l, const char *dso_name)
void *a2l;
return RC_CHK_ACCESS(dso)->a2l;
RC_CHK_ACCESS(dso)->a2l = val;
a2l->syms = syms;
struct a2l_data *a2l = data;
if (a2l->found)
pc = a2l->addr;
a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma,
&a2l->filename, &a2l->funcname,
&a2l->line);
if (a2l->filename && !strlen(a2l->filename))
a2l->filename = NULL;
struct a2l_data *a2l = NULL;
a2l = zalloc(sizeof(*a2l));
if (a2l == NULL)
a2l->abfd = abfd;
a2l->input = strdup(path);
if (a2l->input == NULL)
if (slurp_symtab(abfd, a2l))
return a2l;
if (a2l) {
zfree((char **)&a2l->input);
free(a2l);
static void addr2line_cleanup(struct a2l_data *a2l)
if (a2l->abfd)
bfd_close(a2l->abfd);
zfree((char **)&a2l->input);
zfree(&a2l->syms);
free(a2l);
struct a2l_data *a2l = dso__a2l(dso);
struct symbol *inline_sym = new_inline_sym(dso, sym, a2l->funcname);
if (a2l->filename)
srcline = srcline_from_fileline(a2l->filename, a2l->line);
struct a2l_data *a2l = dso__a2l(dso);
if (!a2l) {
a2l = addr2line_init(dso_name);
dso__set_a2l(dso, a2l);
if (a2l == NULL) {
a2l->addr = addr;
a2l->found = false;
bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l);
if (!a2l->found)
while (bfd_find_inliner_info(a2l->abfd, &a2l->filename,
&a2l->funcname, &a2l->line) &&
if (a2l->filename && !strlen(a2l->filename))
a2l->filename = NULL;
*file = a2l->filename ? strdup(a2l->filename) : NULL;
*line = a2l->line;
struct a2l_data *a2l = dso__a2l(dso);
if (!a2l)
addr2line_cleanup(a2l);
static int slurp_symtab(bfd *abfd, struct a2l_data *a2l)