1 /* Internal definitions for libdwfl.
2 Copyright (C) 2005-2013 Red Hat, Inc.
3 This file is part of elfutils.
5 This file is free software; you can redistribute it and/or modify
6 it under the terms of either
8 * the GNU Lesser General Public License as published by the Free
9 Software Foundation; either version 3 of the License, or (at
10 your option) any later version
14 * the GNU General Public License as published by the Free
15 Software Foundation; either version 2 of the License, or (at
16 your option) any later version
18 or both in parallel, as here.
20 elfutils is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
25 You should have received copies of the GNU General Public License and
26 the GNU Lesser General Public License along with this program. If
27 not, see <http://www.gnu.org/licenses/>. */
43 #include "../libdw/libdwP.h" /* We need its INTDECLs. */
45 typedef struct Dwfl_Process Dwfl_Process;
47 /* gettext helper macros. */
48 #define _(Str) dgettext ("elfutils", Str)
51 DWFL_ERROR (NOERROR, N_("no error")) \
52 DWFL_ERROR (UNKNOWN_ERROR, N_("unknown error")) \
53 DWFL_ERROR (NOMEM, N_("out of memory")) \
54 DWFL_ERROR (ERRNO, N_("See errno")) \
55 DWFL_ERROR (LIBELF, N_("See elf_errno")) \
56 DWFL_ERROR (LIBDW, N_("See dwarf_errno")) \
57 DWFL_ERROR (LIBEBL, N_("See ebl_errno (XXX missing)")) \
58 DWFL_ERROR (ZLIB, N_("gzip decompression failed")) \
59 DWFL_ERROR (BZLIB, N_("bzip2 decompression failed")) \
60 DWFL_ERROR (LZMA, N_("LZMA decompression failed")) \
61 DWFL_ERROR (UNKNOWN_MACHINE, N_("no support library found for machine")) \
62 DWFL_ERROR (NOREL, N_("Callbacks missing for ET_REL file")) \
63 DWFL_ERROR (BADRELTYPE, N_("Unsupported relocation type")) \
64 DWFL_ERROR (BADRELOFF, N_("r_offset is bogus")) \
65 DWFL_ERROR (BADSTROFF, N_("offset out of range")) \
66 DWFL_ERROR (RELUNDEF, N_("relocation refers to undefined symbol")) \
67 DWFL_ERROR (CB, N_("Callback returned failure")) \
68 DWFL_ERROR (NO_DWARF, N_("No DWARF information found")) \
69 DWFL_ERROR (NO_SYMTAB, N_("No symbol table found")) \
70 DWFL_ERROR (NO_PHDR, N_("No ELF program headers")) \
71 DWFL_ERROR (OVERLAP, N_("address range overlaps an existing module")) \
72 DWFL_ERROR (ADDR_OUTOFRANGE, N_("address out of range")) \
73 DWFL_ERROR (NO_MATCH, N_("no matching address range")) \
74 DWFL_ERROR (TRUNCATED, N_("image truncated")) \
75 DWFL_ERROR (ALREADY_ELF, N_("ELF file opened")) \
76 DWFL_ERROR (BADELF, N_("not a valid ELF file")) \
77 DWFL_ERROR (WEIRD_TYPE, N_("cannot handle DWARF type description")) \
78 DWFL_ERROR (WRONG_ID_ELF, N_("ELF file does not match build ID")) \
79 DWFL_ERROR (BAD_PRELINK, N_("corrupt .gnu.prelink_undo section data")) \
80 DWFL_ERROR (LIBEBL_BAD, N_("Internal error due to ebl")) \
81 DWFL_ERROR (CORE_MISSING, N_("Missing data in core file")) \
82 DWFL_ERROR (INVALID_REGISTER, N_("Invalid register")) \
83 DWFL_ERROR (PROCESS_MEMORY_READ, N_("Error reading process memory")) \
84 DWFL_ERROR (PROCESS_NO_ARCH, N_("Couldn't find architecture of any ELF")) \
85 DWFL_ERROR (PARSE_PROC, N_("Error parsing /proc filesystem")) \
86 DWFL_ERROR (INVALID_DWARF, N_("Invalid DWARF")) \
87 DWFL_ERROR (UNSUPPORTED_DWARF, N_("Unsupported DWARF")) \
88 DWFL_ERROR (NEXT_THREAD_FAIL, N_("Unable to find more threads")) \
89 DWFL_ERROR (ATTACH_STATE_CONFLICT, N_("Dwfl already has attached state")) \
90 DWFL_ERROR (NO_ATTACH_STATE, N_("Dwfl has no attached state")) \
91 DWFL_ERROR (NO_UNWIND, N_("Unwinding not supported for this architecture")) \
92 DWFL_ERROR (INVALID_ARGUMENT, N_("Invalid argument"))
94 #define DWFL_ERROR(name, text) DWFL_E_##name,
95 typedef enum { DWFL_ERRORS DWFL_E_NUM } Dwfl_Error;
98 #define OTHER_ERROR(name) ((unsigned int) DWFL_E_##name << 16)
99 #define DWFL_E(name, errno) (OTHER_ERROR (name) | (errno))
101 extern int __libdwfl_canon_error (Dwfl_Error) internal_function;
102 extern void __libdwfl_seterrno (Dwfl_Error) internal_function;
106 const Dwfl_Callbacks *callbacks;
108 Dwfl_Module *modulelist; /* List in order used by full traversals. */
110 Dwfl_Process *process;
111 Dwfl_Error process_attach_error;
113 GElf_Addr offline_next_address;
115 GElf_Addr segment_align; /* Smallest granularity of segments. */
117 /* Binary search table in three parallel malloc'd arrays. */
118 size_t lookup_elts; /* Elements in use. */
119 size_t lookup_alloc; /* Elements allococated. */
120 GElf_Addr *lookup_addr; /* Start address of segment. */
121 Dwfl_Module **lookup_module; /* Module associated with segment, or null. */
122 int *lookup_segndx; /* User segment index, or -1. */
124 /* Cache from last dwfl_report_segment call. */
125 const void *lookup_tail_ident;
126 GElf_Off lookup_tail_vaddr;
127 GElf_Off lookup_tail_offset;
130 char *executable_for_core; /* --executable if --core was specified. */
133 #define OFFLINE_REDZONE 0x10000
139 bool valid; /* The build ID note has been matched. */
140 bool relocated; /* Partial relocation of all sections done. */
144 /* This is the lowest p_vaddr in this ELF file, aligned to p_align.
145 For a file without phdrs, this is zero. */
148 /* This is an address chosen for synchronization between the main file
149 and the debug file. See dwfl_module_getdwarf.c for how it's chosen. */
150 GElf_Addr address_sync;
156 struct Dwfl_Module *next; /* Link on Dwfl.modulelist. */
160 char *name; /* Iterator name for this module. */
161 GElf_Addr low_addr, high_addr;
163 struct dwfl_file main, debug, aux_sym;
166 GElf_Half e_type; /* GElf_Ehdr.e_type cache. */
167 Dwfl_Error elferr; /* Previous failure to open main file. */
169 struct dwfl_relocation *reloc_info; /* Relocatable sections. */
171 struct dwfl_file *symfile; /* Either main or debug. */
172 Elf_Data *symdata; /* Data in the ELF symbol table section. */
173 Elf_Data *aux_symdata; /* Data in the auxiliary ELF symbol table. */
174 size_t syments; /* sh_size / sh_entsize of that section. */
175 size_t aux_syments; /* sh_size / sh_entsize of aux_sym section. */
176 int first_global; /* Index of first global symbol of table. */
177 int aux_first_global; /* Index of first global of aux_sym table. */
178 Elf_Data *symstrdata; /* Data for its string table. */
179 Elf_Data *aux_symstrdata; /* Data for aux_sym string table. */
180 Elf_Data *symxndxdata; /* Data in the extended section index table. */
181 Elf_Data *aux_symxndxdata; /* Data in the extended auxiliary table. */
183 Dwarf *dw; /* libdw handle for its debugging info. */
185 Dwfl_Error symerr; /* Previous failure to load symbols. */
186 Dwfl_Error dwerr; /* Previous failure to load DWARF. */
188 /* Known CU's in this module. */
189 struct dwfl_cu *first_cu, **cu;
191 void *lazy_cu_root; /* Table indexed by Dwarf_Off of CU. */
193 struct dwfl_arange *aranges; /* Mapping of addresses in module to CUs. */
195 void *build_id_bits; /* malloc'd copy of build ID bits. */
196 GElf_Addr build_id_vaddr; /* Address where they reside, 0 if unknown. */
197 int build_id_len; /* -1 for prior failure, 0 if unset. */
200 unsigned int lazycu; /* Possible users, deleted when none left. */
201 unsigned int naranges;
203 Dwarf_CFI *dwarf_cfi; /* Cached DWARF CFI for this module. */
204 Dwarf_CFI *eh_cfi; /* Cached EH CFI for this module. */
206 int segment; /* Index of first segment table entry. */
207 bool gc; /* Mark/sweep flag. */
210 /* This holds information common for all the threads/tasks/TIDs of one process
217 const Dwfl_Thread_Callbacks *callbacks;
223 /* See its typedef in libdwfl.h. */
227 Dwfl_Process *process;
229 /* The current frame being unwound. Initially it is the bottom frame.
230 Later the processed frames get freed and this pointer is updated. */
235 /* See its typedef in libdwfl.h. */
240 /* Previous (outer) frame. */
242 bool signal_frame : 1;
243 bool initial_frame : 1;
246 /* This structure is still being initialized or there was an error
248 DWFL_FRAME_STATE_ERROR,
249 /* PC field is valid. */
250 DWFL_FRAME_STATE_PC_SET,
251 /* PC field is undefined, this means the next (inner) frame was the
253 DWFL_FRAME_STATE_PC_UNDEFINED
255 /* Either initialized from appropriate REGS element or on some archs
256 initialized separately as the return address has no DWARF register. */
258 /* (1 << X) bitmask where 0 <= X < ebl_frame_nregs. */
259 uint64_t regs_set[3];
260 /* REGS array size is ebl_frame_nregs.
261 REGS_SET tells which of the REGS are valid. */
265 /* Fetch value from Dwfl_Frame->regs indexed by DWARF REGNO.
266 No error code is set if the function returns FALSE. */
267 bool __libdwfl_frame_reg_get (Dwfl_Frame *state, unsigned regno,
271 /* Store value to Dwfl_Frame->regs indexed by DWARF REGNO.
272 No error code is set if the function returns FALSE. */
273 bool __libdwfl_frame_reg_set (Dwfl_Frame *state, unsigned regno,
277 /* Information cached about each CU in Dwfl_Module.dw. */
280 /* This caches libdw information about the CU. It's also the
281 address passed back to users, so we take advantage of the
282 fact that it's placed first to cast back. */
285 Dwfl_Module *mod; /* Pointer back to containing module. */
287 struct dwfl_cu *next; /* CU immediately following in the file. */
289 struct Dwfl_Lines *lines;
296 /* This is what the opaque Dwfl_Line * pointers we pass to users are.
297 We need to recover pointers to our struct dwfl_cu and a record in
298 libdw's Dwarf_Line table. To minimize the memory used in addition
299 to libdw's Dwarf_Lines buffer, we just point to our own index in
300 this table, and have one pointer back to the CU. The indices here
301 match those in libdw's Dwarf_CU.lines->info table. */
304 unsigned int idx; /* My index in the dwfl_cu.lines table. */
308 static inline struct dwfl_cu *
309 dwfl_linecu_inline (const Dwfl_Line *line)
311 const struct Dwfl_Lines *lines = ((const void *) line
312 - offsetof (struct Dwfl_Lines,
316 #define dwfl_linecu dwfl_linecu_inline
318 static inline GElf_Addr
319 dwfl_adjusted_address (Dwfl_Module *mod, GElf_Addr addr)
321 return addr + mod->main_bias;
324 static inline GElf_Addr
325 dwfl_deadjust_address (Dwfl_Module *mod, GElf_Addr addr)
327 return addr - mod->main_bias;
330 static inline Dwarf_Addr
331 dwfl_adjusted_dwarf_addr (Dwfl_Module *mod, Dwarf_Addr addr)
333 return dwfl_adjusted_address (mod, (addr
334 - mod->debug.address_sync
335 + mod->main.address_sync));
338 static inline Dwarf_Addr
339 dwfl_deadjust_dwarf_addr (Dwfl_Module *mod, Dwarf_Addr addr)
341 return (dwfl_deadjust_address (mod, addr)
342 - mod->main.address_sync
343 + mod->debug.address_sync);
346 static inline Dwarf_Addr
347 dwfl_adjusted_aux_sym_addr (Dwfl_Module *mod, Dwarf_Addr addr)
349 return dwfl_adjusted_address (mod, (addr
350 - mod->aux_sym.address_sync
351 + mod->main.address_sync));
354 static inline Dwarf_Addr
355 dwfl_deadjust_aux_sym_addr (Dwfl_Module *mod, Dwarf_Addr addr)
357 return (dwfl_deadjust_address (mod, addr)
358 - mod->main.address_sync
359 + mod->aux_sym.address_sync);
362 static inline GElf_Addr
363 dwfl_adjusted_st_value (Dwfl_Module *mod, Elf *symelf, GElf_Addr addr)
365 if (symelf == mod->main.elf)
366 return dwfl_adjusted_address (mod, addr);
367 if (symelf == mod->debug.elf)
368 return dwfl_adjusted_dwarf_addr (mod, addr);
369 return dwfl_adjusted_aux_sym_addr (mod, addr);
372 static inline GElf_Addr
373 dwfl_deadjust_st_value (Dwfl_Module *mod, Elf *symelf, GElf_Addr addr)
375 if (symelf == mod->main.elf)
376 return dwfl_deadjust_address (mod, addr);
377 if (symelf == mod->debug.elf)
378 return dwfl_deadjust_dwarf_addr (mod, addr);
379 return dwfl_deadjust_aux_sym_addr (mod, addr);
382 /* This describes a contiguous address range that lies in a single CU.
383 We condense runs of Dwarf_Arange entries for the same CU into this. */
387 size_t arange; /* Index in Dwarf_Aranges. */
391 /* Internal wrapper for old dwfl_module_getsym and new dwfl_module_getsym_info.
392 adjust_st_value set to true returns adjusted SYM st_value, set to false
393 it will not adjust SYM at all, but does match against resolved *ADDR. */
394 extern const char *__libdwfl_getsym (Dwfl_Module *mod, int ndx, GElf_Sym *sym,
395 GElf_Addr *addr, GElf_Word *shndxp,
396 Elf **elfp, Dwarf_Addr *biasp,
397 bool *resolved, bool adjust_st_value)
400 /* Internal wrapper for old dwfl_module_addrsym and new dwfl_module_addrinfo.
401 adjust_st_value set to true returns adjusted SYM st_value, set to false
402 it will not adjust SYM at all, but does match against resolved values. */
403 extern const char *__libdwfl_addrsym (Dwfl_Module *mod, GElf_Addr addr,
404 GElf_Off *off, GElf_Sym *sym,
405 GElf_Word *shndxp, Elf **elfp,
407 bool adjust_st_value) internal_function;
409 extern void __libdwfl_module_free (Dwfl_Module *mod) internal_function;
411 /* Find the main ELF file, update MOD->elferr and/or MOD->main.elf. */
412 extern void __libdwfl_getelf (Dwfl_Module *mod) internal_function;
414 /* Process relocations in debugging sections in an ET_REL file.
415 FILE must be opened with ELF_C_READ_MMAP_PRIVATE or ELF_C_READ,
416 to make it possible to relocate the data in place (or ELF_C_RDWR or
417 ELF_C_RDWR_MMAP if you intend to modify the Elf file on disk). After
418 this, dwarf_begin_elf on FILE will read the relocated data.
420 When DEBUG is false, apply partial relocation to all sections. */
421 extern Dwfl_Error __libdwfl_relocate (Dwfl_Module *mod, Elf *file, bool debug)
424 /* Find the section index in mod->main.elf that contains the given
425 *ADDR. Adjusts *ADDR to be section relative on success, returns
426 SHN_UNDEF on failure. */
427 extern size_t __libdwfl_find_section_ndx (Dwfl_Module *mod, Dwarf_Addr *addr)
430 /* Process (simple) relocations in arbitrary section TSCN of an ET_REL file.
431 RELOCSCN is SHT_REL or SHT_RELA and TSCN is its sh_info target section. */
432 extern Dwfl_Error __libdwfl_relocate_section (Dwfl_Module *mod, Elf *relocated,
433 Elf_Scn *relocscn, Elf_Scn *tscn,
437 /* Adjust *VALUE from section-relative to absolute.
438 MOD->dwfl->callbacks->section_address is called to determine the actual
439 address of a loaded section. */
440 extern Dwfl_Error __libdwfl_relocate_value (Dwfl_Module *mod, Elf *elf,
441 size_t *shstrndx_cache,
446 /* Ensure that MOD->ebl is set up. */
447 extern Dwfl_Error __libdwfl_module_getebl (Dwfl_Module *mod) internal_function;
449 /* Install a new Dwarf_CFI in *SLOT (MOD->eh_cfi or MOD->dwarf_cfi). */
450 extern Dwarf_CFI *__libdwfl_set_cfi (Dwfl_Module *mod, Dwarf_CFI **slot,
454 /* Iterate through all the CU's in the module. Start by passing a null
455 LASTCU, and then pass the last *CU returned. Success return with null
457 extern Dwfl_Error __libdwfl_nextcu (Dwfl_Module *mod, struct dwfl_cu *lastcu,
458 struct dwfl_cu **cu) internal_function;
460 /* Find the CU by address. */
461 extern Dwfl_Error __libdwfl_addrcu (Dwfl_Module *mod, Dwarf_Addr addr,
462 struct dwfl_cu **cu) internal_function;
464 /* Ensure that CU->lines (and CU->cu->lines) is set up. */
465 extern Dwfl_Error __libdwfl_cu_getsrclines (struct dwfl_cu *cu)
468 /* Look in ELF for an NT_GNU_BUILD_ID note. Store it to BUILD_ID_BITS,
469 its vaddr in ELF to BUILD_ID_VADDR (it is unrelocated, even if MOD is not
470 NULL) and store length to BUILD_ID_LEN. Returns -1 for errors, 1 if it was
471 stored and 0 if no note is found. MOD may be NULL, MOD must be non-NULL
472 only if ELF is ET_REL. */
473 extern int __libdwfl_find_elf_build_id (Dwfl_Module *mod, Elf *elf,
474 const void **build_id_bits,
475 GElf_Addr *build_id_elfaddr,
479 /* Look in ELF for an NT_GNU_BUILD_ID note. If SET is true, store it
480 in MOD and return its length. If SET is false, instead compare it
481 to that stored in MOD and return 2 if they match, 1 if they do not.
482 Returns -1 for errors, 0 if no note is found. */
483 extern int __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf)
486 /* Open a main or debuginfo file by its build ID, returns the fd. */
487 extern int __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug,
488 char **file_name) internal_function;
490 extern uint32_t __libdwfl_crc32 (uint32_t crc, unsigned char *buf, size_t len)
492 extern int __libdwfl_crc32_file (int fd, uint32_t *resp) attribute_hidden;
495 /* Given ELF and some parameters return TRUE if the *P return value parameters
496 have been successfully filled in. Any of the *P parameters can be NULL. */
497 extern bool __libdwfl_elf_address_range (Elf *elf, GElf_Addr base,
498 bool add_p_vaddr, bool sanity,
500 GElf_Addr *address_syncp,
501 GElf_Addr *startp, GElf_Addr *endp,
502 GElf_Addr *biasp, GElf_Half *e_typep)
505 /* Meat of dwfl_report_elf, given elf_begin just called.
506 Consumes ELF on success, not on failure. */
507 extern Dwfl_Module *__libdwfl_report_elf (Dwfl *dwfl, const char *name,
508 const char *file_name, int fd,
509 Elf *elf, GElf_Addr base,
510 bool add_p_vaddr, bool sanity)
513 /* Meat of dwfl_report_offline. */
514 extern Dwfl_Module *__libdwfl_report_offline (Dwfl *dwfl, const char *name,
515 const char *file_name,
516 int fd, bool closefd,
517 int (*predicate) (const char *,
521 /* Free PROCESS. Unlink and free also any structures it references. */
522 extern void __libdwfl_process_free (Dwfl_Process *process)
525 /* Update STATE->unwound for the unwound frame.
526 On error STATE->unwound == NULL
527 or STATE->unwound->pc_state == DWFL_FRAME_STATE_ERROR;
528 in such case dwfl_errno () is set.
529 If STATE->unwound->pc_state == DWFL_FRAME_STATE_PC_UNDEFINED
530 then STATE was the last valid frame. */
531 extern void __libdwfl_frame_unwind (Dwfl_Frame *state)
534 /* Call dwfl_attach_state for PID, return true if successful. */
535 extern bool __libdwfl_attach_state_for_pid (Dwfl *dwfl, pid_t pid)
538 /* Call dwfl_attach_state for CORE, return true if successful. */
539 extern bool __libdwfl_attach_state_for_core (Dwfl *dwfl, Elf *core)
542 /* Align segment START downwards or END upwards addresses according to DWFL. */
543 extern GElf_Addr __libdwfl_segment_start (Dwfl *dwfl, GElf_Addr start)
545 extern GElf_Addr __libdwfl_segment_end (Dwfl *dwfl, GElf_Addr end)
548 /* Decompression wrappers: decompress whole file into memory. */
549 extern Dwfl_Error __libdw_gunzip (int fd, off64_t start_offset,
550 void *mapped, size_t mapped_size,
551 void **whole, size_t *whole_size)
553 extern Dwfl_Error __libdw_bunzip2 (int fd, off64_t start_offset,
554 void *mapped, size_t mapped_size,
555 void **whole, size_t *whole_size)
557 extern Dwfl_Error __libdw_unlzma (int fd, off64_t start_offset,
558 void *mapped, size_t mapped_size,
559 void **whole, size_t *whole_size)
562 /* Skip the image header before a file image: updates *START_OFFSET. */
563 extern Dwfl_Error __libdw_image_header (int fd, off64_t *start_offset,
564 void *mapped, size_t mapped_size)
567 /* Open Elf handle on *FDP. This handles decompression and checks
568 elf_kind. Succeed only for ELF_K_ELF, or also ELF_K_AR if ARCHIVE_OK.
569 Returns DWFL_E_NOERROR and sets *ELFP on success, resets *FDP to -1 if
570 it's no longer used. Resets *FDP on failure too iff CLOSE_ON_FAIL. */
571 extern Dwfl_Error __libdw_open_file (int *fdp, Elf **elfp,
572 bool close_on_fail, bool archive_ok)
575 /* Fetch PT_DYNAMIC P_VADDR from ELF and store it to *VADDRP. Return success.
576 *VADDRP is not modified if the function fails. */
577 extern bool __libdwfl_dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)
580 /* These are working nicely for --core, but are not ready to be
581 exported interfaces quite yet. */
583 /* Type of callback function ...
585 typedef bool Dwfl_Memory_Callback (Dwfl *dwfl, int segndx,
586 void **buffer, size_t *buffer_available,
587 GElf_Addr vaddr, size_t minread, void *arg);
589 /* Type of callback function ...
591 typedef bool Dwfl_Module_Callback (Dwfl_Module *mod, void **userdata,
592 const char *name, Dwarf_Addr base,
593 void **buffer, size_t *buffer_available,
594 GElf_Off cost, GElf_Off worthwhile,
595 GElf_Off whole, GElf_Off contiguous,
596 void *arg, Elf **elfp);
598 /* One shared library (or executable) info from DT_DEBUG link map. */
599 struct r_debug_info_module
601 struct r_debug_info_module *next;
602 /* FD is -1 iff ELF is NULL. */
606 /* START and END are both zero if not valid. */
607 GElf_Addr start, end;
608 bool disk_file_has_build_id;
612 /* Information gathered from DT_DEBUG by dwfl_link_map_report hinted to
613 dwfl_segment_report_module. */
616 struct r_debug_info_module *module;
621 extern int dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
622 Dwfl_Memory_Callback *memory_callback,
623 void *memory_callback_arg,
624 Dwfl_Module_Callback *read_eagerly,
625 void *read_eagerly_arg,
626 const struct r_debug_info *r_debug_info);
628 /* Report a module for entry in the dynamic linker's struct link_map list.
629 For each link_map entry, if an existing module resides at its address,
630 this just modifies that module's name and suggested file name. If
631 no such module exists, this calls dwfl_report_elf on the l_name string.
633 If AUXV is not null, it points to AUXV_SIZE bytes of auxiliary vector
634 data as contained in an NT_AUXV note or read from a /proc/pid/auxv
635 file. When this is available, it guides the search. If AUXV is null
636 or the memory it points to is not accessible, then this search can
637 only find where to begin if the correct executable file was
638 previously reported and preloaded as with dwfl_report_elf.
640 Fill in R_DEBUG_INFO if it is not NULL. It should be cleared by the
641 caller, this function does not touch fields it does not need to modify.
642 If R_DEBUG_INFO is not NULL then no modules get added to DWFL, caller
643 has to add them from filled in R_DEBUG_INFO.
645 Returns the number of modules found, or -1 for errors. */
646 extern int dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
647 Dwfl_Memory_Callback *memory_callback,
648 void *memory_callback_arg,
649 struct r_debug_info *r_debug_info);
652 /* Avoid PLT entries. */
654 INTDECL (dwfl_errmsg)
656 INTDECL (dwfl_addrmodule)
657 INTDECL (dwfl_addrsegment)
658 INTDECL (dwfl_addrdwarf)
659 INTDECL (dwfl_addrdie)
660 INTDECL (dwfl_core_file_report)
661 INTDECL (dwfl_getmodules)
662 INTDECL (dwfl_module_addrdie)
663 INTDECL (dwfl_module_address_section)
664 INTDECL (dwfl_module_addrinfo)
665 INTDECL (dwfl_module_addrsym)
666 INTDECL (dwfl_module_build_id)
667 INTDECL (dwfl_module_getdwarf)
668 INTDECL (dwfl_module_getelf)
669 INTDECL (dwfl_module_getsym)
670 INTDECL (dwfl_module_getsym_info)
671 INTDECL (dwfl_module_getsymtab)
672 INTDECL (dwfl_module_getsymtab_first_global)
673 INTDECL (dwfl_module_getsrc)
674 INTDECL (dwfl_module_report_build_id)
675 INTDECL (dwfl_report_elf)
676 INTDECL (dwfl_report_begin)
677 INTDECL (dwfl_report_begin_add)
678 INTDECL (dwfl_report_module)
679 INTDECL (dwfl_report_segment)
680 INTDECL (dwfl_report_offline)
681 INTDECL (dwfl_report_end)
682 INTDECL (dwfl_build_id_find_elf)
683 INTDECL (dwfl_build_id_find_debuginfo)
684 INTDECL (dwfl_standard_find_debuginfo)
685 INTDECL (dwfl_link_map_report)
686 INTDECL (dwfl_linux_kernel_find_elf)
687 INTDECL (dwfl_linux_kernel_module_section_address)
688 INTDECL (dwfl_linux_proc_report)
689 INTDECL (dwfl_linux_proc_maps_report)
690 INTDECL (dwfl_linux_proc_find_elf)
691 INTDECL (dwfl_linux_kernel_report_kernel)
692 INTDECL (dwfl_linux_kernel_report_modules)
693 INTDECL (dwfl_linux_kernel_report_offline)
694 INTDECL (dwfl_offline_section_address)
695 INTDECL (dwfl_module_relocate_address)
696 INTDECL (dwfl_module_dwarf_cfi)
697 INTDECL (dwfl_module_eh_cfi)
698 INTDECL (dwfl_attach_state)
700 INTDECL (dwfl_thread_dwfl)
701 INTDECL (dwfl_thread_tid)
702 INTDECL (dwfl_frame_thread)
703 INTDECL (dwfl_thread_state_registers)
704 INTDECL (dwfl_thread_state_register_pc)
705 INTDECL (dwfl_getthreads)
706 INTDECL (dwfl_thread_getframes)
707 INTDECL (dwfl_frame_pc)
709 /* Leading arguments standard to callbacks passed a Dwfl_Module. */
710 #define MODCB_ARGS(mod) (mod), &(mod)->userdata, (mod)->name, (mod)->low_addr
711 #define CBFAIL (errno ? DWFL_E (ERRNO, errno) : DWFL_E_CB);
714 /* The default used by dwfl_standard_find_debuginfo. */
715 #define DEFAULT_DEBUGINFO_PATH ":.debug:/usr/lib/debug"
718 #endif /* libdwflP.h */