1 /* Target-dependent code for the GNU C Library (glibc).
3 Copyright 2002, 2003 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 2 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, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
28 #include "glibc-tdep.h"
30 /* Calling functions in shared libraries. */
32 /* Find the minimal symbol named NAME, and return both the minsym
33 struct and its objfile. This probably ought to be in minsym.c, but
34 everything there is trying to deal with things like C++ and
35 SOFUN_ADDRESS_MAYBE_TURQUOISE, ... Since this is so simple, it may
36 be considered too special-purpose for general consumption. */
38 static struct minimal_symbol
*
39 find_minsym_and_objfile (char *name
, struct objfile
**objfile_p
)
41 struct objfile
*objfile
;
43 ALL_OBJFILES (objfile
)
45 struct minimal_symbol
*msym
;
47 ALL_OBJFILE_MSYMBOLS (objfile
, msym
)
49 if (SYMBOL_LINKAGE_NAME (msym
)
50 && strcmp (SYMBOL_LINKAGE_NAME (msym
), name
) == 0)
61 /* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c.
63 1) decides whether a PLT has sent us into the linker to resolve
64 a function reference, and
65 2) if so, tells us where to set a temporary breakpoint that will
66 trigger when the dynamic linker is done. */
69 glibc_skip_solib_resolver (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
71 /* The GNU dynamic linker is part of the GNU C library, and is used
72 by all GNU systems (GNU/Hurd, GNU/Linux). An unresolved PLT
73 entry points to "_dl_runtime_resolve", which calls "fixup" to
74 patch the PLT, and then passes control to the function.
76 We look for the symbol `_dl_runtime_resolve', and find `fixup' in
77 the same objfile. If we are at the entry point of `fixup', then
78 we set a breakpoint at the return address (at the top of the
81 It's kind of gross to do all these checks every time we're
82 called, since they don't change once the executable has gotten
83 started. But this is only a temporary hack --- upcoming versions
84 of GNU/Linux will provide a portable, efficient interface for
85 debugging programs that use shared libraries. */
87 struct objfile
*objfile
;
88 struct minimal_symbol
*resolver
89 = find_minsym_and_objfile ("_dl_runtime_resolve", &objfile
);
93 struct minimal_symbol
*fixup
94 = lookup_minimal_symbol ("fixup", NULL
, objfile
);
96 if (fixup
&& SYMBOL_VALUE_ADDRESS (fixup
) == pc
)
97 return frame_pc_unwind (get_current_frame ());
This page took 0.030098 seconds and 4 git commands to generate.