Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: ppluzhnikov@google.com (Paul Pluzhnikov)
To: gdb-patches@sourceware.org
Cc: Frank Middleton <f.middleton@apogeect.com>
Subject: [patch] Fix a buglet in elfread.c
Date: Thu, 30 Apr 2009 16:48:00 -0000	[thread overview]
Message-ID: <20090430164806.7DED819C4E1@localhost> (raw)

Greetings,

GDB appears to make unwarranted assumptions about presence of .data,
.rodata in and ELF image.

In http://sourceware.org/ml/gdb/2009-04/msg00228.html you can see an image
on Solaris which has .rodata, but no .data, and this causes

  elfread.c:366: internal-error: sect_index_data not initialized

when using /usr/lib/libXau.so.6 from Solaris snv103 (SunOS 5.11) for SPARC.

Attached patch fixes that.

OK?

--
Paul Pluzhnikov

2009-04-30  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* elfread.c (elf_symtab_read): Don't assume .data and .rodata
	are present.


Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.76
diff -u -p -u -r1.76 elfread.c
--- elfread.c	3 Jan 2009 05:57:51 -0000	1.76
+++ elfread.c	30 Apr 2009 15:03:41 -0000
@@ -427,10 +427,11 @@ elf_symtab_read (struct objfile *objfile
 			  int max_index;
 			  size_t size;
 
-			  max_index 
-			    = max (SECT_OFF_BSS (objfile),
-				   max (SECT_OFF_DATA (objfile),
-					SECT_OFF_RODATA (objfile)));
+			  max_index = SECT_OFF_BSS (objfile);
+			  if (objfile->sect_index_data > max_index)
+			    max_index = objfile->sect_index_data;
+			  if (objfile->sect_index_rodata > max_index)
+			    max_index = objfile->sect_index_rodata;
 
 			  /* max_index is the largest index we'll
 			     use into this array, so we must


             reply	other threads:[~2009-04-30 16:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 16:48 Paul Pluzhnikov [this message]
2009-04-30 17:05 ` Joel Brobecker
2009-04-30 21:54 ` Joel Brobecker
2009-04-30 22:00   ` Paul Pluzhnikov
2009-05-01  0:07   ` Frank Middleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090430164806.7DED819C4E1@localhost \
    --to=ppluzhnikov@google.com \
    --cc=f.middleton@apogeect.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox