Coverage Report

Created: 2025-11-06 07:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libunwind/include/tdep-x86_64/libunwind_i.h
Line
Count
Source
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
    uintptr_t frames;                   /* Stack frames to pop.  */
84
85
    unw_tdep_frame_t frame_info;        /* quick tracing assist info */
86
87
    /* Format of sigcontext structure and address at which it is
88
       stored: */
89
    enum
90
      {
91
        X86_64_SCF_NONE,                /* no signal frame encountered */
92
        X86_64_SCF_LINUX_RT_SIGFRAME,   /* Linux ucontext_t */
93
        X86_64_SCF_FREEBSD_SIGFRAME,    /* FreeBSD signal frame */
94
        X86_64_SCF_FREEBSD_SYSCALL,     /* FreeBSD syscall */
95
        X86_64_SCF_SOLARIS_SIGFRAME,    /* illumos/Solaris signal frame */
96
      }
97
    sigcontext_format;
98
    unw_word_t sigcontext_addr;
99
  };
100
101
109k
#define AS_ARG_UCONTEXT_MASK ~0x1UL
102
170k
#define AS_ARG_VALIDATE_MASK 0x1UL
103
104
#define AS_ARG_GET_UC_PTR(arg) \
105
109k
  ((ucontext_t *) ((uintptr_t) arg & AS_ARG_UCONTEXT_MASK))
106
#define AS_ARG_GET_VALIDATE(arg) \
107
54.8k
  ((int) ((uintptr_t) arg & AS_ARG_VALIDATE_MASK))
108
109
static inline ucontext_t *
110
dwarf_get_uc(const struct dwarf_cursor *cursor)
111
109k
{
112
109k
  assert(cursor->as == unw_local_addr_space);
113
109k
  return AS_ARG_GET_UC_PTR(cursor->as_arg);
114
109k
}
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
111
109k
{
112
109k
  assert(cursor->as == unw_local_addr_space);
113
109k
  return AS_ARG_GET_UC_PTR(cursor->as_arg);
114
109k
}
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
115
116
static inline int
117
dwarf_get_validate(const struct dwarf_cursor *cursor)
118
54.8k
{
119
54.8k
  assert(cursor->as == unw_local_addr_space);
120
54.8k
  return AS_ARG_GET_VALIDATE(cursor->as_arg);
121
54.8k
}
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
118
54.8k
{
119
54.8k
  assert(cursor->as == unw_local_addr_space);
120
54.8k
  return AS_ARG_GET_VALIDATE(cursor->as_arg);
121
54.8k
}
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
122
123
static inline void
124
dwarf_set_validate(const struct dwarf_cursor *cursor, const int validate)
125
109k
{
126
109k
  assert(cursor->as == unw_local_addr_space);
127
109k
  uintptr_t *packed_args = (uintptr_t *) &cursor->as_arg;
128
109k
  *packed_args |= (AS_ARG_VALIDATE_MASK & validate);
129
109k
}
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
125
109k
{
126
109k
  assert(cursor->as == unw_local_addr_space);
127
109k
  uintptr_t *packed_args = (uintptr_t *) &cursor->as_arg;
128
109k
  *packed_args |= (AS_ARG_VALIDATE_MASK & validate);
129
109k
}
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
130
131
static inline void *
132
6.09k
dwarf_build_as_arg(const ucontext_t *uc, const int validate) {
133
6.09k
  uintptr_t packed_args = (uintptr_t) uc;
134
6.09k
  assert((packed_args & AS_ARG_VALIDATE_MASK) == 0);
135
6.09k
  packed_args |= (AS_ARG_VALIDATE_MASK & validate);
136
6.09k
  return (void *) packed_args;
137
6.09k
}
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
132
6.09k
dwarf_build_as_arg(const ucontext_t *uc, const int validate) {
133
6.09k
  uintptr_t packed_args = (uintptr_t) uc;
134
6.09k
  assert((packed_args & AS_ARG_VALIDATE_MASK) == 0);
135
6.09k
  packed_args |= (AS_ARG_VALIDATE_MASK & validate);
136
6.09k
  return (void *) packed_args;
137
6.09k
}
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
138
139
377k
#define DWARF_GET_LOC(l)        ((l).val)
140
124k
# define DWARF_LOC_TYPE_MEM     (0 << 0)
141
# define DWARF_LOC_TYPE_FP      (1 << 0)
142
124k
# define DWARF_LOC_TYPE_REG     (1 << 1)
143
# define DWARF_LOC_TYPE_VAL     (1 << 2)
144
145
124k
# define DWARF_IS_REG_LOC(l)    (((l).type & DWARF_LOC_TYPE_REG) != 0)
146
# define DWARF_IS_FP_LOC(l)     (((l).type & DWARF_LOC_TYPE_FP) != 0)
147
124k
# define DWARF_IS_MEM_LOC(l)    ((l).type == DWARF_LOC_TYPE_MEM)
148
# define DWARF_IS_VAL_LOC(l)    (((l).type & DWARF_LOC_TYPE_VAL) != 0)
149
150
509k
# define DWARF_LOC(r, t)        ((dwarf_loc_t) { .val = (r), .type = (t) })
151
54.8k
# define DWARF_VAL_LOC(c,v)     DWARF_LOC ((v), DWARF_LOC_TYPE_VAL)
152
267k
# define DWARF_MEM_LOC(c,m)     DWARF_LOC ((m), DWARF_LOC_TYPE_MEM)
153
154
#ifdef UNW_LOCAL_ONLY
155
76.7k
# define DWARF_NULL_LOC         DWARF_LOC (0, 0)
156
251k
# define DWARF_IS_NULL_LOC(l)   (DWARF_GET_LOC (l) == 0)
157
6.09k
# define DWARF_REG_LOC(c,r)     (DWARF_LOC((unw_word_t)                      \
158
6.09k
                                 x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0))
159
# define DWARF_FPREG_LOC(c,r)   (DWARF_LOC((unw_word_t)                      \
160
                                 x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0))
161
162
#else /* !UNW_LOCAL_ONLY */
163
164
# define DWARF_NULL_LOC         DWARF_LOC (0, 0)
165
166
static inline int
167
dwarf_is_null_loc(dwarf_loc_t l)
168
0
{
169
0
  return l.val == 0 && l.type == 0;
170
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
171
172
# define DWARF_IS_NULL_LOC(l)   dwarf_is_null_loc(l)
173
# define DWARF_REG_LOC(c,r)     DWARF_LOC((r), DWARF_LOC_TYPE_REG)
174
# define DWARF_FPREG_LOC(c,r)   DWARF_LOC((r), (DWARF_LOC_TYPE_REG      \
175
                                                | DWARF_LOC_TYPE_FP))
176
177
#endif /* !UNW_LOCAL_ONLY */
178
179
static inline int
180
dwarf_getfp (struct dwarf_cursor *c UNUSED, dwarf_loc_t loc, unw_fpreg_t *val UNUSED)
181
0
{
182
0
  if (DWARF_IS_NULL_LOC (loc))
183
0
    return -UNW_EBADREG;
184
0
185
0
  abort ();
186
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
187
188
static inline int
189
dwarf_putfp (struct dwarf_cursor *c UNUSED, dwarf_loc_t loc, unw_fpreg_t val UNUSED)
190
0
{
191
0
  if (DWARF_IS_NULL_LOC (loc))
192
0
    return -UNW_EBADREG;
193
0
194
0
  abort ();
195
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
196
197
static inline int
198
dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
199
124k
{
200
124k
  if (DWARF_IS_NULL_LOC (loc))
201
0
    return -UNW_EBADREG;
202
203
124k
  if (DWARF_IS_REG_LOC (loc))
204
0
    return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), val,
205
0
                                     0, c->as_arg);
206
124k
  if (DWARF_IS_MEM_LOC (loc))
207
111k
    return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), val,
208
111k
                                     0, c->as_arg);
209
124k
  assert(DWARF_IS_VAL_LOC (loc));
210
13.2k
  *val = DWARF_GET_LOC (loc);
211
13.2k
  return 0;
212
13.2k
}
Unexecuted instantiation: Lget_proc_name.c:dwarf_get
Unexecuted instantiation: Lget_reg.c:dwarf_get
Unexecuted instantiation: Lget_save_loc.c:dwarf_get
Linit_local.c:dwarf_get
Line
Count
Source
199
12.1k
{
200
12.1k
  if (DWARF_IS_NULL_LOC (loc))
201
0
    return -UNW_EBADREG;
202
203
12.1k
  if (DWARF_IS_REG_LOC (loc))
204
0
    return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), val,
205
0
                                     0, c->as_arg);
206
12.1k
  if (DWARF_IS_MEM_LOC (loc))
207
12.1k
    return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), val,
208
12.1k
                                     0, c->as_arg);
209
12.1k
  assert(DWARF_IS_VAL_LOC (loc));
210
0
  *val = DWARF_GET_LOC (loc);
211
0
  return 0;
212
0
}
Unexecuted instantiation: Los-linux.c:dwarf_get
Unexecuted instantiation: Lput_dynamic_unwind_info.c:dwarf_get
Lregs.c:dwarf_get
Line
Count
Source
199
63.9k
{
200
63.9k
  if (DWARF_IS_NULL_LOC (loc))
201
0
    return -UNW_EBADREG;
202
203
63.9k
  if (DWARF_IS_REG_LOC (loc))
204
0
    return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), val,
205
0
                                     0, c->as_arg);
206
63.9k
  if (DWARF_IS_MEM_LOC (loc))
207
50.6k
    return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), val,
208
50.6k
                                     0, c->as_arg);
209
63.9k
  assert(DWARF_IS_VAL_LOC (loc));
210
13.2k
  *val = DWARF_GET_LOC (loc);
211
13.2k
  return 0;
212
13.2k
}
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
Lparser.c:dwarf_get
Line
Count
Source
199
48.7k
{
200
48.7k
  if (DWARF_IS_NULL_LOC (loc))
201
0
    return -UNW_EBADREG;
202
203
48.7k
  if (DWARF_IS_REG_LOC (loc))
204
0
    return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), val,
205
0
                                     0, c->as_arg);
206
48.7k
  if (DWARF_IS_MEM_LOC (loc))
207
48.7k
    return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), val,
208
48.7k
                                     0, c->as_arg);
209
48.7k
  assert(DWARF_IS_VAL_LOC (loc));
210
0
  *val = DWARF_GET_LOC (loc);
211
0
  return 0;
212
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
213
214
static inline int
215
dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
216
0
{
217
0
  assert(!DWARF_IS_VAL_LOC (loc));
218
219
0
  if (DWARF_IS_NULL_LOC (loc))
220
0
    return -UNW_EBADREG;
221
222
0
  if (DWARF_IS_REG_LOC (loc))
223
0
    return (*c->as->acc.access_reg) (c->as, DWARF_GET_REG_LOC (loc), &val,
224
0
                                     1, c->as_arg);
225
0
  else
226
0
    return (*c->as->acc.access_mem) (c->as, DWARF_GET_MEM_LOC (loc), &val,
227
0
                                     1, c->as_arg);
228
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
229
230
#define tdep_getcontext_trace           UNW_ARCH_OBJ(getcontext_trace)
231
#define tdep_init_done                  UNW_OBJ(init_done)
232
1
#define tdep_init                       UNW_OBJ(init)
233
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
234
   tdep_search_unwind_table.  */
235
0
#define tdep_search_unwind_table        dwarf_search_unwind_table
236
#define tdep_find_unwind_table          dwarf_find_unwind_table
237
30.8k
#define tdep_get_elf_image              UNW_ARCH_OBJ(get_elf_image)
238
0
#define tdep_get_exe_image_path         UNW_ARCH_OBJ(get_exe_image_path)
239
66.2k
#define tdep_access_reg                 UNW_OBJ(access_reg)
240
0
#define tdep_access_fpreg               UNW_OBJ(access_fpreg)
241
#if __linux__
242
15
# define tdep_fetch_frame               UNW_OBJ(fetch_frame)
243
15
# define tdep_cache_frame               UNW_OBJ(cache_frame)
244
54.8k
# define tdep_reuse_frame               UNW_OBJ(reuse_frame)
245
#else
246
# define tdep_fetch_frame(c,ip,n)       do {} while(0)
247
# define tdep_cache_frame(c)            0
248
# define tdep_reuse_frame(c,frame)      do {} while(0)
249
#endif
250
0
#define tdep_stash_frame                UNW_OBJ(stash_frame)
251
#define tdep_trace                      UNW_OBJ(tdep_trace)
252
#define x86_64_r_uc_addr                UNW_OBJ(r_uc_addr)
253
254
#ifdef UNW_LOCAL_ONLY
255
# define tdep_find_proc_info(c,ip,n)                            \
256
15
        dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n),      \
257
15
                                       (c)->as_arg)
258
# define tdep_put_unwind_info(as,pi,arg)                \
259
0
        dwarf_put_unwind_info((as), (pi), (arg))
260
#else
261
# define tdep_find_proc_info(c,ip,n)                                    \
262
        (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n),    \
263
                                       (c)->as_arg)
264
# define tdep_put_unwind_info(as,pi,arg)                        \
265
        (*(as)->acc.put_unwind_info)((as), (pi), (arg))
266
#endif
267
268
30.8k
#define tdep_get_as(c)                  ((c)->dwarf.as)
269
30.8k
#define tdep_get_as_arg(c)              ((c)->dwarf.as_arg)
270
31.3k
#define tdep_get_ip(c)                  ((c)->dwarf.ip)
271
#define tdep_big_endian(as)             0
272
273
extern atomic_bool tdep_init_done;
274
275
extern void tdep_init (void);
276
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
277
                                     unw_dyn_info_t *di, unw_proc_info_t *pi,
278
                                     int need_unwind_info, void *arg);
279
extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg);
280
extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
281
                               unsigned long *segbase, unsigned long *mapoff,
282
                               char *path, size_t pathlen);
283
extern void tdep_get_exe_image_path (char *path);
284
extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
285
                            unw_word_t *valp, int write);
286
extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
287
                              unw_fpreg_t *valp, int write);
288
#if __linux__
289
extern void tdep_fetch_frame (struct dwarf_cursor *c, unw_word_t ip,
290
                              int need_unwind_info);
291
extern int tdep_cache_frame (struct dwarf_cursor *c);
292
extern void tdep_reuse_frame (struct dwarf_cursor *c,
293
                              int frame);
294
#endif
295
extern void tdep_stash_frame (struct dwarf_cursor *c,
296
                              struct dwarf_reg_state *rs);
297
298
extern int tdep_getcontext_trace (unw_tdep_context_t *);
299
extern int tdep_trace (unw_cursor_t *cursor, void **addresses, int *n);
300
301
#endif /* X86_64_LIBUNWIND_I_H */