/src/libunwind/include/tdep-x86_64/libunwind_i.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* libunwind - a platform-independent unwind library |
2 | | Copyright (C) 2002-2005 Hewlett-Packard Co |
3 | | Contributed by David Mosberger-Tang <davidm@hpl.hp.com> |
4 | | |
5 | | Modified for x86_64 by Max Asbock <masbock@us.ibm.com> |
6 | | |
7 | | This file is part of libunwind. |
8 | | |
9 | | Permission is hereby granted, free of charge, to any person obtaining |
10 | | a copy of this software and associated documentation files (the |
11 | | "Software"), to deal in the Software without restriction, including |
12 | | without limitation the rights to use, copy, modify, merge, publish, |
13 | | distribute, sublicense, and/or sell copies of the Software, and to |
14 | | permit persons to whom the Software is furnished to do so, subject to |
15 | | the following conditions: |
16 | | |
17 | | The above copyright notice and this permission notice shall be |
18 | | included in all copies or substantial portions of the Software. |
19 | | |
20 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
21 | | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
22 | | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
23 | | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
24 | | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
25 | | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
26 | | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
27 | | |
28 | | #ifndef X86_64_LIBUNWIND_I_H |
29 | | #define X86_64_LIBUNWIND_I_H |
30 | | |
31 | | /* Target-dependent definitions that are internal to libunwind but need |
32 | | to be shared with target-independent code. */ |
33 | | |
34 | | #include <stdint.h> |
35 | | #include <stdlib.h> |
36 | | #include <stdatomic.h> |
37 | | #include <libunwind.h> |
38 | | |
39 | | #include "elf64.h" |
40 | | #include "mempool.h" |
41 | | #include "dwarf.h" |
42 | | |
43 | | typedef enum |
44 | | { |
45 | | UNW_X86_64_FRAME_ALIGNED = -3, /* frame stack pointer aligned */ |
46 | | UNW_X86_64_FRAME_STANDARD = -2, /* regular rbp, rsp +/- offset */ |
47 | | UNW_X86_64_FRAME_SIGRETURN = -1, /* special sigreturn frame */ |
48 | | UNW_X86_64_FRAME_OTHER = 0, /* not cacheable (special or unrecognised) */ |
49 | | UNW_X86_64_FRAME_GUESSED = 1 /* guessed it was regular, but not known */ |
50 | | } |
51 | | unw_tdep_frame_type_t; |
52 | | |
53 | | typedef struct |
54 | | { |
55 | | uint64_t virtual_address; |
56 | | int64_t frame_type : 3; /* unw_tdep_frame_type_t classification */ |
57 | | int64_t last_frame : 1; /* non-zero if last frame in chain */ |
58 | | int64_t cfa_reg_rsp : 1; /* cfa dwarf base register is rsp vs. rbp */ |
59 | | int64_t cfa_reg_offset : 29; /* cfa is at this offset from base register value */ |
60 | | int64_t rbp_cfa_offset : 15; /* rbp saved at this offset from cfa (-1 = not saved) */ |
61 | | int64_t rsp_cfa_offset : 15; /* rsp saved at this offset from cfa (-1 = not saved) */ |
62 | | } |
63 | | unw_tdep_frame_t; |
64 | | |
65 | | struct unw_addr_space |
66 | | { |
67 | | struct unw_accessors acc; |
68 | | #ifndef UNW_REMOTE_ONLY |
69 | | unw_iterate_phdr_func_t iterate_phdr_function; |
70 | | #endif |
71 | | unw_caching_policy_t caching_policy; |
72 | | _Atomic uint32_t cache_generation; |
73 | | unw_word_t dyn_generation; /* see dyn-common.h */ |
74 | | unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ |
75 | | struct dwarf_rs_cache global_cache; |
76 | | struct unw_debug_frame_list *debug_frames; |
77 | | }; |
78 | | |
79 | | struct cursor |
80 | | { |
81 | | struct dwarf_cursor dwarf; /* must be first */ |
82 | | |
83 | | unw_tdep_frame_t frame_info; /* quick tracing assist info */ |
84 | | |
85 | | /* Format of sigcontext structure and address at which it is |
86 | | stored: */ |
87 | | enum |
88 | | { |
89 | | X86_64_SCF_NONE, /* no signal frame encountered */ |
90 | | X86_64_SCF_LINUX_RT_SIGFRAME, /* Linux ucontext_t */ |
91 | | X86_64_SCF_FREEBSD_SIGFRAME, /* FreeBSD signal frame */ |
92 | | X86_64_SCF_FREEBSD_SYSCALL, /* FreeBSD syscall */ |
93 | | X86_64_SCF_SOLARIS_SIGFRAME, /* illumos/Solaris signal frame */ |
94 | | } |
95 | | sigcontext_format; |
96 | | unw_word_t sigcontext_addr; |
97 | | }; |
98 | | |
99 | 96.1k | #define AS_ARG_UCONTEXT_MASK ~0x1UL |
100 | 149k | #define AS_ARG_VALIDATE_MASK 0x1UL |
101 | | |
102 | | #define AS_ARG_GET_UC_PTR(arg) \ |
103 | 96.1k | ((ucontext_t *) ((uintptr_t) arg & AS_ARG_UCONTEXT_MASK)) |
104 | | #define AS_ARG_GET_VALIDATE(arg) \ |
105 | 48.0k | ((int) ((uintptr_t) arg & AS_ARG_VALIDATE_MASK)) |
106 | | |
107 | | static inline ucontext_t * |
108 | | dwarf_get_uc(const struct dwarf_cursor *cursor) |
109 | 96.1k | { |
110 | 96.1k | assert(cursor->as == unw_local_addr_space); |
111 | 96.1k | return AS_ARG_GET_UC_PTR(cursor->as_arg); |
112 | 96.1k | } Unexecuted instantiation: Lget_proc_name.c:dwarf_get_uc Unexecuted instantiation: Lget_reg.c:dwarf_get_uc Unexecuted instantiation: Lget_save_loc.c:dwarf_get_uc Linit_local.c:dwarf_get_uc Line | Count | Source | 109 | 96.1k | { | 110 | 96.1k | assert(cursor->as == unw_local_addr_space); | 111 | 96.1k | return AS_ARG_GET_UC_PTR(cursor->as_arg); | 112 | 96.1k | } |
Unexecuted instantiation: Los-linux.c:dwarf_get_uc Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_get_uc Unexecuted instantiation: Lregs.c:dwarf_get_uc Unexecuted instantiation: Lstep.c:dwarf_get_uc Unexecuted instantiation: Lfind_dynamic_proc_info.c:dwarf_get_uc Unexecuted instantiation: Lfind_proc_info-lsb.c:dwarf_get_uc Unexecuted instantiation: Lget_accessors.c:dwarf_get_uc Unexecuted instantiation: Lglobal.c:dwarf_get_uc Unexecuted instantiation: Linit.c:dwarf_get_uc Unexecuted instantiation: Lparser.c:dwarf_get_uc Unexecuted instantiation: Lpe.c:dwarf_get_uc Unexecuted instantiation: Lresume.c:dwarf_get_uc Unexecuted instantiation: Lstash_frame.c:dwarf_get_uc Unexecuted instantiation: dyn-info-list.c:dwarf_get_uc Unexecuted instantiation: elf64.c:dwarf_get_uc Unexecuted instantiation: flush_cache.c:dwarf_get_uc Unexecuted instantiation: global.c:dwarf_get_uc Unexecuted instantiation: init.c:dwarf_get_uc Unexecuted instantiation: is_fpreg.c:dwarf_get_uc Unexecuted instantiation: mempool.c:dwarf_get_uc Unexecuted instantiation: os-linux.c:dwarf_get_uc Unexecuted instantiation: Laddress_validator.c:dwarf_get_uc Unexecuted instantiation: Ldyn-extract.c:dwarf_get_uc Unexecuted instantiation: Lexpr.c:dwarf_get_uc Unexecuted instantiation: Lfde.c:dwarf_get_uc |
113 | | |
114 | | static inline int |
115 | | dwarf_get_validate(const struct dwarf_cursor *cursor) |
116 | 48.0k | { |
117 | 48.0k | assert(cursor->as == unw_local_addr_space); |
118 | 48.0k | return AS_ARG_GET_VALIDATE(cursor->as_arg); |
119 | 48.0k | } Unexecuted instantiation: Lget_proc_name.c:dwarf_get_validate Unexecuted instantiation: Lget_reg.c:dwarf_get_validate Unexecuted instantiation: Lget_save_loc.c:dwarf_get_validate Unexecuted instantiation: Linit_local.c:dwarf_get_validate Unexecuted instantiation: Los-linux.c:dwarf_get_validate Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_get_validate Unexecuted instantiation: Lregs.c:dwarf_get_validate Lstep.c:dwarf_get_validate Line | Count | Source | 116 | 48.0k | { | 117 | 48.0k | assert(cursor->as == unw_local_addr_space); | 118 | 48.0k | return AS_ARG_GET_VALIDATE(cursor->as_arg); | 119 | 48.0k | } |
Unexecuted instantiation: Lfind_dynamic_proc_info.c:dwarf_get_validate Unexecuted instantiation: Lfind_proc_info-lsb.c:dwarf_get_validate Unexecuted instantiation: Lget_accessors.c:dwarf_get_validate Unexecuted instantiation: Lglobal.c:dwarf_get_validate Unexecuted instantiation: Linit.c:dwarf_get_validate Unexecuted instantiation: Lparser.c:dwarf_get_validate Unexecuted instantiation: Lpe.c:dwarf_get_validate Unexecuted instantiation: Lresume.c:dwarf_get_validate Unexecuted instantiation: Lstash_frame.c:dwarf_get_validate Unexecuted instantiation: dyn-info-list.c:dwarf_get_validate Unexecuted instantiation: elf64.c:dwarf_get_validate Unexecuted instantiation: flush_cache.c:dwarf_get_validate Unexecuted instantiation: global.c:dwarf_get_validate Unexecuted instantiation: init.c:dwarf_get_validate Unexecuted instantiation: is_fpreg.c:dwarf_get_validate Unexecuted instantiation: mempool.c:dwarf_get_validate Unexecuted instantiation: os-linux.c:dwarf_get_validate Unexecuted instantiation: Laddress_validator.c:dwarf_get_validate Unexecuted instantiation: Ldyn-extract.c:dwarf_get_validate Unexecuted instantiation: Lexpr.c:dwarf_get_validate Unexecuted instantiation: Lfde.c:dwarf_get_validate |
120 | | |
121 | | static inline void |
122 | | dwarf_set_validate(const struct dwarf_cursor *cursor, const int validate) |
123 | 96.1k | { |
124 | 96.1k | assert(cursor->as == unw_local_addr_space); |
125 | 96.1k | uintptr_t *packed_args = (uintptr_t *) &cursor->as_arg; |
126 | 96.1k | *packed_args |= (AS_ARG_VALIDATE_MASK & validate); |
127 | 96.1k | } Unexecuted instantiation: Lget_proc_name.c:dwarf_set_validate Unexecuted instantiation: Lget_reg.c:dwarf_set_validate Unexecuted instantiation: Lget_save_loc.c:dwarf_set_validate Unexecuted instantiation: Linit_local.c:dwarf_set_validate Unexecuted instantiation: Los-linux.c:dwarf_set_validate Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_set_validate Unexecuted instantiation: Lregs.c:dwarf_set_validate Lstep.c:dwarf_set_validate Line | Count | Source | 123 | 96.1k | { | 124 | 96.1k | assert(cursor->as == unw_local_addr_space); | 125 | 96.1k | uintptr_t *packed_args = (uintptr_t *) &cursor->as_arg; | 126 | 96.1k | *packed_args |= (AS_ARG_VALIDATE_MASK & validate); | 127 | 96.1k | } |
Unexecuted instantiation: Lfind_dynamic_proc_info.c:dwarf_set_validate Unexecuted instantiation: Lfind_proc_info-lsb.c:dwarf_set_validate Unexecuted instantiation: Lget_accessors.c:dwarf_set_validate Unexecuted instantiation: Lglobal.c:dwarf_set_validate Unexecuted instantiation: Linit.c:dwarf_set_validate Unexecuted instantiation: Lparser.c:dwarf_set_validate Unexecuted instantiation: Lpe.c:dwarf_set_validate Unexecuted instantiation: Lresume.c:dwarf_set_validate Unexecuted instantiation: Lstash_frame.c:dwarf_set_validate Unexecuted instantiation: dyn-info-list.c:dwarf_set_validate Unexecuted instantiation: elf64.c:dwarf_set_validate Unexecuted instantiation: flush_cache.c:dwarf_set_validate Unexecuted instantiation: global.c:dwarf_set_validate Unexecuted instantiation: init.c:dwarf_set_validate Unexecuted instantiation: is_fpreg.c:dwarf_set_validate Unexecuted instantiation: mempool.c:dwarf_set_validate Unexecuted instantiation: os-linux.c:dwarf_set_validate Unexecuted instantiation: Laddress_validator.c:dwarf_set_validate Unexecuted instantiation: Ldyn-extract.c:dwarf_set_validate Unexecuted instantiation: Lexpr.c:dwarf_set_validate Unexecuted instantiation: Lfde.c:dwarf_set_validate |
128 | | |
129 | | static inline void * |
130 | 5.34k | dwarf_build_as_arg(const ucontext_t *uc, const int validate) { |
131 | 5.34k | uintptr_t packed_args = (uintptr_t) uc; |
132 | 5.34k | assert((packed_args & AS_ARG_VALIDATE_MASK) == 0); |
133 | 5.34k | packed_args |= (AS_ARG_VALIDATE_MASK & validate); |
134 | 5.34k | return (void *) packed_args; |
135 | 5.34k | } Unexecuted instantiation: Lget_proc_name.c:dwarf_build_as_arg Unexecuted instantiation: Lget_reg.c:dwarf_build_as_arg Unexecuted instantiation: Lget_save_loc.c:dwarf_build_as_arg Linit_local.c:dwarf_build_as_arg Line | Count | Source | 130 | 5.34k | dwarf_build_as_arg(const ucontext_t *uc, const int validate) { | 131 | 5.34k | uintptr_t packed_args = (uintptr_t) uc; | 132 | 5.34k | assert((packed_args & AS_ARG_VALIDATE_MASK) == 0); | 133 | 5.34k | packed_args |= (AS_ARG_VALIDATE_MASK & validate); | 134 | 5.34k | return (void *) packed_args; | 135 | 5.34k | } |
Unexecuted instantiation: Los-linux.c:dwarf_build_as_arg Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_build_as_arg Unexecuted instantiation: Lregs.c:dwarf_build_as_arg Unexecuted instantiation: Lstep.c:dwarf_build_as_arg Unexecuted instantiation: Lfind_dynamic_proc_info.c:dwarf_build_as_arg Unexecuted instantiation: Lfind_proc_info-lsb.c:dwarf_build_as_arg Unexecuted instantiation: Lget_accessors.c:dwarf_build_as_arg Unexecuted instantiation: Lglobal.c:dwarf_build_as_arg Unexecuted instantiation: Linit.c:dwarf_build_as_arg Unexecuted instantiation: Lparser.c:dwarf_build_as_arg Unexecuted instantiation: Lpe.c:dwarf_build_as_arg Unexecuted instantiation: Lresume.c:dwarf_build_as_arg Unexecuted instantiation: Lstash_frame.c:dwarf_build_as_arg Unexecuted instantiation: dyn-info-list.c:dwarf_build_as_arg Unexecuted instantiation: elf64.c:dwarf_build_as_arg Unexecuted instantiation: flush_cache.c:dwarf_build_as_arg Unexecuted instantiation: global.c:dwarf_build_as_arg Unexecuted instantiation: init.c:dwarf_build_as_arg Unexecuted instantiation: is_fpreg.c:dwarf_build_as_arg Unexecuted instantiation: mempool.c:dwarf_build_as_arg Unexecuted instantiation: os-linux.c:dwarf_build_as_arg Unexecuted instantiation: Laddress_validator.c:dwarf_build_as_arg Unexecuted instantiation: Ldyn-extract.c:dwarf_build_as_arg Unexecuted instantiation: Lexpr.c:dwarf_build_as_arg Unexecuted instantiation: Lfde.c:dwarf_build_as_arg |
136 | | |
137 | 339k | #define DWARF_GET_LOC(l) ((l).val) |
138 | 111k | # define DWARF_LOC_TYPE_MEM (0 << 0) |
139 | | # define DWARF_LOC_TYPE_FP (1 << 0) |
140 | 111k | # define DWARF_LOC_TYPE_REG (1 << 1) |
141 | | # define DWARF_LOC_TYPE_VAL (1 << 2) |
142 | | |
143 | 111k | # define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) |
144 | | # define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) |
145 | 111k | # define DWARF_IS_MEM_LOC(l) ((l).type == DWARF_LOC_TYPE_MEM) |
146 | | # define DWARF_IS_VAL_LOC(l) (((l).type & DWARF_LOC_TYPE_VAL) != 0) |
147 | | |
148 | 450k | # define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) |
149 | 48.0k | # define DWARF_VAL_LOC(c,v) DWARF_LOC ((v), DWARF_LOC_TYPE_VAL) |
150 | 234k | # define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), DWARF_LOC_TYPE_MEM) |
151 | | |
152 | | #ifdef UNW_LOCAL_ONLY |
153 | 71.2k | # define DWARF_NULL_LOC DWARF_LOC (0, 0) |
154 | 224k | # define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) |
155 | 5.34k | # define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ |
156 | 5.34k | x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0)) |
157 | | # define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ |
158 | | x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0)) |
159 | | |
160 | | #else /* !UNW_LOCAL_ONLY */ |
161 | | |
162 | | # define DWARF_NULL_LOC DWARF_LOC (0, 0) |
163 | | |
164 | | static inline int |
165 | | dwarf_is_null_loc(dwarf_loc_t l) |
166 | 0 | { |
167 | 0 | return l.val == 0 && l.type == 0; |
168 | 0 | } Unexecuted instantiation: dyn-info-list.c:dwarf_is_null_loc Unexecuted instantiation: elf64.c:dwarf_is_null_loc Unexecuted instantiation: flush_cache.c:dwarf_is_null_loc Unexecuted instantiation: global.c:dwarf_is_null_loc Unexecuted instantiation: init.c:dwarf_is_null_loc Unexecuted instantiation: is_fpreg.c:dwarf_is_null_loc Unexecuted instantiation: mempool.c:dwarf_is_null_loc Unexecuted instantiation: os-linux.c:dwarf_is_null_loc |
169 | | |
170 | | # define DWARF_IS_NULL_LOC(l) dwarf_is_null_loc(l) |
171 | | # define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) |
172 | | # define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ |
173 | | | DWARF_LOC_TYPE_FP)) |
174 | | |
175 | | #endif /* !UNW_LOCAL_ONLY */ |
176 | | |
177 | | static inline int |
178 | | dwarf_getfp (struct dwarf_cursor *c UNUSED, dwarf_loc_t loc, unw_fpreg_t *val UNUSED) |
179 | 0 | { |
180 | 0 | if (DWARF_IS_NULL_LOC (loc)) |
181 | 0 | return -UNW_EBADREG; |
182 | 0 |
|
183 | 0 | abort (); |
184 | 0 | } Unexecuted instantiation: Lget_proc_name.c:dwarf_getfp Unexecuted instantiation: Lget_reg.c:dwarf_getfp Unexecuted instantiation: Lget_save_loc.c:dwarf_getfp Unexecuted instantiation: Linit_local.c:dwarf_getfp Unexecuted instantiation: Los-linux.c:dwarf_getfp Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_getfp Unexecuted instantiation: Lregs.c:dwarf_getfp Unexecuted instantiation: Lstep.c:dwarf_getfp Unexecuted instantiation: Lfind_dynamic_proc_info.c:dwarf_getfp Unexecuted instantiation: Lfind_proc_info-lsb.c:dwarf_getfp Unexecuted instantiation: Lget_accessors.c:dwarf_getfp Unexecuted instantiation: Lglobal.c:dwarf_getfp Unexecuted instantiation: Linit.c:dwarf_getfp Unexecuted instantiation: Lparser.c:dwarf_getfp Unexecuted instantiation: Lpe.c:dwarf_getfp Unexecuted instantiation: Lresume.c:dwarf_getfp Unexecuted instantiation: Lstash_frame.c:dwarf_getfp Unexecuted instantiation: dyn-info-list.c:dwarf_getfp Unexecuted instantiation: elf64.c:dwarf_getfp Unexecuted instantiation: flush_cache.c:dwarf_getfp Unexecuted instantiation: global.c:dwarf_getfp Unexecuted instantiation: init.c:dwarf_getfp Unexecuted instantiation: is_fpreg.c:dwarf_getfp Unexecuted instantiation: mempool.c:dwarf_getfp Unexecuted instantiation: os-linux.c:dwarf_getfp Unexecuted instantiation: Laddress_validator.c:dwarf_getfp Unexecuted instantiation: Ldyn-extract.c:dwarf_getfp Unexecuted instantiation: Lexpr.c:dwarf_getfp Unexecuted instantiation: Lfde.c:dwarf_getfp |
185 | | |
186 | | static inline int |
187 | | dwarf_putfp (struct dwarf_cursor *c UNUSED, dwarf_loc_t loc, unw_fpreg_t val UNUSED) |
188 | 0 | { |
189 | 0 | if (DWARF_IS_NULL_LOC (loc)) |
190 | 0 | return -UNW_EBADREG; |
191 | 0 |
|
192 | 0 | abort (); |
193 | 0 | } Unexecuted instantiation: Lget_proc_name.c:dwarf_putfp Unexecuted instantiation: Lget_reg.c:dwarf_putfp Unexecuted instantiation: Lget_save_loc.c:dwarf_putfp Unexecuted instantiation: Linit_local.c:dwarf_putfp Unexecuted instantiation: Los-linux.c:dwarf_putfp Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_putfp Unexecuted instantiation: Lregs.c:dwarf_putfp Unexecuted instantiation: Lstep.c:dwarf_putfp Unexecuted instantiation: Lfind_dynamic_proc_info.c:dwarf_putfp Unexecuted instantiation: Lfind_proc_info-lsb.c:dwarf_putfp Unexecuted instantiation: Lget_accessors.c:dwarf_putfp Unexecuted instantiation: Lglobal.c:dwarf_putfp Unexecuted instantiation: Linit.c:dwarf_putfp Unexecuted instantiation: Lparser.c:dwarf_putfp Unexecuted instantiation: Lpe.c:dwarf_putfp Unexecuted instantiation: Lresume.c:dwarf_putfp Unexecuted instantiation: Lstash_frame.c:dwarf_putfp Unexecuted instantiation: dyn-info-list.c:dwarf_putfp Unexecuted instantiation: elf64.c:dwarf_putfp Unexecuted instantiation: flush_cache.c:dwarf_putfp Unexecuted instantiation: global.c:dwarf_putfp Unexecuted instantiation: init.c:dwarf_putfp Unexecuted instantiation: is_fpreg.c:dwarf_putfp Unexecuted instantiation: mempool.c:dwarf_putfp Unexecuted instantiation: os-linux.c:dwarf_putfp Unexecuted instantiation: Laddress_validator.c:dwarf_putfp Unexecuted instantiation: Ldyn-extract.c:dwarf_putfp Unexecuted instantiation: Lexpr.c:dwarf_putfp Unexecuted instantiation: Lfde.c:dwarf_putfp |
194 | | |
195 | | static inline int |
196 | | dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) |
197 | 111k | { |
198 | 111k | if (DWARF_IS_NULL_LOC (loc)) |
199 | 0 | return -UNW_EBADREG; |
200 | | |
201 | 111k | if (DWARF_IS_REG_LOC (loc)) |
202 | 0 | return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), val, |
203 | 0 | 0, c->as_arg); |
204 | 111k | if (DWARF_IS_MEM_LOC (loc)) |
205 | 100k | return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), val, |
206 | 100k | 0, c->as_arg); |
207 | 10.8k | assert(DWARF_IS_VAL_LOC (loc)); |
208 | 10.8k | *val = DWARF_GET_LOC (loc); |
209 | 10.8k | return 0; |
210 | 10.8k | } Unexecuted instantiation: Lget_proc_name.c:dwarf_get Unexecuted instantiation: Lget_reg.c:dwarf_get Unexecuted instantiation: Lget_save_loc.c:dwarf_get Line | Count | Source | 197 | 10.6k | { | 198 | 10.6k | if (DWARF_IS_NULL_LOC (loc)) | 199 | 0 | return -UNW_EBADREG; | 200 | | | 201 | 10.6k | if (DWARF_IS_REG_LOC (loc)) | 202 | 0 | return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), val, | 203 | 0 | 0, c->as_arg); | 204 | 10.6k | if (DWARF_IS_MEM_LOC (loc)) | 205 | 10.6k | return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), val, | 206 | 10.6k | 0, c->as_arg); | 207 | 0 | assert(DWARF_IS_VAL_LOC (loc)); | 208 | 0 | *val = DWARF_GET_LOC (loc); | 209 | 0 | return 0; | 210 | 0 | } |
Unexecuted instantiation: Los-linux.c:dwarf_get Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_get Line | Count | Source | 197 | 58.3k | { | 198 | 58.3k | if (DWARF_IS_NULL_LOC (loc)) | 199 | 0 | return -UNW_EBADREG; | 200 | | | 201 | 58.3k | if (DWARF_IS_REG_LOC (loc)) | 202 | 0 | return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), val, | 203 | 0 | 0, c->as_arg); | 204 | 58.3k | if (DWARF_IS_MEM_LOC (loc)) | 205 | 47.5k | return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), val, | 206 | 47.5k | 0, c->as_arg); | 207 | 10.8k | assert(DWARF_IS_VAL_LOC (loc)); | 208 | 10.8k | *val = DWARF_GET_LOC (loc); | 209 | 10.8k | return 0; | 210 | 10.8k | } |
Unexecuted instantiation: Lstep.c:dwarf_get Unexecuted instantiation: Lfind_dynamic_proc_info.c:dwarf_get Unexecuted instantiation: Lfind_proc_info-lsb.c:dwarf_get Unexecuted instantiation: Lget_accessors.c:dwarf_get Unexecuted instantiation: Lglobal.c:dwarf_get Unexecuted instantiation: Linit.c:dwarf_get Line | Count | Source | 197 | 42.7k | { | 198 | 42.7k | if (DWARF_IS_NULL_LOC (loc)) | 199 | 0 | return -UNW_EBADREG; | 200 | | | 201 | 42.7k | if (DWARF_IS_REG_LOC (loc)) | 202 | 0 | return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), val, | 203 | 0 | 0, c->as_arg); | 204 | 42.7k | if (DWARF_IS_MEM_LOC (loc)) | 205 | 42.7k | return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), val, | 206 | 42.7k | 0, c->as_arg); | 207 | 0 | assert(DWARF_IS_VAL_LOC (loc)); | 208 | 0 | *val = DWARF_GET_LOC (loc); | 209 | 0 | return 0; | 210 | 0 | } |
Unexecuted instantiation: Lpe.c:dwarf_get Unexecuted instantiation: Lresume.c:dwarf_get Unexecuted instantiation: Lstash_frame.c:dwarf_get Unexecuted instantiation: dyn-info-list.c:dwarf_get Unexecuted instantiation: elf64.c:dwarf_get Unexecuted instantiation: flush_cache.c:dwarf_get Unexecuted instantiation: global.c:dwarf_get Unexecuted instantiation: init.c:dwarf_get Unexecuted instantiation: is_fpreg.c:dwarf_get Unexecuted instantiation: mempool.c:dwarf_get Unexecuted instantiation: os-linux.c:dwarf_get Unexecuted instantiation: Laddress_validator.c:dwarf_get Unexecuted instantiation: Ldyn-extract.c:dwarf_get Unexecuted instantiation: Lexpr.c:dwarf_get Unexecuted instantiation: Lfde.c:dwarf_get |
211 | | |
212 | | static inline int |
213 | | dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) |
214 | 0 | { |
215 | 0 | assert(!DWARF_IS_VAL_LOC (loc)); |
216 | | |
217 | 0 | if (DWARF_IS_NULL_LOC (loc)) |
218 | 0 | return -UNW_EBADREG; |
219 | | |
220 | 0 | if (DWARF_IS_REG_LOC (loc)) |
221 | 0 | return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), &val, |
222 | 0 | 1, c->as_arg); |
223 | 0 | else |
224 | 0 | return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), &val, |
225 | 0 | 1, c->as_arg); |
226 | 0 | } Unexecuted instantiation: Lget_proc_name.c:dwarf_put Unexecuted instantiation: Lget_reg.c:dwarf_put Unexecuted instantiation: Lget_save_loc.c:dwarf_put Unexecuted instantiation: Linit_local.c:dwarf_put Unexecuted instantiation: Los-linux.c:dwarf_put Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_put Unexecuted instantiation: Lregs.c:dwarf_put Unexecuted instantiation: Lstep.c:dwarf_put Unexecuted instantiation: Lfind_dynamic_proc_info.c:dwarf_put Unexecuted instantiation: Lfind_proc_info-lsb.c:dwarf_put Unexecuted instantiation: Lget_accessors.c:dwarf_put Unexecuted instantiation: Lglobal.c:dwarf_put Unexecuted instantiation: Linit.c:dwarf_put Unexecuted instantiation: Lparser.c:dwarf_put Unexecuted instantiation: Lpe.c:dwarf_put Unexecuted instantiation: Lresume.c:dwarf_put Unexecuted instantiation: Lstash_frame.c:dwarf_put Unexecuted instantiation: dyn-info-list.c:dwarf_put Unexecuted instantiation: elf64.c:dwarf_put Unexecuted instantiation: flush_cache.c:dwarf_put Unexecuted instantiation: global.c:dwarf_put Unexecuted instantiation: init.c:dwarf_put Unexecuted instantiation: is_fpreg.c:dwarf_put Unexecuted instantiation: mempool.c:dwarf_put Unexecuted instantiation: os-linux.c:dwarf_put Unexecuted instantiation: Laddress_validator.c:dwarf_put Unexecuted instantiation: Ldyn-extract.c:dwarf_put Unexecuted instantiation: Lexpr.c:dwarf_put Unexecuted instantiation: Lfde.c:dwarf_put |
227 | | |
228 | | #define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace) |
229 | | #define tdep_init_done UNW_OBJ(init_done) |
230 | 1 | #define tdep_init UNW_OBJ(init) |
231 | | /* Platforms that support UNW_INFO_FORMAT_TABLE need to define |
232 | | tdep_search_unwind_table. */ |
233 | 0 | #define tdep_search_unwind_table dwarf_search_unwind_table |
234 | | #define tdep_find_unwind_table dwarf_find_unwind_table |
235 | 23.6k | #define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) |
236 | 0 | #define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path) |
237 | 60.2k | #define tdep_access_reg UNW_OBJ(access_reg) |
238 | 0 | #define tdep_access_fpreg UNW_OBJ(access_fpreg) |
239 | | #if __linux__ |
240 | 15 | # define tdep_fetch_frame UNW_OBJ(fetch_frame) |
241 | 15 | # define tdep_cache_frame UNW_OBJ(cache_frame) |
242 | 48.0k | # define tdep_reuse_frame UNW_OBJ(reuse_frame) |
243 | | #else |
244 | | # define tdep_fetch_frame(c,ip,n) do {} while(0) |
245 | | # define tdep_cache_frame(c) 0 |
246 | | # define tdep_reuse_frame(c,frame) do {} while(0) |
247 | | #endif |
248 | 0 | #define tdep_stash_frame UNW_OBJ(stash_frame) |
249 | | #define tdep_trace UNW_OBJ(tdep_trace) |
250 | | #define x86_64_r_uc_addr UNW_OBJ(r_uc_addr) |
251 | | |
252 | | #ifdef UNW_LOCAL_ONLY |
253 | | # define tdep_find_proc_info(c,ip,n) \ |
254 | 15 | dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ |
255 | 15 | (c)->as_arg) |
256 | | # define tdep_put_unwind_info(as,pi,arg) \ |
257 | 0 | dwarf_put_unwind_info((as), (pi), (arg)) |
258 | | #else |
259 | | # define tdep_find_proc_info(c,ip,n) \ |
260 | | (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ |
261 | | (c)->as_arg) |
262 | | # define tdep_put_unwind_info(as,pi,arg) \ |
263 | | (*(as)->acc.put_unwind_info)((as), (pi), (arg)) |
264 | | #endif |
265 | | |
266 | 23.6k | #define tdep_get_as(c) ((c)->dwarf.as) |
267 | 23.6k | #define tdep_get_as_arg(c) ((c)->dwarf.as_arg) |
268 | 23.8k | #define tdep_get_ip(c) ((c)->dwarf.ip) |
269 | | #define tdep_big_endian(as) 0 |
270 | | |
271 | | extern atomic_bool tdep_init_done; |
272 | | |
273 | | extern void tdep_init (void); |
274 | | extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, |
275 | | unw_dyn_info_t *di, unw_proc_info_t *pi, |
276 | | int need_unwind_info, void *arg); |
277 | | extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg); |
278 | | extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, |
279 | | unsigned long *segbase, unsigned long *mapoff, |
280 | | char *path, size_t pathlen); |
281 | | extern void tdep_get_exe_image_path (char *path); |
282 | | extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, |
283 | | unw_word_t *valp, int write); |
284 | | extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, |
285 | | unw_fpreg_t *valp, int write); |
286 | | #if __linux__ |
287 | | extern void tdep_fetch_frame (struct dwarf_cursor *c, unw_word_t ip, |
288 | | int need_unwind_info); |
289 | | extern int tdep_cache_frame (struct dwarf_cursor *c); |
290 | | extern void tdep_reuse_frame (struct dwarf_cursor *c, |
291 | | int frame); |
292 | | #endif |
293 | | extern void tdep_stash_frame (struct dwarf_cursor *c, |
294 | | struct dwarf_reg_state *rs); |
295 | | |
296 | | extern int tdep_getcontext_trace (unw_tdep_context_t *); |
297 | | extern int tdep_trace (unw_cursor_t *cursor, void **addresses, int *n); |
298 | | |
299 | | #endif /* X86_64_LIBUNWIND_I_H */ |