]>
Commit | Line | Data |
---|---|---|
4d6acc61 | 1 | /* Communicate dynamic linker state to the debugger at runtime. |
29f97654 | 2 | Copyright (C) 1996, 1998,2000,2002,2004,2005 Free Software Foundation, Inc. |
afd4eb37 | 3 | This file is part of the GNU C Library. |
4d6acc61 | 4 | |
afd4eb37 | 5 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
4d6acc61 | 9 | |
afd4eb37 UD |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
4d6acc61 | 14 | |
41bdb6e2 AJ |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 02111-1307 USA. */ | |
4d6acc61 | 19 | |
a42195db | 20 | #include <ldsodefs.h> |
4d6acc61 RM |
21 | |
22 | /* This structure communicates dl state to the debugger. The debugger | |
23 | normally finds it via the DT_DEBUG entry in the dynamic section, but in | |
24 | a statically-linked program there is no dynamic section for the debugger | |
25 | to examine and it looks for this particular symbol name. */ | |
26 | struct r_debug _r_debug; | |
27 | ||
28 | ||
29 | /* Initialize _r_debug if it has not already been done. The argument is | |
30 | the run-time load address of the dynamic linker, to be put in | |
31 | _r_debug.r_ldbase. Returns the address of _r_debug. */ | |
32 | ||
33 | struct r_debug * | |
d0fc4041 | 34 | internal_function |
29f97654 | 35 | _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns) |
4d6acc61 | 36 | { |
29f97654 UD |
37 | struct r_debug *r; |
38 | ||
39 | if (ns == LM_ID_BASE) | |
40 | r = &_r_debug; | |
41 | else | |
42 | r = &GL(dl_ns)[ns]._ns_debug; | |
43 | ||
44 | if (r->r_brk == 0 || ldbase != 0) | |
4d6acc61 RM |
45 | { |
46 | /* Tell the debugger where to find the map of loaded objects. */ | |
29f97654 UD |
47 | r->r_version = 1 /* R_DEBUG_VERSION XXX */; |
48 | r->r_ldbase = ldbase ?: _r_debug.r_ldbase; | |
49 | r->r_map = GL(dl_ns)[ns]._ns_loaded; | |
50 | r->r_brk = (ElfW(Addr)) &_dl_debug_state; | |
4d6acc61 RM |
51 | } |
52 | ||
29f97654 | 53 | return r; |
4d6acc61 RM |
54 | } |
55 | ||
56 | ||
57 | /* This function exists solely to have a breakpoint set on it by the | |
58 | debugger. The debugger is supposed to find this function's address by | |
59 | examining the r_brk member of struct r_debug, but GDB 4.15 in fact looks | |
60 | for this particular symbol name in the PT_INTERP file. */ | |
61 | void | |
62 | _dl_debug_state (void) | |
63 | { | |
64 | } | |
7e46ec8c | 65 | rtld_hidden_def (_dl_debug_state) |