1 /* Target-dependent code for the GNU C Library (glibc).
3 Copyright (C) 2002, 2003, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 #include "glibc-tdep.h"
29 /* Calling functions in shared libraries. */
31 /* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c.
33 1) decides whether a PLT has sent us into the linker to resolve
34 a function reference, and
35 2) if so, tells us where to set a temporary breakpoint that will
36 trigger when the dynamic linker is done. */
39 glibc_skip_solib_resolver (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
41 /* The GNU dynamic linker is part of the GNU C library, and is used
42 by all GNU systems (GNU/Hurd, GNU/Linux). An unresolved PLT
43 entry points to "_dl_runtime_resolve", which calls "fixup" to
44 patch the PLT, and then passes control to the function.
46 We look for the symbol `_dl_runtime_resolve', and find `fixup' in
47 the same objfile. If we are at the entry point of `fixup', then
48 we set a breakpoint at the return address (at the top of the
51 It's kind of gross to do all these checks every time we're
52 called, since they don't change once the executable has gotten
53 started. But this is only a temporary hack --- upcoming versions
54 of GNU/Linux will provide a portable, efficient interface for
55 debugging programs that use shared libraries. */
57 struct objfile
*objfile
;
58 struct minimal_symbol
*resolver
59 = lookup_minimal_symbol_and_objfile ("_dl_runtime_resolve", &objfile
);
63 /* The dynamic linker began using this name in early 2005. */
64 struct minimal_symbol
*fixup
65 = lookup_minimal_symbol ("_dl_fixup", NULL
, objfile
);
67 /* This is the name used in older versions. */
69 fixup
= lookup_minimal_symbol ("fixup", NULL
, objfile
);
71 if (fixup
&& SYMBOL_VALUE_ADDRESS (fixup
) == pc
)
72 return frame_unwind_caller_pc (get_current_frame ());
This page took 0.031264 seconds and 4 git commands to generate.