blob: ca8be2f2a557374afd0c142a4d3903c6d439d8bc [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001/* Internal definitions for libdwfl.
Roland McGrath2c7d0dd2011-01-04 19:29:53 -08002 Copyright (C) 2005-2011 Red Hat, Inc.
Mark Wielaardde2ed972012-06-05 17:15:16 +02003 This file is part of elfutils.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00004
Mark Wielaardde2ed972012-06-05 17:15:16 +02005 This file is free software; you can redistribute it and/or modify
6 it under the terms of either
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00007
Mark Wielaardde2ed972012-06-05 17:15:16 +02008 * 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
11
12 or
13
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
17
18 or both in parallel, as here.
19
20 elfutils is distributed in the hope that it will be useful, but
Ulrich Drepper361df7d2006-04-04 21:38:57 +000021 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.
24
Mark Wielaardde2ed972012-06-05 17:15:16 +020025 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/>. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000028
29#ifndef _LIBDWFLP_H
30#define _LIBDWFLP_H 1
31
Roland McGrath55d34a52007-06-08 22:22:01 +000032#ifndef PACKAGE_NAME
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000033# include <config.h>
34#endif
35#include <libdwfl.h>
36#include <libebl.h>
37#include <assert.h>
38#include <errno.h>
39#include <stdbool.h>
40#include <stdlib.h>
41#include <string.h>
42
Roland McGrath4959bf82005-08-09 10:31:08 +000043#include "../libdw/libdwP.h" /* We need its INTDECLs. */
44
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000045/* gettext helper macros. */
46#define _(Str) dgettext ("elfutils", Str)
47
48#define DWFL_ERRORS \
49 DWFL_ERROR (NOERROR, N_("no error")) \
50 DWFL_ERROR (UNKNOWN_ERROR, N_("unknown error")) \
51 DWFL_ERROR (NOMEM, N_("out of memory")) \
52 DWFL_ERROR (ERRNO, N_("See errno")) \
53 DWFL_ERROR (LIBELF, N_("See elf_errno")) \
54 DWFL_ERROR (LIBDW, N_("See dwarf_errno")) \
55 DWFL_ERROR (LIBEBL, N_("See ebl_errno (XXX missing)")) \
Roland McGrathbca43152009-01-05 23:59:32 -080056 DWFL_ERROR (ZLIB, N_("gzip decompression failed")) \
57 DWFL_ERROR (BZLIB, N_("bzip2 decompression failed")) \
Roland McGrath24169642009-08-26 02:26:34 -070058 DWFL_ERROR (LZMA, N_("LZMA decompression failed")) \
Roland McGrath07d4f2f2005-10-28 06:56:24 +000059 DWFL_ERROR (UNKNOWN_MACHINE, N_("no support library found for machine")) \
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000060 DWFL_ERROR (NOREL, N_("Callbacks missing for ET_REL file")) \
61 DWFL_ERROR (BADRELTYPE, N_("Unsupported relocation type")) \
62 DWFL_ERROR (BADRELOFF, N_("r_offset is bogus")) \
63 DWFL_ERROR (BADSTROFF, N_("offset out of range")) \
64 DWFL_ERROR (RELUNDEF, N_("relocation refers to undefined symbol")) \
65 DWFL_ERROR (CB, N_("Callback returned failure")) \
66 DWFL_ERROR (NO_DWARF, N_("No DWARF information found")) \
67 DWFL_ERROR (NO_SYMTAB, N_("No symbol table found")) \
68 DWFL_ERROR (NO_PHDR, N_("No ELF program headers")) \
69 DWFL_ERROR (OVERLAP, N_("address range overlaps an existing module")) \
70 DWFL_ERROR (ADDR_OUTOFRANGE, N_("address out of range")) \
71 DWFL_ERROR (NO_MATCH, N_("no matching address range")) \
72 DWFL_ERROR (TRUNCATED, N_("image truncated")) \
Roland McGrath59ea7f32007-10-04 08:50:09 +000073 DWFL_ERROR (ALREADY_ELF, N_("ELF file opened")) \
Roland McGrathe47ab762005-11-17 03:16:00 +000074 DWFL_ERROR (BADELF, N_("not a valid ELF file")) \
Roland McGrathed431dd2010-05-06 00:52:51 -070075 DWFL_ERROR (WEIRD_TYPE, N_("cannot handle DWARF type description")) \
Roland McGrath5ad466d2011-01-11 10:17:01 -080076 DWFL_ERROR (WRONG_ID_ELF, N_("ELF file does not match build ID")) \
77 DWFL_ERROR (BAD_PRELINK, N_("corrupt .gnu.prelink_undo section data"))
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000078
79#define DWFL_ERROR(name, text) DWFL_E_##name,
80typedef enum { DWFL_ERRORS DWFL_E_NUM } Dwfl_Error;
81#undef DWFL_ERROR
82
83#define OTHER_ERROR(name) ((unsigned int) DWFL_E_##name << 16)
84#define DWFL_E(name, errno) (OTHER_ERROR (name) | (errno))
85
Roland McGrathd11f9cb2008-03-26 20:51:59 +000086extern int __libdwfl_canon_error (Dwfl_Error) internal_function;
87extern void __libdwfl_seterrno (Dwfl_Error) internal_function;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000088
89struct Dwfl
90{
91 const Dwfl_Callbacks *callbacks;
92
93 Dwfl_Module *modulelist; /* List in order used by full traversals. */
94
Roland McGrathd17fac72005-08-23 08:20:21 +000095 GElf_Addr offline_next_address;
Roland McGrathb4d6f0f2008-08-25 22:55:17 +000096
97 GElf_Addr segment_align; /* Smallest granularity of segments. */
98
99 /* Binary search table in three parallel malloc'd arrays. */
100 size_t lookup_elts; /* Elements in use. */
101 size_t lookup_alloc; /* Elements allococated. */
102 GElf_Addr *lookup_addr; /* Start address of segment. */
103 Dwfl_Module **lookup_module; /* Module associated with segment, or null. */
104 int *lookup_segndx; /* User segment index, or -1. */
105
106 /* Cache from last dwfl_report_segment call. */
107 const void *lookup_tail_ident;
108 GElf_Off lookup_tail_vaddr;
109 GElf_Off lookup_tail_offset;
110 int lookup_tail_ndx;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000111};
112
Roland McGrathd17fac72005-08-23 08:20:21 +0000113#define OFFLINE_REDZONE 0x10000
114
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000115struct dwfl_file
116{
117 char *name;
118 int fd;
Roland McGrath59ea7f32007-10-04 08:50:09 +0000119 bool valid; /* The build ID note has been matched. */
Roland McGrathe4c22ea2007-10-23 13:07:39 +0000120 bool relocated; /* Partial relocation of all sections done. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000121
122 Elf *elf;
Roland McGrath1743d7f2010-11-12 16:46:47 -0800123
124 /* This is the lowest p_vaddr in this ELF file, aligned to p_align.
125 For a file without phdrs, this is zero. */
126 GElf_Addr vaddr;
127
128 /* This is an address chosen for synchronization between the main file
Roland McGrath2c7d0dd2011-01-04 19:29:53 -0800129 and the debug file. See dwfl_module_getdwarf.c for how it's chosen. */
Roland McGrath1743d7f2010-11-12 16:46:47 -0800130 GElf_Addr address_sync;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000131};
132
133struct Dwfl_Module
134{
135 Dwfl *dwfl;
Roland McGrathd17fac72005-08-23 08:20:21 +0000136 struct Dwfl_Module *next; /* Link on Dwfl.modulelist. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000137
138 void *userdata;
139
140 char *name; /* Iterator name for this module. */
141 GElf_Addr low_addr, high_addr;
142
143 struct dwfl_file main, debug;
Roland McGrath1743d7f2010-11-12 16:46:47 -0800144 GElf_Addr main_bias;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000145 Ebl *ebl;
Roland McGrathd17fac72005-08-23 08:20:21 +0000146 GElf_Half e_type; /* GElf_Ehdr.e_type cache. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000147 Dwfl_Error elferr; /* Previous failure to open main file. */
148
Roland McGrathd17fac72005-08-23 08:20:21 +0000149 struct dwfl_relocation *reloc_info; /* Relocatable sections. */
150
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000151 struct dwfl_file *symfile; /* Either main or debug. */
152 Elf_Data *symdata; /* Data in the ELF symbol table section. */
153 size_t syments; /* sh_size / sh_entsize of that section. */
Mark Wielaardef431cd2011-10-31 23:17:06 +0100154 int first_global; /* Index of first global symbol of table. */
Ulrich Dreppere1812e12006-07-12 07:46:03 +0000155 Elf_Data *symstrdata; /* Data for its string table. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000156 Elf_Data *symxndxdata; /* Data in the extended section index table. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000157
158 Dwarf *dw; /* libdw handle for its debugging info. */
Roland McGrathfe8b42e2009-07-08 14:54:16 -0700159
160 Dwfl_Error symerr; /* Previous failure to load symbols. */
161 Dwfl_Error dwerr; /* Previous failure to load DWARF. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000162
163 /* Known CU's in this module. */
164 struct dwfl_cu *first_cu, **cu;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000165
166 void *lazy_cu_root; /* Table indexed by Dwarf_Off of CU. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000167
168 struct dwfl_arange *aranges; /* Mapping of addresses in module to CUs. */
Roland McGrathfe8b42e2009-07-08 14:54:16 -0700169
170 void *build_id_bits; /* malloc'd copy of build ID bits. */
171 GElf_Addr build_id_vaddr; /* Address where they reside, 0 if unknown. */
172 int build_id_len; /* -1 for prior failure, 0 if unset. */
173
174 unsigned int ncu;
175 unsigned int lazycu; /* Possible users, deleted when none left. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000176 unsigned int naranges;
177
Roland McGrath3c84db32009-06-24 17:41:40 -0700178 Dwarf_CFI *dwarf_cfi; /* Cached DWARF CFI for this module. */
179 Dwarf_CFI *eh_cfi; /* Cached EH CFI for this module. */
180
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000181 int segment; /* Index of first segment table entry. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000182 bool gc; /* Mark/sweep flag. */
183};
184
185
186
187/* Information cached about each CU in Dwfl_Module.dw. */
188struct dwfl_cu
189{
190 /* This caches libdw information about the CU. It's also the
191 address passed back to users, so we take advantage of the
192 fact that it's placed first to cast back. */
193 Dwarf_Die die;
194
195 Dwfl_Module *mod; /* Pointer back to containing module. */
196
197 struct dwfl_cu *next; /* CU immediately following in the file. */
198
199 struct Dwfl_Lines *lines;
200};
201
202struct Dwfl_Lines
203{
204 struct dwfl_cu *cu;
205
206 /* This is what the opaque Dwfl_Line * pointers we pass to users are.
207 We need to recover pointers to our struct dwfl_cu and a record in
208 libdw's Dwarf_Line table. To minimize the memory used in addition
209 to libdw's Dwarf_Lines buffer, we just point to our own index in
210 this table, and have one pointer back to the CU. The indices here
211 match those in libdw's Dwarf_CU.lines->info table. */
212 struct Dwfl_Line
213 {
214 unsigned int idx; /* My index in the dwfl_cu.lines table. */
215 } idx[0];
216};
217
218static inline struct dwfl_cu *
Ulrich Dreppere1812e12006-07-12 07:46:03 +0000219dwfl_linecu_inline (const Dwfl_Line *line)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000220{
221 const struct Dwfl_Lines *lines = ((const void *) line
222 - offsetof (struct Dwfl_Lines,
223 idx[line->idx]));
224 return lines->cu;
225}
Ulrich Dreppere1812e12006-07-12 07:46:03 +0000226#define dwfl_linecu dwfl_linecu_inline
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000227
Roland McGrath1743d7f2010-11-12 16:46:47 -0800228static inline GElf_Addr
229dwfl_adjusted_address (Dwfl_Module *mod, GElf_Addr addr)
230{
231 return addr + mod->main_bias;
232}
233
234static inline GElf_Addr
235dwfl_deadjust_address (Dwfl_Module *mod, GElf_Addr addr)
236{
237 return addr - mod->main_bias;
238}
239
240static inline Dwarf_Addr
241dwfl_adjusted_dwarf_addr (Dwfl_Module *mod, Dwarf_Addr addr)
242{
243 return dwfl_adjusted_address (mod, (addr
244 - mod->debug.address_sync
245 + mod->main.address_sync));
246}
247
248static inline Dwarf_Addr
249dwfl_deadjust_dwarf_addr (Dwfl_Module *mod, Dwarf_Addr addr)
250{
251 return (dwfl_deadjust_address (mod, addr)
252 - mod->main.address_sync
253 + mod->debug.address_sync);
254}
255
256static inline GElf_Addr
257dwfl_adjusted_st_value (Dwfl_Module *mod, GElf_Addr addr)
258{
259 if (mod->symfile == &mod->main)
260 return dwfl_adjusted_address (mod, addr);
261 return dwfl_adjusted_dwarf_addr (mod, addr);
262}
263
264static inline GElf_Addr
265dwfl_deadjust_st_value (Dwfl_Module *mod, GElf_Addr addr)
266{
267 if (mod->symfile == &mod->main)
268 return dwfl_deadjust_address (mod, addr);
269 return dwfl_deadjust_dwarf_addr (mod, addr);
270}
271
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000272/* This describes a contiguous address range that lies in a single CU.
273 We condense runs of Dwarf_Arange entries for the same CU into this. */
274struct dwfl_arange
275{
276 struct dwfl_cu *cu;
277 size_t arange; /* Index in Dwarf_Aranges. */
278};
279
280
281
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000282extern void __libdwfl_module_free (Dwfl_Module *mod) internal_function;
283
Roland McGratha605a3c2009-04-19 18:27:01 -0700284/* Find the main ELF file, update MOD->elferr and/or MOD->main.elf. */
285extern void __libdwfl_getelf (Dwfl_Module *mod) internal_function;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000286
287/* Process relocations in debugging sections in an ET_REL file.
Roland McGrathe4c22ea2007-10-23 13:07:39 +0000288 FILE must be opened with ELF_C_READ_MMAP_PRIVATE or ELF_C_READ,
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000289 to make it possible to relocate the data in place (or ELF_C_RDWR or
290 ELF_C_RDWR_MMAP if you intend to modify the Elf file on disk). After
Roland McGrathe4c22ea2007-10-23 13:07:39 +0000291 this, dwarf_begin_elf on FILE will read the relocated data.
292
293 When DEBUG is false, apply partial relocation to all sections. */
294extern Dwfl_Error __libdwfl_relocate (Dwfl_Module *mod, Elf *file, bool debug)
295 internal_function;
296
297/* Process (simple) relocations in arbitrary section TSCN of an ET_REL file.
298 RELOCSCN is SHT_REL or SHT_RELA and TSCN is its sh_info target section. */
299extern Dwfl_Error __libdwfl_relocate_section (Dwfl_Module *mod, Elf *relocated,
300 Elf_Scn *relocscn, Elf_Scn *tscn,
301 bool partial)
Roland McGrathd2c59962005-08-10 22:13:57 +0000302 internal_function;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000303
304/* Adjust *VALUE from section-relative to absolute.
305 MOD->dwfl->callbacks->section_address is called to determine the actual
306 address of a loaded section. */
Ulrich Drepperb597dfa2007-10-16 05:21:27 +0000307extern Dwfl_Error __libdwfl_relocate_value (Dwfl_Module *mod, Elf *elf,
308 size_t *shstrndx_cache,
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000309 Elf32_Word shndx,
310 GElf_Addr *value)
311 internal_function;
312
Roland McGrath994b4892005-12-05 22:46:21 +0000313
314/* Ensure that MOD->ebl is set up. */
315extern Dwfl_Error __libdwfl_module_getebl (Dwfl_Module *mod) internal_function;
316
Roland McGrath3c84db32009-06-24 17:41:40 -0700317/* Install a new Dwarf_CFI in *SLOT (MOD->eh_cfi or MOD->dwarf_cfi). */
318extern Dwarf_CFI *__libdwfl_set_cfi (Dwfl_Module *mod, Dwarf_CFI **slot,
319 Dwarf_CFI *cfi)
320 internal_function;
321
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000322/* Iterate through all the CU's in the module. Start by passing a null
323 LASTCU, and then pass the last *CU returned. Success return with null
324 *CU no more CUs. */
325extern Dwfl_Error __libdwfl_nextcu (Dwfl_Module *mod, struct dwfl_cu *lastcu,
326 struct dwfl_cu **cu) internal_function;
327
328/* Find the CU by address. */
329extern Dwfl_Error __libdwfl_addrcu (Dwfl_Module *mod, Dwarf_Addr addr,
330 struct dwfl_cu **cu) internal_function;
331
332/* Ensure that CU->lines (and CU->cu->lines) is set up. */
333extern Dwfl_Error __libdwfl_cu_getsrclines (struct dwfl_cu *cu)
Roland McGrath59ea7f32007-10-04 08:50:09 +0000334 internal_function;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000335
Roland McGrath59ea7f32007-10-04 08:50:09 +0000336/* Look in ELF for an NT_GNU_BUILD_ID note. If SET is true, store it
337 in MOD and return its length. If SET is false, instead compare it
338 to that stored in MOD and return 2 if they match, 1 if they do not.
339 Returns -1 for errors, 0 if no note is found. */
340extern int __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf)
341 internal_function;
342
343/* Open a main or debuginfo file by its build ID, returns the fd. */
344extern int __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug,
345 char **file_name) internal_function;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000346
Ulrich Drepper18618fd2005-07-28 21:29:22 +0000347extern uint32_t __libdwfl_crc32 (uint32_t crc, unsigned char *buf, size_t len)
Roland McGrath59ea7f32007-10-04 08:50:09 +0000348 attribute_hidden;
Ulrich Drepper18618fd2005-07-28 21:29:22 +0000349extern int __libdwfl_crc32_file (int fd, uint32_t *resp) attribute_hidden;
350
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000351
Ulrich Drepperb597dfa2007-10-16 05:21:27 +0000352/* Meat of dwfl_report_elf, given elf_begin just called.
353 Consumes ELF on success, not on failure. */
354extern Dwfl_Module *__libdwfl_report_elf (Dwfl *dwfl, const char *name,
355 const char *file_name, int fd,
Roland McGrath5453abf2009-02-10 17:33:49 -0800356 Elf *elf, GElf_Addr base, bool sanity)
Ulrich Drepperb597dfa2007-10-16 05:21:27 +0000357 internal_function;
358
359/* Meat of dwfl_report_offline. */
360extern Dwfl_Module *__libdwfl_report_offline (Dwfl *dwfl, const char *name,
361 const char *file_name,
362 int fd, bool closefd,
363 int (*predicate) (const char *,
364 const char *))
365 internal_function;
366
Roland McGrathbca43152009-01-05 23:59:32 -0800367/* Decompression wrappers: decompress whole file into memory. */
368extern Dwfl_Error __libdw_gunzip (int fd, off64_t start_offset,
369 void *mapped, size_t mapped_size,
370 void **whole, size_t *whole_size)
371 internal_function;
Roland McGrath24169642009-08-26 02:26:34 -0700372extern Dwfl_Error __libdw_bunzip2 (int fd, off64_t start_offset,
373 void *mapped, size_t mapped_size,
374 void **whole, size_t *whole_size)
375 internal_function;
376extern Dwfl_Error __libdw_unlzma (int fd, off64_t start_offset,
377 void *mapped, size_t mapped_size,
378 void **whole, size_t *whole_size)
Roland McGrathbca43152009-01-05 23:59:32 -0800379 internal_function;
380
Roland McGrath6bb90712009-08-27 12:36:47 -0700381/* Skip the image header before a file image: updates *START_OFFSET. */
382extern Dwfl_Error __libdw_image_header (int fd, off64_t *start_offset,
383 void *mapped, size_t mapped_size)
384 internal_function;
385
Roland McGrathbca43152009-01-05 23:59:32 -0800386/* Open Elf handle on *FDP. This handles decompression and checks
387 elf_kind. Succeed only for ELF_K_ELF, or also ELF_K_AR if ARCHIVE_OK.
388 Returns DWFL_E_NOERROR and sets *ELFP on success, resets *FDP to -1 if
389 it's no longer used. Resets *FDP on failure too iff CLOSE_ON_FAIL. */
390extern Dwfl_Error __libdw_open_file (int *fdp, Elf **elfp,
391 bool close_on_fail, bool archive_ok)
392 internal_function;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000393
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000394/* These are working nicely for --core, but are not ready to be
395 exported interfaces quite yet. */
396
397/* Type of callback function ...
398 */
399typedef bool Dwfl_Memory_Callback (Dwfl *dwfl, int segndx,
400 void **buffer, size_t *buffer_available,
401 GElf_Addr vaddr, size_t minread, void *arg);
402
403/* Type of callback function ...
404 */
405typedef bool Dwfl_Module_Callback (Dwfl_Module *mod, void **userdata,
406 const char *name, Dwarf_Addr base,
407 void **buffer, size_t *buffer_available,
408 GElf_Off cost, GElf_Off worthwhile,
409 GElf_Off whole, GElf_Off contiguous,
410 void *arg, Elf **elfp);
411
412/* ...
413 */
414extern int dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
415 Dwfl_Memory_Callback *memory_callback,
416 void *memory_callback_arg,
417 Dwfl_Module_Callback *read_eagerly,
418 void *read_eagerly_arg);
419
420/* Report a module for entry in the dynamic linker's struct link_map list.
421 For each link_map entry, if an existing module resides at its address,
422 this just modifies that module's name and suggested file name. If
423 no such module exists, this calls dwfl_report_elf on the l_name string.
424
425 If AUXV is not null, it points to AUXV_SIZE bytes of auxiliary vector
426 data as contained in an NT_AUXV note or read from a /proc/pid/auxv
427 file. When this is available, it guides the search. If AUXV is null
428 or the memory it points to is not accessible, then this search can
429 only find where to begin if the correct executable file was
430 previously reported and preloaded as with dwfl_report_elf.
431
432 Returns the number of modules found, or -1 for errors. */
433extern int dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
434 Dwfl_Memory_Callback *memory_callback,
435 void *memory_callback_arg);
436
Roland McGrathbca43152009-01-05 23:59:32 -0800437
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000438/* Avoid PLT entries. */
439INTDECL (dwfl_begin)
440INTDECL (dwfl_errmsg)
Roland McGrathed431dd2010-05-06 00:52:51 -0700441INTDECL (dwfl_errno)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000442INTDECL (dwfl_addrmodule)
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000443INTDECL (dwfl_addrsegment)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000444INTDECL (dwfl_addrdwarf)
445INTDECL (dwfl_addrdie)
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000446INTDECL (dwfl_core_file_report)
447INTDECL (dwfl_getmodules)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000448INTDECL (dwfl_module_addrdie)
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000449INTDECL (dwfl_module_address_section)
Ulrich Drepper6258e742007-03-13 06:22:40 +0000450INTDECL (dwfl_module_addrsym)
Roland McGrath59ea7f32007-10-04 08:50:09 +0000451INTDECL (dwfl_module_build_id)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000452INTDECL (dwfl_module_getdwarf)
453INTDECL (dwfl_module_getelf)
Ulrich Dreppere1812e12006-07-12 07:46:03 +0000454INTDECL (dwfl_module_getsym)
455INTDECL (dwfl_module_getsymtab)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000456INTDECL (dwfl_module_getsrc)
Roland McGrath59ea7f32007-10-04 08:50:09 +0000457INTDECL (dwfl_module_report_build_id)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000458INTDECL (dwfl_report_elf)
459INTDECL (dwfl_report_begin)
Ulrich Drepper6258e742007-03-13 06:22:40 +0000460INTDECL (dwfl_report_begin_add)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000461INTDECL (dwfl_report_module)
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000462INTDECL (dwfl_report_segment)
Roland McGrathd17fac72005-08-23 08:20:21 +0000463INTDECL (dwfl_report_offline)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000464INTDECL (dwfl_report_end)
Roland McGrath59ea7f32007-10-04 08:50:09 +0000465INTDECL (dwfl_build_id_find_elf)
466INTDECL (dwfl_build_id_find_debuginfo)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000467INTDECL (dwfl_standard_find_debuginfo)
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000468INTDECL (dwfl_link_map_report)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000469INTDECL (dwfl_linux_kernel_find_elf)
470INTDECL (dwfl_linux_kernel_module_section_address)
471INTDECL (dwfl_linux_proc_report)
Roland McGrath1656bc02005-12-23 01:49:50 +0000472INTDECL (dwfl_linux_proc_maps_report)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000473INTDECL (dwfl_linux_proc_find_elf)
474INTDECL (dwfl_linux_kernel_report_kernel)
475INTDECL (dwfl_linux_kernel_report_modules)
Roland McGrathd17fac72005-08-23 08:20:21 +0000476INTDECL (dwfl_linux_kernel_report_offline)
477INTDECL (dwfl_offline_section_address)
478INTDECL (dwfl_module_relocate_address)
Roland McGrath3c84db32009-06-24 17:41:40 -0700479INTDECL (dwfl_module_dwarf_cfi)
480INTDECL (dwfl_module_eh_cfi)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000481
482/* Leading arguments standard to callbacks passed a Dwfl_Module. */
483#define MODCB_ARGS(mod) (mod), &(mod)->userdata, (mod)->name, (mod)->low_addr
484#define CBFAIL (errno ? DWFL_E (ERRNO, errno) : DWFL_E_CB);
485
486
Roland McGratha1cee072006-08-15 01:37:23 +0000487/* The default used by dwfl_standard_find_debuginfo. */
488#define DEFAULT_DEBUGINFO_PATH ":.debug:/usr/lib/debug"
489
490
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000491#endif /* libdwflP.h */