Lines Matching refs:a2l
169 static int slurp_symtab(bfd *abfd, struct a2l_data *a2l)
198 a2l->syms = syms;
206 struct a2l_data *a2l = data;
209 if (a2l->found)
220 pc = a2l->addr;
235 a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma,
236 &a2l->filename, &a2l->funcname,
237 &a2l->line);
239 if (a2l->filename && !strlen(a2l->filename))
240 a2l->filename = NULL;
246 struct a2l_data *a2l = NULL;
255 a2l = zalloc(sizeof(*a2l));
256 if (a2l == NULL)
259 a2l->abfd = abfd;
260 a2l->input = strdup(path);
261 if (a2l->input == NULL)
264 if (slurp_symtab(abfd, a2l))
267 return a2l;
270 if (a2l) {
271 zfree((char **)&a2l->input);
272 free(a2l);
278 static void addr2line_cleanup(struct a2l_data *a2l)
280 if (a2l->abfd)
281 bfd_close(a2l->abfd);
282 zfree((char **)&a2l->input);
283 zfree(&a2l->syms);
284 free(a2l);
291 struct a2l_data *a2l = dso->a2l;
292 struct symbol *inline_sym = new_inline_sym(dso, sym, a2l->funcname);
295 if (a2l->filename)
296 srcline = srcline_from_fileline(a2l->filename, a2l->line);
307 struct a2l_data *a2l = dso->a2l;
309 if (!a2l) {
310 dso->a2l = addr2line_init(dso_name);
311 a2l = dso->a2l;
314 if (a2l == NULL) {
320 a2l->addr = addr;
321 a2l->found = false;
323 bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l);
325 if (!a2l->found)
334 while (bfd_find_inliner_info(a2l->abfd, &a2l->filename,
335 &a2l->funcname, &a2l->line) &&
338 if (a2l->filename && !strlen(a2l->filename))
339 a2l->filename = NULL;
351 *file = a2l->filename ? strdup(a2l->filename) : NULL;
356 *line = a2l->line;
363 struct a2l_data *a2l = dso->a2l;
365 if (!a2l)
368 addr2line_cleanup(a2l);
370 dso->a2l = NULL;
396 static void addr2line_subprocess_cleanup(struct child_process *a2l)
398 if (a2l->pid != -1) {
399 kill(a2l->pid, SIGKILL);
400 finish_command(a2l); /* ignore result, we don't care */
401 a2l->pid = -1;
402 close(a2l->in);
403 close(a2l->out);
406 free(a2l);
417 struct child_process *a2l = zalloc(sizeof(*a2l));
420 if (a2l == NULL) {
425 a2l->pid = -1;
426 a2l->in = -1;
427 a2l->out = -1;
428 a2l->no_stderr = 1;
430 a2l->argv = argv;
431 start_command_status = start_command(a2l);
432 a2l->argv = NULL; /* it's not used after start_command; avoid dangling pointers */
437 addr2line_subprocess_cleanup(a2l);
441 return a2l;
450 static enum a2l_style addr2line_configure(struct child_process *a2l, const char *dso_name)
461 if (write(a2l->in, ",\n", 2) != 2)
464 io__init(&io, a2l->out, buf, sizeof(buf));
641 struct child_process *a2l = dso->a2l;
654 if (!a2l) {
658 dso->a2l = addr2line_subprocess_init(symbol_conf.addr2line_path, dso_name);
659 a2l = dso->a2l;
662 if (a2l == NULL) {
667 a2l_style = addr2line_configure(a2l, dso_name);
681 written = len > 0 ? write(a2l->in, buf, len) : -1;
687 io__init(&io, a2l->out, buf, sizeof(buf));
773 dso->a2l = NULL;
774 addr2line_subprocess_cleanup(a2l);
781 struct child_process *a2l = dso->a2l;
783 if (!a2l)
786 addr2line_subprocess_cleanup(a2l);
788 dso->a2l = NULL;