1 /* Target-dependent code for the GNU C Library (glibc).
3 Copyright (C) 2002, 2003, 2007, 2008 Free Software Foundation, Inc.
5 This file is part of GDB.
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 3 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 #include "glibc-tdep.h"
28 /* Calling functions in shared libraries. */
30 /* Find the minimal symbol named NAME, and return both the minsym
31 struct and its objfile. This probably ought to be in minsym.c, but
32 everything there is trying to deal with things like C++ and
33 SOFUN_ADDRESS_MAYBE_TURQUOISE, ... Since this is so simple, it may
34 be considered too special-purpose for general consumption. */
36 static struct minimal_symbol
*
37 find_minsym_and_objfile (char *name
, struct objfile
**objfile_p
)
39 struct objfile
*objfile
;
41 ALL_OBJFILES (objfile
)
43 struct minimal_symbol
*msym
;
45 ALL_OBJFILE_MSYMBOLS (objfile
, msym
)
47 if (SYMBOL_LINKAGE_NAME (msym
)
48 && strcmp (SYMBOL_LINKAGE_NAME (msym
), name
) == 0)
59 /* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c.
61 1) decides whether a PLT has sent us into the linker to resolve
62 a function reference, and
63 2) if so, tells us where to set a temporary breakpoint that will
64 trigger when the dynamic linker is done. */
67 glibc_skip_solib_resolver (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
69 /* The GNU dynamic linker is part of the GNU C library, and is used
70 by all GNU systems (GNU/Hurd, GNU/Linux). An unresolved PLT
71 entry points to "_dl_runtime_resolve", which calls "fixup" to
72 patch the PLT, and then passes control to the function.
74 We look for the symbol `_dl_runtime_resolve', and find `fixup' in
75 the same objfile. If we are at the entry point of `fixup', then
76 we set a breakpoint at the return address (at the top of the
79 It's kind of gross to do all these checks every time we're
80 called, since they don't change once the executable has gotten
81 started. But this is only a temporary hack --- upcoming versions
82 of GNU/Linux will provide a portable, efficient interface for
83 debugging programs that use shared libraries. */
85 struct objfile
*objfile
;
86 struct minimal_symbol
*resolver
87 = find_minsym_and_objfile ("_dl_runtime_resolve", &objfile
);
91 /* The dynamic linker began using this name in early 2005. */
92 struct minimal_symbol
*fixup
93 = lookup_minimal_symbol ("_dl_fixup", NULL
, objfile
);
95 /* This is the name used in older versions. */
97 fixup
= lookup_minimal_symbol ("fixup", NULL
, objfile
);
99 if (fixup
&& SYMBOL_VALUE_ADDRESS (fixup
) == pc
)
100 return frame_pc_unwind (get_current_frame ());
This page took 0.031532 seconds and 4 git commands to generate.