• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂c44f198a3d152a2c6339289bfc81ca794c5aa31c (tree)
時間2003-06-11 17:57:46
作者Jim Blandy <jimb@code...>
CommiterJim Blandy

Log Message

* solib-svr4.c (bfd_lookup_symbol): New SECT_FLAGS argument.
(enable_break): Pass SEC_CODE as the SECT_FLAGS argument to
bfd_lookup_symbol, since we only want symbols in code sections.
(look_for_base): Pass zero as the SECT_FLAGS argument to
bfd_lookup_symbol, since we're not concerned about which section
the symbol is in.

Change Summary

差異

--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -159,7 +159,7 @@ static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
159159
160160 static int match_main (char *);
161161
162-static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
162+static CORE_ADDR bfd_lookup_symbol (bfd *, char *, flagword);
163163
164164 /*
165165
@@ -169,7 +169,7 @@ static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
169169
170170 SYNOPSIS
171171
172- CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
172+ CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname, flagword sect_flags)
173173
174174 DESCRIPTION
175175
@@ -178,12 +178,15 @@ static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
178178 shared library support to find the address of the debugger
179179 interface structures in the shared library.
180180
181+ If SECT_FLAGS is non-zero, only match symbols in sections whose
182+ flags include all those in SECT_FLAGS.
183+
181184 Note that 0 is specifically allowed as an error return (no
182185 such symbol).
183186 */
184187
185188 static CORE_ADDR
186-bfd_lookup_symbol (bfd *abfd, char *symname)
189+bfd_lookup_symbol (bfd *abfd, char *symname, flagword sect_flags)
187190 {
188191 long storage_needed;
189192 asymbol *sym;
@@ -204,7 +207,8 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
204207 for (i = 0; i < number_of_symbols; i++)
205208 {
206209 sym = *symbol_table++;
207- if (STREQ (sym->name, symname))
210+ if (STREQ (sym->name, symname)
211+ && (sym->section->flags & sect_flags) == sect_flags)
208212 {
209213 /* Bfd symbols are section relative. */
210214 symaddr = sym->value + sym->section->vma;
@@ -231,7 +235,9 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
231235 for (i = 0; i < number_of_symbols; i++)
232236 {
233237 sym = *symbol_table++;
234- if (STREQ (sym->name, symname))
238+
239+ if (STREQ (sym->name, symname)
240+ && (sym->section->flags & sect_flags) == sect_flags)
235241 {
236242 /* Bfd symbols are section relative. */
237243 symaddr = sym->value + sym->section->vma;
@@ -337,7 +343,7 @@ look_for_base (int fd, CORE_ADDR baseaddr)
337343
338344 for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
339345 {
340- address = bfd_lookup_symbol (interp_bfd, *symbolp);
346+ address = bfd_lookup_symbol (interp_bfd, *symbolp, 0);
341347 if (address != 0)
342348 {
343349 break;
@@ -1039,7 +1045,16 @@ enable_break (void)
10391045 /* Now try to set a breakpoint in the dynamic linker. */
10401046 for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
10411047 {
1042- sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep);
1048+ /* On ABI's that use function descriptors, there are usually
1049+ two linker symbols associated with each C function: one
1050+ pointing at the actual entry point of the machine code,
1051+ and one pointing at the function's descriptor. The
1052+ latter symbol has the same name as the C function.
1053+
1054+ What we're looking for here is the machine code entry
1055+ point, so we are only interested in symbols in code
1056+ sections. */
1057+ sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep, SEC_CODE);
10431058 if (sym_addr != 0)
10441059 break;
10451060 }