blob: 0a04b282dbf6caec2b9f8268df1ea30b91b2fce4 [file] [log] [blame]
mostang.com!davidm51095502003-03-11 01:11:18 +00001/* libunwind - a platform-independent unwind library
2 Copyright (C) 2002 Hewlett-Packard Co
3 Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
4
5This file is part of libunwind.
6
7Permission is hereby granted, free of charge, to any person obtaining
8a copy of this software and associated documentation files (the
9"Software"), to deal in the Software without restriction, including
10without limitation the rights to use, copy, modify, merge, publish,
11distribute, sublicense, and/or sell copies of the Software, and to
12permit persons to whom the Software is furnished to do so, subject to
13the following conditions:
14
15The above copyright notice and this permission notice shall be
16included in all copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
25
26#ifndef TDEP_X86_H
27#define TDEP_X86_H
28
29/* Target-dependent definitions that are internal to libunwind but need
30 to be shared with target-independent code. */
31
32#include <stdlib.h>
33#include <libunwind.h>
34
35enum x86_pregnum
36 {
37 X86_NUM_PREGS
38 };
39
40struct x86_loc
41 {
42 unw_word_t val;
43#ifndef UNW_LOCAL_ONLY
44 unw_word_t type; /* see X86_LOC_TYPE_* macros. */
45#endif
46 };
47
48struct unw_addr_space
49 {
50 struct unw_accessors acc;
51 unw_caching_policy_t caching_policy;
52 uint32_t cache_generation;
53 unw_word_t dyn_generation; /* see dyn-common.h */
54 unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
55 };
56
57struct cursor
58 {
59 unw_addr_space_t as;
60 void *as_arg;
61
62 /* IP & SP cache: */
63 unw_word_t eip;
64 unw_word_t esp;
65
66 struct x86_loc eip_loc;
67 struct x86_loc ebp_loc;
68 };
69
70/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
71 tdep_search_unwind_table. */
72#define tdep_search_unwind_table(a,b,c,d,e,f) \
73 UNW_ARCH_OBJ(search_unwind_table) (a,b,c,d,e,f)
74#define tdep_find_proc_info(as,ip,pi,n,a) \
75 UNW_ARCH_OBJ(find_proc_info) (as,ip,pi,n,a)
76#define tdep_put_unwind_info(a,b,c) UNW_ARCH_OBJ(put_unwind_info)(a,b,c)
77#define tdep_uc_addr(uc,reg) UNW_ARCH_OBJ(uc_addr)(uc,reg)
hp.com!davidmf9cc1e42003-03-29 07:32:50 +000078#define tdep_get_elf_image(a,b,c,d,e) UNW_ARCH_OBJ(get_elf_image) (a, b, c, \
79 d, e)
mostang.com!davidm51095502003-03-11 01:11:18 +000080#define tdep_debug_level UNW_ARCH_OBJ(debug_level)
81
82extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
83 unw_dyn_info_t *di, unw_proc_info_t *pi,
84 int need_unwind_info, void *arg);
85extern int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip,
86 unw_proc_info_t *pi, int need_unwind_info,
87 void *arg);
88extern void tdep_put_unwind_info (unw_addr_space_t as,
89 unw_proc_info_t *pi, void *arg);
90extern void *tdep_uc_addr (ucontext_t *uc, int reg);
hp.com!davidmf9cc1e42003-03-29 07:32:50 +000091extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
92 unsigned long *segbase, unsigned long *mapoff);
mostang.com!davidm51095502003-03-11 01:11:18 +000093extern int tdep_debug_level;
94
95#endif /* TDEP_X86_H */