Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa/symtab] Move find_pc_section call to lookup_minimal_symbol_by_pc
@ 2004-01-27 22:23 Andrew Cagney
  2004-01-27 22:52 ` Daniel Jacobowitz
  2004-01-29 20:15 ` Elena Zannoni
  0 siblings, 2 replies; 24+ messages in thread
From: Andrew Cagney @ 2004-01-27 22:23 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 897 bytes --]

Hello,

Ref: RFA symtab: Fix for PR c++/1267 ("next" and shared libraries)
http://sources.redhat.com/ml/gdb-patches/2003-07/msg00354.html

The change unfortunatly broke IRIX 6.5's host compiler which is using 
mdebugread :-(  That code was looking for a symbol in the absolute 
section "*ABS*" but the PR/1267 change was causing *ABS* symbols to be 
ignored (find_pc_section didn't return an absolute section).

Since the underlying problem with PR/1267 was with the frame code 
needing a minimal symbol that was in the same section as the frame's PC, 
and that code [indirectly] calls lookup_minimal_symbol_by_pc, I moved 
the find_pc_section call to that function.

Tested on i386 GNU/Linux (dwarf 2) with no regressions.
Tested on PPC NetBSD (stabs) with no regressions.
Tested on IRIX and all the warnings, and many failures, disappeared.
See gdb/1519 for how to exercise the bug.

ok?
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 3199 bytes --]

2004-01-27  Andrew Cagney  <cagney@redhat.com>

	* minsyms.c (lookup_minimal_symbol_by_pc): Use find_pc_section
	instead of find_pc_mapped_section.
	(lookup_minimal_symbol_by_pc_section): If the SECTION is NULL, do
	not default to the section containing PC.  Fix PR gdb/1519.

Index: minsyms.c
===================================================================
RCS file: /cvs/src/src/gdb/minsyms.c,v
retrieving revision 1.39
diff -u -r1.39 minsyms.c
--- minsyms.c	11 Nov 2003 20:04:52 -0000	1.39
+++ minsyms.c	27 Jan 2004 21:24:26 -0000
@@ -355,7 +355,7 @@
 
 /* Search through the minimal symbol table for each objfile and find
    the symbol whose address is the largest address that is still less
-   than or equal to PC, and matches SECTION (if non-null).  Returns a
+   than or equal to PC, and matches SECTION (if non-NULL).  Returns a
    pointer to the minimal symbol if such a symbol is found, or NULL if
    PC is not in a suitable range.  Note that we need to look through
    ALL the minimal symbol tables before deciding on the symbol that
@@ -374,20 +374,23 @@
   struct minimal_symbol *best_symbol = NULL;
   struct obj_section *pc_section;
 
-  /* pc has to be in a known section. This ensures that anything beyond
-     the end of the last segment doesn't appear to be part of the last
-     function in the last segment.  */
+  /* PC has to be in a known section.  This ensures that anything
+     beyond the end of the last segment doesn't appear to be part of
+     the last function in the last segment.  */
   pc_section = find_pc_section (pc);
   if (pc_section == NULL)
     return NULL;
 
-  /* If no section was specified, then just make sure that the PC is in
-     the same section as the minimal symbol we find.  */
-  if (section == NULL)
-    section = pc_section->the_bfd_section;
-
-  /* FIXME drow/2003-07-19: Should we also check that PC is in SECTION
-     if we were passed a non-NULL SECTION argument?  */
+  /* NOTE: cagney/2004-01-27: Removed code (added 2003-07-19) that was
+     trying to force the PC into a valid section as returned by
+     find_pc_section.  It broke IRIX 6.5 mdebug which relies on this
+     code returning an absolute symbol - the problem was that
+     find_pc_section wasn't returning an absolute section and hence
+     the code below would skip over absolute symbols.  Since the
+     original problem was with finding a frame's function, and that
+     uses [indirectly] lookup_minimal_symbol_by_pc, the original
+     problem has been fixed by having that function use
+     find_pc_section.  */
 
   for (objfile = object_files;
        objfile != NULL;
@@ -497,7 +500,13 @@
 struct minimal_symbol *
 lookup_minimal_symbol_by_pc (CORE_ADDR pc)
 {
-  return lookup_minimal_symbol_by_pc_section (pc, find_pc_mapped_section (pc));
+  /* NOTE: cagney/2004-01-27: This was using find_pc_mapped_section to
+     force the section but that (well unless you're doing overlay
+     debugging) always returns NULL making the call somewhat useless.  */
+  struct obj_section *section = find_pc_section (pc);
+  if (section == NULL)
+    return NULL;
+  return lookup_minimal_symbol_by_pc_section (pc, section->the_bfd_section);
 }
 \f
 

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: [rfa/symtab] Move find_pc_section call to lookup_minimal_symbol_by_pc
@ 2004-02-09 21:58 Michael Elizabeth Chastain
  2004-02-10 16:38 ` Adam Fedor
  2004-02-16 18:11 ` Elena Zannoni
  0 siblings, 2 replies; 24+ messages in thread
From: Michael Elizabeth Chastain @ 2004-02-09 21:58 UTC (permalink / raw)
  To: ezannoni, fedor; +Cc: cagney, gdb-patches

The filenames are a problem because gdb1237-1280-main.c
and gdb1237-1280.c are not 8.3 unique.

You either have to make them 8.3 unique (preferred) or
add lines to config/djgpp/fnchange.lst.

For the kfail's, please use more specific patterns than just
".*$gdb_prompt $".  kfail's should be for known bugs, which means
there should be known-bad output.  If the output doesn't match a
specific known-bad output, then it means that gdb has regressed
even more, and the KFAIL turns into a FAIL (this does happen).

You don't need to call get_compiler_info unless you use one of
these functions or data symbols later: test_compiler_info,
gcc_compiled, hp_cc_compiler, hp_aCC_compiler, signed_keyword_not_used.

I missed the beginning of the thread, but it helps to say what
system(s) you tested it on (so when it breaks on a different system
later, it makes it easier to figure out what is wrong ... morbid
but true).

Michael C


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2004-02-18  3:40 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-27 22:23 [rfa/symtab] Move find_pc_section call to lookup_minimal_symbol_by_pc Andrew Cagney
2004-01-27 22:52 ` Daniel Jacobowitz
2004-01-29 20:15 ` Elena Zannoni
2004-01-29 23:22   ` Andrew Cagney
2004-01-30  3:30     ` Adam Fedor
2004-01-30  4:53     ` Adam Fedor
2004-02-04 22:25       ` Elena Zannoni
2004-02-09  4:26         ` Adam Fedor
2004-02-09 15:31           ` Elena Zannoni
2004-01-30  3:29   ` Adam Fedor
2004-02-04 22:20     ` Elena Zannoni
2004-02-04 23:06       ` Andrew Cagney
2004-02-06 18:59         ` Andrew Cagney
2004-02-08  5:17           ` Adam Fedor
2004-02-09 15:35           ` Elena Zannoni
2004-02-09 16:40             ` Andrew Cagney
2004-02-09 17:54               ` Joel Brobecker
2004-02-09 21:58 Michael Elizabeth Chastain
2004-02-10 16:38 ` Adam Fedor
2004-02-16 18:11 ` Elena Zannoni
2004-02-17  4:47   ` Adam Fedor
2004-02-17  5:00     ` Daniel Jacobowitz
2004-02-17 14:23     ` Elena Zannoni
2004-02-18  3:40       ` Adam Fedor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox