1 /* libunwind - a platform-independent unwind library
3 This file is part of libunwind.
5 Permission is hereby granted, free of charge, to any person obtaining
6 a copy of this software and associated documentation files (the
7 "Software"), to deal in the Software without restriction, including
8 without limitation the rights to use, copy, modify, merge, publish,
9 distribute, sublicense, and/or sell copies of the Software, and to
10 permit persons to whom the Software is furnished to do so, subject to
11 the following conditions:
13 The above copyright notice and this permission notice shall be
14 included in all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
24 #ifndef _UCD_internal_h
25 #define _UCD_internal_h
31 #ifdef HAVE_SYS_TYPES_H
32 #include <sys/types.h>
34 #ifdef HAVE_SYS_PROCFS_H
35 #include <sys/procfs.h> /* struct elf_prstatus */
43 #include <libunwind-coredump.h>
45 #include "libunwind_i.h"
49 typedef uint32_t uoff_t
;
50 #elif SIZEOF_OFF_T == 8
51 typedef uint64_t uoff_t
;
53 # error Unknown size of off_t!
57 /* Similar to ELF phdrs. p_paddr element is absent,
58 * since it's always 0 in coredumps.
69 /* Data for backing file. If backing_fd < 0, there is no file */
70 uoff_t backing_filesize
;
71 char *backing_filename
; /* for error meesages only */
75 typedef struct coredump_phdr coredump_phdr_t
;
77 #if defined(HAVE_STRUCT_ELF_PRSTATUS)
78 #define PRSTATUS_STRUCT elf_prstatus
79 #elif defined(HAVE_STRUCT_PRSTATUS)
80 #define PRSTATUS_STRUCT prstatus
82 #define PRSTATUS_STRUCT non_existent
87 int big_endian
; /* bool */
89 char *coredump_filename
; /* for error meesages only */
90 coredump_phdr_t
*phdrs
; /* array, allocated */
92 void *note_phdr
; /* allocated or NULL */
93 struct PRSTATUS_STRUCT
*prstatus
; /* points inside note_phdr */
95 struct PRSTATUS_STRUCT
**threads
;
97 struct elf_dyn_info edi
;
100 extern coredump_phdr_t
* _UCD_get_elf_image(struct UCD_info
*ui
, unw_word_t ip
);
102 #define STRUCT_MEMBER_P(struct_p, struct_offset) ((void *) ((char*) (struct_p) + (long) (struct_offset)))
103 #define STRUCT_MEMBER(member_type, struct_p, struct_offset) (*(member_type*) STRUCT_MEMBER_P ((struct_p), (struct_offset)))