blob: b3402d862d8722fc32fc5991cbb61d71461fbebe [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001/* Internal definitions for libdwarf.
Roland McGrathebc5c882010-01-05 22:53:31 -08002 Copyright (C) 2002-2010 Red Hat, Inc.
Ulrich Drepper361df7d2006-04-04 21:38:57 +00003 This file is part of Red Hat elfutils.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00004 Written by Ulrich Drepper <drepper@redhat.com>, 2002.
5
Ulrich Drepper361df7d2006-04-04 21:38:57 +00006 Red Hat elfutils is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by the
8 Free Software Foundation; version 2 of the License.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00009
Ulrich Drepper361df7d2006-04-04 21:38:57 +000010 Red Hat elfutils is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with Red Hat elfutils; if not, write to the Free Software Foundation,
Ulrich Drepper1e9ef502006-04-04 22:29:06 +000017 Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
Ulrich Drepper361df7d2006-04-04 21:38:57 +000018
19 In addition, as a special exception, Red Hat, Inc. gives You the
20 additional right to link the code of Red Hat elfutils with code licensed
21 under any Open Source Initiative certified open source license
22 (http://www.opensource.org/licenses/index.php) which requires the
23 distribution of source code with any binary distribution and to
24 distribute linked combinations of the two. Non-GPL Code permitted under
25 this exception must only link to the code of Red Hat elfutils through
26 those well defined interfaces identified in the file named EXCEPTION
27 found in the source code files (the "Approved Interfaces"). The files
28 of Non-GPL Code may instantiate templates or use macros or inline
29 functions from the Approved Interfaces without causing the resulting
30 work to be covered by the GNU General Public License. Only Red Hat,
31 Inc. may make changes or additions to the list of Approved Interfaces.
32 Red Hat's grant of this exception is conditioned upon your not adding
33 any new exceptions. If you wish to add a new Approved Interface or
34 exception, please contact Red Hat. You must obey the GNU General Public
35 License in all respects for all of the Red Hat elfutils code and other
36 code used in conjunction with Red Hat elfutils except the Non-GPL Code
37 covered by this exception. If you modify this file, you may extend this
38 exception to your version of the file, but you are not obligated to do
39 so. If you do not wish to provide this exception without modification,
40 you must delete this exception statement from your version and license
41 this file solely under the GPL without exception.
42
43 Red Hat elfutils is an included package of the Open Invention Network.
44 An included package of the Open Invention Network is a package for which
45 Open Invention Network licensees cross-license their patents. No patent
46 license is granted, either expressly or impliedly, by designation as an
47 included package. Should you wish to participate in the Open Invention
48 Network licensing program, please visit www.openinventionnetwork.com
49 <http://www.openinventionnetwork.com>. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000050
51#ifndef _LIBDWP_H
52#define _LIBDWP_H 1
53
54#include <libintl.h>
55#include <stdbool.h>
56
57#include <libdw.h>
58
59
60/* gettext helper macros. */
61#define _(Str) dgettext ("elfutils", Str)
62
63
64/* Version of the DWARF specification we support. */
Ulrich Drepper35f08c42008-01-18 19:59:08 +000065#define DWARF_VERSION 3
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000066
67/* Version of the CIE format. */
68#define CIE_VERSION 1
69
70
Roland McGrath6724c902005-10-28 07:07:19 +000071/* Known location expressions already decoded. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000072struct loc_s
73{
74 void *addr;
Roland McGrath6724c902005-10-28 07:07:19 +000075 Dwarf_Op *loc;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000076 size_t nloc;
77};
78
Roland McGrathf0371042009-09-10 12:39:09 -070079/* Known DW_OP_implicit_value blocks already decoded.
80 This overlaps struct loc_s exactly, but only the
81 first member really has to match. */
82struct loc_block_s
83{
84 void *addr;
85 unsigned char *data;
86 size_t length;
87};
88
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000089/* Valid indeces for the section data. */
90enum
91 {
92 IDX_debug_info = 0,
93 IDX_debug_abbrev,
94 IDX_debug_aranges,
95 IDX_debug_line,
96 IDX_debug_frame,
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000097 IDX_debug_loc,
98 IDX_debug_pubnames,
99 IDX_debug_str,
100 IDX_debug_funcnames,
101 IDX_debug_typenames,
102 IDX_debug_varnames,
103 IDX_debug_weaknames,
104 IDX_debug_macinfo,
105 IDX_debug_ranges,
106 IDX_last
107 };
108
109
110/* Error values. */
111enum
112{
113 DWARF_E_NOERROR = 0,
114 DWARF_E_UNKNOWN_ERROR,
115 DWARF_E_INVALID_ACCESS,
116 DWARF_E_NO_REGFILE,
117 DWARF_E_IO_ERROR,
118 DWARF_E_INVALID_ELF,
119 DWARF_E_NO_DWARF,
120 DWARF_E_NOELF,
121 DWARF_E_GETEHDR_ERROR,
122 DWARF_E_NOMEM,
123 DWARF_E_UNIMPL,
124 DWARF_E_INVALID_CMD,
125 DWARF_E_INVALID_VERSION,
126 DWARF_E_INVALID_FILE,
127 DWARF_E_NO_ENTRY,
128 DWARF_E_INVALID_DWARF,
129 DWARF_E_NO_STRING,
130 DWARF_E_NO_ADDR,
131 DWARF_E_NO_CONSTANT,
132 DWARF_E_NO_REFERENCE,
133 DWARF_E_INVALID_REFERENCE,
134 DWARF_E_NO_DEBUG_LINE,
135 DWARF_E_INVALID_DEBUG_LINE,
136 DWARF_E_TOO_BIG,
137 DWARF_E_VERSION,
138 DWARF_E_INVALID_DIR_IDX,
139 DWARF_E_ADDR_OUTOFRANGE,
140 DWARF_E_NO_LOCLIST,
141 DWARF_E_NO_BLOCK,
142 DWARF_E_INVALID_LINE_IDX,
143 DWARF_E_INVALID_ARANGE_IDX,
144 DWARF_E_NO_MATCH,
145 DWARF_E_NO_FLAG,
146 DWARF_E_INVALID_OFFSET,
147 DWARF_E_NO_DEBUG_RANGES,
Roland McGrath3c84db32009-06-24 17:41:40 -0700148 DWARF_E_INVALID_CFI,
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000149};
150
151
152/* This is the structure representing the debugging state. */
153struct Dwarf
154{
155 /* The underlying ELF file. */
156 Elf *elf;
157
158 /* The section data. */
159 Elf_Data *sectiondata[IDX_last];
160
161 /* True if the file has a byte order different from the host. */
162 bool other_byte_order;
163
164 /* If true, we allocated the ELF descriptor ourselves. */
165 bool free_elf;
166
167 /* Information for traversing the .debug_pubnames section. This is
168 an array and separately allocated with malloc. */
169 struct pubnames_s
170 {
171 Dwarf_Off cu_offset;
172 Dwarf_Off set_start;
173 unsigned int cu_header_size;
174 int address_len;
175 } *pubnames_sets;
176 size_t pubnames_nsets;
177
178 /* Search tree for the CUs. */
179 void *cu_tree;
180 Dwarf_Off next_cu_offset;
181
182 /* Address ranges. */
183 Dwarf_Aranges *aranges;
184
Roland McGrath3c84db32009-06-24 17:41:40 -0700185 /* Cached info from the CFI section. */
186 struct Dwarf_CFI_s *cfi;
187
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000188 /* Internal memory handling. This is basically a simplified
189 reimplementation of obstacks. Unfortunately the standard obstack
190 implementation is not usable in libraries. */
191 struct libdw_memblock
192 {
193 size_t size;
194 size_t remaining;
195 struct libdw_memblock *prev;
196 char mem[0];
197 } *mem_tail;
198
199 /* Default size of allocated memory blocks. */
200 size_t mem_default_size;
201
202 /* Registered OOM handler. */
203 Dwarf_OOM oom_handler;
204};
205
206
207/* Abbreviation representation. */
208struct Dwarf_Abbrev
209{
Roland McGrath1f6d2012008-12-31 00:21:04 -0800210 Dwarf_Off offset;
211 unsigned char *attrp;
212 unsigned int attrcnt;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000213 unsigned int code;
214 unsigned int tag;
Roland McGrath1f6d2012008-12-31 00:21:04 -0800215 bool has_children;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000216};
217
218#include "dwarf_abbrev_hash.h"
219
220
221/* Files in line information records. */
222struct Dwarf_Files_s
223 {
Roland McGrathc5acb302009-01-28 18:28:52 -0800224 struct Dwarf_CU *cu;
Roland McGrath43da9892007-04-16 23:13:37 +0000225 unsigned int ndirs;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000226 unsigned int nfiles;
227 struct Dwarf_Fileinfo_s
228 {
229 char *name;
230 Dwarf_Word mtime;
231 Dwarf_Word length;
232 } info[0];
Roland McGrath43da9892007-04-16 23:13:37 +0000233 /* nfiles of those, followed by char *[ndirs]. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000234 };
235typedef struct Dwarf_Fileinfo_s Dwarf_Fileinfo;
236
237
238/* Representation of a row in the line table. */
Roland McGrath03288f02009-01-28 22:00:54 -0800239
240struct Dwarf_Line_s
241{
Roland McGrath6e1f4652009-07-08 14:48:34 -0700242 Dwarf_Files *files;
243
Roland McGrath03288f02009-01-28 22:00:54 -0800244 Dwarf_Addr addr;
245 unsigned int file;
246 int line;
247 unsigned short int column;
248 unsigned int is_stmt:1;
249 unsigned int basic_block:1;
250 unsigned int end_sequence:1;
251 unsigned int prologue_end:1;
252 unsigned int epilogue_begin:1;
Roland McGrath03288f02009-01-28 22:00:54 -0800253};
254
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000255struct Dwarf_Lines_s
Roland McGrath03288f02009-01-28 22:00:54 -0800256{
257 size_t nlines;
258 struct Dwarf_Line_s info[0];
259};
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000260
261/* Representation of address ranges. */
262struct Dwarf_Aranges_s
263{
264 Dwarf *dbg;
265 size_t naranges;
266
267 struct Dwarf_Arange_s
268 {
269 Dwarf_Addr addr;
270 Dwarf_Word length;
271 Dwarf_Off offset;
272 } info[0];
273};
274
275
276/* CU representation. */
277struct Dwarf_CU
278{
279 Dwarf *dbg;
280 Dwarf_Off start;
281 Dwarf_Off end;
282 uint8_t address_size;
283 uint8_t offset_size;
Roland McGrathe4c22ea2007-10-23 13:07:39 +0000284 uint16_t version;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000285
286 /* Hash table for the abbreviations. */
287 Dwarf_Abbrev_Hash abbrev_hash;
288 /* Offset of the first abbreviation. */
289 size_t orig_abbrev_offset;
290 /* Offset past last read abbreviation. */
291 size_t last_abbrev_offset;
292
293 /* The srcline information. */
294 Dwarf_Lines *lines;
295
296 /* The source file information. */
297 Dwarf_Files *files;
298
299 /* Known location lists. */
300 void *locs;
301};
302
Ulrich Drepper35f08c42008-01-18 19:59:08 +0000303/* Compute the offset of a CU's first DIE from its offset. This
304 is either:
305 LEN VER OFFSET ADDR
306 4-bytes + 2-bytes + 4-bytes + 1-byte for 32-bit dwarf
307 12-bytes + 2-bytes + 8-bytes + 1-byte for 64-bit dwarf
Ulrich Dreppera969d8e2008-01-22 06:15:00 +0000308
Ulrich Drepper35f08c42008-01-18 19:59:08 +0000309 Note the trick in the computation. If the offset_size is 4
310 the '- 4' term changes the '3 *' into a '2 *'. If the
311 offset_size is 8 it accounts for the 4-byte escape value
312 used at the start of the length. */
313#define DIE_OFFSET_FROM_CU_OFFSET(cu_offset, offset_size) \
314 ((cu_offset) + 3 * (offset_size) - 4 + 3)
315
Ulrich Drepperdb1d5432006-10-10 15:34:34 +0000316#define CUDIE(fromcu) \
Roland McGrath6724c902005-10-28 07:07:19 +0000317 ((Dwarf_Die) \
318 { \
319 .cu = (fromcu), \
320 .addr = ((char *) (fromcu)->dbg->sectiondata[IDX_debug_info]->d_buf \
321 + (fromcu)->start + 3 * (fromcu)->offset_size - 4 + 3), \
322 })
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000323
324
325/* Macro information. */
326struct Dwarf_Macro_s
327{
328 unsigned int opcode;
329 Dwarf_Word param1;
330 union
331 {
332 Dwarf_Word u;
333 const char *s;
334 } param2;
335};
336
337
338/* We have to include the file at this point because the inline
339 functions access internals of the Dwarf structure. */
340#include "memory-access.h"
341
342
343/* Set error value. */
344extern void __libdw_seterrno (int value) internal_function;
345
346
347/* Memory handling, the easy parts. This macro does not do any locking. */
Ulrich Drepperdb1d5432006-10-10 15:34:34 +0000348#define libdw_alloc(dbg, type, tsize, cnt) \
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000349 ({ struct libdw_memblock *_tail = (dbg)->mem_tail; \
350 size_t _required = (tsize) * (cnt); \
351 type *_result = (type *) (_tail->mem + (_tail->size - _tail->remaining));\
352 size_t _padding = ((__alignof (type) \
353 - ((uintptr_t) _result & (__alignof (type) - 1))) \
354 & (__alignof (type) - 1)); \
355 if (unlikely (_tail->remaining < _required + _padding)) \
Roland McGrathc373d852006-10-10 00:25:21 +0000356 _result = (type *) __libdw_allocate (dbg, _required, __alignof (type));\
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000357 else \
358 { \
359 _required += _padding; \
360 _result = (type *) ((char *) _result + _padding); \
Roland McGrathc373d852006-10-10 00:25:21 +0000361 _tail->remaining -= _required; \
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000362 } \
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000363 _result; })
364
365#define libdw_typed_alloc(dbg, type) \
366 libdw_alloc (dbg, type, sizeof (type), 1)
367
368/* Callback to allocate more. */
Roland McGrathc373d852006-10-10 00:25:21 +0000369extern void *__libdw_allocate (Dwarf *dbg, size_t minsize, size_t align)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000370 __attribute__ ((__malloc__)) __nonnull_attribute__ (1);
371
372/* Default OOM handler. */
373extern void __libdw_oom (void) __attribute ((noreturn, visibility ("hidden")));
374
375/* Find CU for given offset. */
376extern struct Dwarf_CU *__libdw_findcu (Dwarf *dbg, Dwarf_Off offset)
377 __nonnull_attribute__ (1) internal_function;
378
379/* Return tag of given DIE. */
380extern Dwarf_Abbrev *__libdw_findabbrev (struct Dwarf_CU *cu,
381 unsigned int code)
382 __nonnull_attribute__ (1) internal_function;
383
384/* Get abbreviation at given offset. */
385extern Dwarf_Abbrev *__libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu,
386 Dwarf_Off offset, size_t *lengthp,
387 Dwarf_Abbrev *result)
388 __nonnull_attribute__ (1) internal_function;
389
390/* Helper functions for form handling. */
391extern size_t __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu,
392 unsigned int form,
393 const unsigned char *valp)
394 __nonnull_attribute__ (1, 2, 4) internal_function;
395
Roland McGrathe4c22ea2007-10-23 13:07:39 +0000396/* Helper function for DW_FORM_ref* handling. */
397extern int __libdw_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
398 __nonnull_attribute__ (1, 2) internal_function;
399
400
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000401/* Helper function to locate attribute. */
402extern unsigned char *__libdw_find_attr (Dwarf_Die *die,
403 unsigned int search_name,
404 unsigned int *codep,
405 unsigned int *formp)
406 __nonnull_attribute__ (1) internal_function;
407
408/* Helper function to access integer attribute. */
Roland McGrath6724c902005-10-28 07:07:19 +0000409extern int __libdw_attr_intval (Dwarf_Die *die, int *valp, int attval)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000410 __nonnull_attribute__ (1, 2) internal_function;
411
Roland McGrath1ecb6062005-08-15 09:53:04 +0000412/* Helper function to walk scopes. */
Roland McGrath71e15a02005-08-27 10:33:26 +0000413struct Dwarf_Die_Chain
414{
415 Dwarf_Die die;
416 struct Dwarf_Die_Chain *parent;
417 bool prune; /* The PREVISIT function can set this. */
418};
419extern int __libdw_visit_scopes (unsigned int depth,
420 struct Dwarf_Die_Chain *root,
421 int (*previsit) (unsigned int depth,
422 struct Dwarf_Die_Chain *,
423 void *arg),
424 int (*postvisit) (unsigned int depth,
425 struct Dwarf_Die_Chain *,
426 void *arg),
Roland McGrath1ecb6062005-08-15 09:53:04 +0000427 void *arg)
428 __nonnull_attribute__ (2, 3) internal_function;
429
Roland McGrath3c84db32009-06-24 17:41:40 -0700430/* Parse a DWARF Dwarf_Block into an array of Dwarf_Op's,
431 and cache the result (via tsearch). */
432extern int __libdw_intern_expression (Dwarf *dbg,
433 bool other_byte_order,
434 unsigned int address_size,
Roland McGrath688f7fc2010-05-08 03:22:59 -0700435 unsigned int ref_size,
Roland McGrath3c84db32009-06-24 17:41:40 -0700436 void **cache, const Dwarf_Block *block,
Roland McGrath0ab97832010-04-26 11:50:27 -0700437 bool cfap, bool valuep,
Roland McGrath3c84db32009-06-24 17:41:40 -0700438 Dwarf_Op **llbuf, size_t *listlen,
439 int sec_index)
Roland McGrath688f7fc2010-05-08 03:22:59 -0700440 __nonnull_attribute__ (5, 6, 9, 10) internal_function;
Roland McGrath3c84db32009-06-24 17:41:40 -0700441
442
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000443/* Return error code of last failing function call. This value is kept
444 separately for each thread. */
445extern int __dwarf_errno_internal (void);
446
447
Ulrich Drepper99d23722009-06-14 20:19:45 -0700448/* Reader hooks. */
449
450/* Relocation hooks return -1 on error (in that case the error code
451 must already have been set), 0 if there is no relocation and 1 if a
452 relocation was present.*/
453
454static inline int
455__libdw_relocate_address (Dwarf *dbg __attribute__ ((unused)),
456 int sec_index __attribute__ ((unused)),
457 const void *addr __attribute__ ((unused)),
458 int width __attribute__ ((unused)),
459 Dwarf_Addr *val __attribute__ ((unused)))
460{
461 return 0;
462}
463
464static inline int
465__libdw_relocate_offset (Dwarf *dbg __attribute__ ((unused)),
466 int sec_index __attribute__ ((unused)),
467 const void *addr __attribute__ ((unused)),
468 int width __attribute__ ((unused)),
469 Dwarf_Off *val __attribute__ ((unused)))
470{
471 return 0;
472}
473
474static inline Elf_Data *
475__libdw_checked_get_data (Dwarf *dbg, int sec_index)
476{
477 Elf_Data *data = dbg->sectiondata[sec_index];
478 if (unlikely (data == NULL)
479 || unlikely (data->d_buf == NULL))
480 {
481 __libdw_seterrno (DWARF_E_INVALID_DWARF);
482 return NULL;
483 }
484 return data;
485}
486
487static inline int
488__libdw_offset_in_section (Dwarf *dbg, int sec_index,
489 Dwarf_Off offset, size_t size)
490{
491 Elf_Data *data = __libdw_checked_get_data (dbg, sec_index);
492 if (data == NULL)
493 return -1;
494 if (unlikely (offset > data->d_size)
495 || unlikely (data->d_size - offset < size))
496 {
497 __libdw_seterrno (DWARF_E_INVALID_OFFSET);
498 return -1;
499 }
500
501 return 0;
502}
503
504static inline bool
505__libdw_in_section (Dwarf *dbg, int sec_index,
506 const void *addr, size_t size)
507{
508 Elf_Data *data = __libdw_checked_get_data (dbg, sec_index);
509 if (data == NULL)
510 return false;
511 if (unlikely (addr < data->d_buf)
512 || unlikely (data->d_size - (addr - data->d_buf) < size))
513 {
514 __libdw_seterrno (DWARF_E_INVALID_OFFSET);
515 return false;
516 }
517
518 return true;
519}
520
521#define READ_AND_RELOCATE(RELOC_HOOK, VAL) \
522 ({ \
523 if (!__libdw_in_section (dbg, sec_index, addr, width)) \
524 return -1; \
525 \
526 const unsigned char *orig_addr = addr; \
527 if (width == 4) \
528 VAL = read_4ubyte_unaligned_inc (dbg, addr); \
529 else \
530 VAL = read_8ubyte_unaligned_inc (dbg, addr); \
531 \
532 int status = RELOC_HOOK (dbg, sec_index, orig_addr, width, &VAL); \
533 if (status < 0) \
534 return status; \
535 status > 0; \
536 })
537
538static inline int
539__libdw_read_address_inc (Dwarf *dbg,
Roland McGrath05c4e042009-06-18 13:56:02 -0700540 int sec_index, const unsigned char **addrp,
Ulrich Drepper99d23722009-06-14 20:19:45 -0700541 int width, Dwarf_Addr *ret)
542{
Roland McGrath05c4e042009-06-18 13:56:02 -0700543 const unsigned char *addr = *addrp;
Ulrich Drepper99d23722009-06-14 20:19:45 -0700544 READ_AND_RELOCATE (__libdw_relocate_address, (*ret));
545 *addrp = addr;
546 return 0;
547}
548
549static inline int
550__libdw_read_address (Dwarf *dbg,
551 int sec_index, const unsigned char *addr,
552 int width, Dwarf_Addr *ret)
553{
554 READ_AND_RELOCATE (__libdw_relocate_address, (*ret));
555 return 0;
556}
557
558static inline int
559__libdw_read_offset_inc (Dwarf *dbg,
Roland McGrath05c4e042009-06-18 13:56:02 -0700560 int sec_index, const unsigned char **addrp,
Ulrich Drepper99d23722009-06-14 20:19:45 -0700561 int width, Dwarf_Off *ret, int sec_ret,
562 size_t size)
563{
Roland McGrath05c4e042009-06-18 13:56:02 -0700564 const unsigned char *addr = *addrp;
Ulrich Drepper99d23722009-06-14 20:19:45 -0700565 READ_AND_RELOCATE (__libdw_relocate_offset, (*ret));
566 *addrp = addr;
567 return __libdw_offset_in_section (dbg, sec_ret, *ret, size);
568}
569
570static inline int
571__libdw_read_offset (Dwarf *dbg,
572 int sec_index, const unsigned char *addr,
573 int width, Dwarf_Off *ret, int sec_ret,
574 size_t size)
575{
576 READ_AND_RELOCATE (__libdw_relocate_offset, (*ret));
577 return __libdw_offset_in_section (dbg, sec_ret, *ret, size);
578}
579
580/* Read up begin/end pair and increment read pointer.
581 - If it's normal range record, set up *BEGINP and *ENDP and return 0.
582 - If it's base address selection record, set up *BASEP and return 1.
583 - If it's end of rangelist, don't set anything and return 2
584 - If an error occurs, don't set anything and return <0. */
585int __libdw_read_begin_end_pair_inc (Dwarf *dbg, int sec_index,
586 unsigned char **addr, int width,
587 Dwarf_Addr *beginp, Dwarf_Addr *endp,
588 Dwarf_Addr *basep)
589 internal_function;
590
591unsigned char * __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
592 int err_nodata, unsigned char **endpp,
593 Dwarf_Off *offsetp)
594 internal_function;
595
596
597
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000598/* Aliases to avoid PLTs. */
Roland McGrathebc5c882010-01-05 22:53:31 -0800599INTDECL (dwarf_aggregate_size)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000600INTDECL (dwarf_attr)
601INTDECL (dwarf_attr_integrate)
602INTDECL (dwarf_begin_elf)
603INTDECL (dwarf_child)
604INTDECL (dwarf_dieoffset)
Roland McGrath71e15a02005-08-27 10:33:26 +0000605INTDECL (dwarf_diename)
Roland McGrath4959bf82005-08-09 10:31:08 +0000606INTDECL (dwarf_end)
Roland McGrath07d4f2f2005-10-28 06:56:24 +0000607INTDECL (dwarf_entrypc)
Roland McGrath4959bf82005-08-09 10:31:08 +0000608INTDECL (dwarf_errmsg)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000609INTDECL (dwarf_formaddr)
610INTDECL (dwarf_formblock)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000611INTDECL (dwarf_formref_die)
612INTDECL (dwarf_formsdata)
613INTDECL (dwarf_formstring)
614INTDECL (dwarf_formudata)
615INTDECL (dwarf_getarange_addr)
616INTDECL (dwarf_getarangeinfo)
617INTDECL (dwarf_getaranges)
618INTDECL (dwarf_getsrcfiles)
619INTDECL (dwarf_getsrclines)
620INTDECL (dwarf_hasattr)
621INTDECL (dwarf_haschildren)
622INTDECL (dwarf_haspc)
623INTDECL (dwarf_highpc)
624INTDECL (dwarf_lowpc)
625INTDECL (dwarf_nextcu)
626INTDECL (dwarf_offdie)
Roland McGrath07d4f2f2005-10-28 06:56:24 +0000627INTDECL (dwarf_ranges)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000628INTDECL (dwarf_siblingof)
Roland McGrathebc5c882010-01-05 22:53:31 -0800629INTDECL (dwarf_srclang)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000630INTDECL (dwarf_tag)
631
632#endif /* libdwP.h */