]> git.ipfire.org Git - thirdparty/glibc.git/blame - elf/dl-debug.c
\indexbreaks, \realunder, \multitable, \footnotezzz.
[thirdparty/glibc.git] / elf / dl-debug.c
CommitLineData
4d6acc61
RM
1/* Communicate dynamic linker state to the debugger at runtime.
2Copyright (C) 1996 Free Software Foundation, Inc.
3This file is part of the GNU C Library.
4
5The GNU C Library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Library General Public License as
7published by the Free Software Foundation; either version 2 of the
8License, or (at your option) any later version.
9
10The GNU C Library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13Library General Public License for more details.
14
15You should have received a copy of the GNU Library General Public
16License along with the GNU C Library; see the file COPYING.LIB. If
17not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18Cambridge, MA 02139, USA. */
19
20#include <link.h>
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. */
26struct 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
33struct r_debug *
34_dl_debug_initialize (ElfW(Addr) ldbase)
35{
36 if (_r_debug.r_brk == 0)
37 {
38 /* Tell the debugger where to find the map of loaded objects. */
39 _r_debug.r_version = 1 /* R_DEBUG_VERSION XXX */;
8a594e3c 40 _r_debug.r_ldbase = ldbase;
4d6acc61
RM
41 _r_debug.r_map = _dl_loaded;
42 _r_debug.r_brk = (ElfW(Addr)) &_dl_debug_state;
43 }
44
45 return &_r_debug;
46}
47
48
49/* This function exists solely to have a breakpoint set on it by the
50 debugger. The debugger is supposed to find this function's address by
51 examining the r_brk member of struct r_debug, but GDB 4.15 in fact looks
52 for this particular symbol name in the PT_INTERP file. */
53void
54_dl_debug_state (void)
55{
56}