Commit | Line | Data |
---|---|---|
ea5bc2a6 JT |
1 | /* Common target-dependent code for NetBSD systems. |
2 | Copyright 2002 Free Software Foundation, Inc. | |
3 | Contributed by Wasabi Systems, Inc. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
21 | ||
22 | #include "defs.h" | |
3d9b49b0 | 23 | #include "gdb_string.h" |
ea5bc2a6 JT |
24 | #include "solib-svr4.h" |
25 | ||
26 | /* Fetch (and possibly build) an appropriate link_map_offsets | |
6c7861b3 JT |
27 | structure for NetBSD targets using the struct offsets defined |
28 | in <link.h> (but without actual reference to that file). | |
ea5bc2a6 | 29 | |
6c7861b3 JT |
30 | This makes it possible to access NetBSD shared libraries from a |
31 | GDB that was not built on the same platform (for cross debugging). | |
ea5bc2a6 JT |
32 | |
33 | We provide versions for ILP32 and LP64 NetBSD targets here. */ | |
34 | ||
35 | struct link_map_offsets * | |
36 | nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void) | |
37 | { | |
38 | static struct link_map_offsets lmo; | |
39 | static struct link_map_offsets *lmp = NULL; | |
40 | ||
41 | if (lmp == NULL) | |
42 | { | |
43 | lmp = &lmo; | |
44 | ||
45 | lmo.r_debug_size = 16; | |
46 | ||
47 | lmo.r_map_offset = 4; | |
48 | lmo.r_map_size = 4; | |
49 | ||
50 | lmo.link_map_size = 20; | |
51 | ||
52 | lmo.l_addr_offset = 0; | |
53 | lmo.l_addr_size = 4; | |
54 | ||
55 | lmo.l_name_offset = 4; | |
56 | lmo.l_name_size = 4; | |
57 | ||
58 | lmo.l_next_offset = 12; | |
59 | lmo.l_next_size = 4; | |
60 | ||
61 | lmo.l_prev_offset = 16; | |
62 | lmo.l_prev_size = 4; | |
63 | } | |
64 | ||
65 | return lmp; | |
66 | } | |
67 | ||
68 | struct link_map_offsets * | |
69 | nbsd_lp64_solib_svr4_fetch_link_map_offsets (void) | |
70 | { | |
71 | static struct link_map_offsets lmo; | |
72 | static struct link_map_offsets *lmp = NULL; | |
73 | ||
74 | if (lmp == NULL) | |
75 | { | |
76 | lmp = &lmo; | |
77 | ||
78 | lmo.r_debug_size = 32; | |
79 | ||
80 | lmo.r_map_offset = 8; | |
81 | lmo.r_map_size = 8; | |
82 | ||
83 | lmo.link_map_size = 40; | |
84 | ||
85 | lmo.l_addr_offset = 0; | |
86 | lmo.l_addr_size = 8; | |
87 | ||
88 | lmo.l_name_offset = 8; | |
89 | lmo.l_name_size = 8; | |
90 | ||
91 | lmo.l_next_offset = 24; | |
92 | lmo.l_next_size = 8; | |
93 | ||
94 | lmo.l_prev_offset = 32; | |
95 | lmo.l_prev_size = 8; | |
96 | } | |
97 | ||
98 | return lmp; | |
99 | } | |
3d9b49b0 JT |
100 | |
101 | int | |
102 | nbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) | |
103 | { | |
104 | /* Check for libc-provided signal trampoline. All such trampolines | |
105 | have function names which begin with "__sigtramp". */ | |
106 | ||
107 | return (func_name != NULL | |
108 | && strncmp (func_name, "__sigtramp", 10) == 0); | |
109 | } |