Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] xcoffread.c: handle -bbigtoc binaries
@ 2001-04-12 12:02 Nicholas Duffek
  2001-04-12 12:23 ` Kevin Buettner
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Duffek @ 2001-04-12 12:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Peter.Schauer, kevinb

This patch prevents "pc 0x... in read in psymtab, but not in symtab"
warnings when debugging binaries linked with -bbigtoc.

Explanation:

-bbigtoc binaries have extra sections named @FIX1 containing
linker-generated code to perform data loads from distant locations.  E.g.,
if 'foo' in the following instruction:

  lwz r9,foo(r2)

is greater than 32767, the linker might replace the lwz with a branch to
linker-generated code that does the load in 2 instructions and then
branches back to where execution should continue.

When xcoffread.c encounters such a section, it allocates a new psymtab for
the range of linker-generated instructions contained in the section.
However, the section doesn't associate those instructions with any
functions.  Consequently, when GDB tries to resolve one of those
instructions to a symbolic name, it fails, resulting in the "pc 0x... in
read in psymtab, but not in symtab" warning.

The appended patch avoids that warning by ignoring section names beginning
with '@'.

ChangeLog:

	* xcoffread.c (scan_xcoff_symtab): Ignore symbols beginning with
	"@".

Tested on powerpc-ibm-aix4.3.3.0.  Okay to apply?

Nicholas Duffek
<nsd@redhat.com>

[patch follows]

Index: gdb/xcoffread.c
===================================================================
diff -up gdb/xcoffread.c gdb/xcoffread.c
--- gdb/xcoffread.c	Thu Apr 12 14:39:21 2001
+++ gdb/xcoffread.c	Thu Apr 12 14:39:09 2001
@@ -2243,8 +2243,14 @@ scan_xcoff_symtab (struct objfile *objfi
 	    else
 	      csect_aux = main_aux[0];
 
-	    /* If symbol name starts with ".$" or "$", ignore it.  */
-	    if (namestring[0] == '$'
+	    /* If symbol name starts with ".$" or "$", ignore it. 
+
+	       A symbol like "@FIX1" introduces a section for -bbigtoc jump
+	       tables, which contain anonymous linker-generated code. 
+	       Ignore those sections to avoid "pc 0x... in read in psymtab,
+	       but not in symtab" warnings from find_pc_sect_symtab.  */
+
+	    if (namestring[0] == '$' || namestring[0] == '@'
 		|| (namestring[0] == '.' && namestring[1] == '$'))
 	      break;
 


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

* Re: [RFA] xcoffread.c: handle -bbigtoc binaries
  2001-04-12 12:02 [RFA] xcoffread.c: handle -bbigtoc binaries Nicholas Duffek
@ 2001-04-12 12:23 ` Kevin Buettner
  2001-04-12 12:55   ` Nick Duffek
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Buettner @ 2001-04-12 12:23 UTC (permalink / raw)
  To: Nicholas Duffek, gdb-patches; +Cc: Peter.Schauer, kevinb

On Apr 12,  2:57pm, Nicholas Duffek wrote:

> 	* xcoffread.c (scan_xcoff_symtab): Ignore symbols beginning with
> 	"@".
> 
> Tested on powerpc-ibm-aix4.3.3.0.  Okay to apply?

Yes.  Please check it in.

Kevin


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

* Re: [RFA] xcoffread.c: handle -bbigtoc binaries
  2001-04-12 12:23 ` Kevin Buettner
@ 2001-04-12 12:55   ` Nick Duffek
  2001-04-12 14:14     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Duffek @ 2001-04-12 12:55 UTC (permalink / raw)
  To: kevinb; +Cc: gdb-patches, Peter.Schauer

On 12-Apr-2001, Kevin Buettner wrote:

>Yes.  Please check it in.

Thanks, I've committed it.

Nick


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

* Re: [RFA] xcoffread.c: handle -bbigtoc binaries
  2001-04-12 12:55   ` Nick Duffek
@ 2001-04-12 14:14     ` Andrew Cagney
  2001-04-12 14:53       ` Kevin Buettner
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2001-04-12 14:14 UTC (permalink / raw)
  To: Nick Duffek; +Cc: kevinb, gdb-patches, Peter.Schauer

Nick Duffek wrote:
> 
> On 12-Apr-2001, Kevin Buettner wrote:
> 
> >Yes.  Please check it in.
> 
> Thanks, I've committed it.

Kevin, I guess you're calling this an obvious fix?  Anyway, the comment:

+           /* If symbol name starts with ".$" or "$", ignore it. 

doesn't match the code.

+           if (namestring[0] == '$' || namestring[0] == '@'

	Andrew


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

* Re: [RFA] xcoffread.c: handle -bbigtoc binaries
  2001-04-12 14:14     ` Andrew Cagney
@ 2001-04-12 14:53       ` Kevin Buettner
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Buettner @ 2001-04-12 14:53 UTC (permalink / raw)
  To: Andrew Cagney, Nick Duffek; +Cc: kevinb, gdb-patches, Peter.Schauer

On Apr 12,  5:13pm, Andrew Cagney wrote:

> Kevin, I guess you're calling this an obvious fix?

No.  I don't regard this as obvious.  In fact, when I first heard of
this change (a couple of days ago), I had some concerns.  But I've
been following some internal (Red Hat) discussion regarding this
change and it seems okay to me now.

I was approving Nick's patch as one of the AIX maintainers.  If I've
stepped on someone's toes, I apologize.  If someone feels that this
change demands more discussion, I'll ask Nick to revert it until a
consensus is reached.

> Anyway, the comment:
> 
> +           /* If symbol name starts with ".$" or "$", ignore it. 
> 
> doesn't match the code.
> 
> +           if (namestring[0] == '$' || namestring[0] == '@'

If you read the entire comment and the entire if-condition, I believe
it's covered...

	    /* If symbol name starts with ".$" or "$", ignore it. 

	       A symbol like "@FIX1" introduces a section for -bbigtoc jump
	       tables, which contain anonymous linker-generated code. 
	       Ignore those sections to avoid "pc 0x... in read in psymtab,
	       but not in symtab" warnings from find_pc_sect_symtab.  */

	    if (namestring[0] == '$' || namestring[0] == '@'
		|| (namestring[0] == '.' && namestring[1] == '$'))
	      break;


Though I admit that when I first read the patch, I was puzzled too. 
Perhaps it would be clearer if the first line of the comment were
revised to read as follows...

	    /* If symbol name starts with ".$", "$", or "@", ignore it. 

?

BTW, I should add that I appreciate Nick's additional commentary
regarding the reason for ignoring the "@" symbols.  I only wish the
author of the original comment would've done the same for the ".$" and
"$" prefixes.

Kevin


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

end of thread, other threads:[~2001-04-12 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-12 12:02 [RFA] xcoffread.c: handle -bbigtoc binaries Nicholas Duffek
2001-04-12 12:23 ` Kevin Buettner
2001-04-12 12:55   ` Nick Duffek
2001-04-12 14:14     ` Andrew Cagney
2001-04-12 14:53       ` Kevin Buettner

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