This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Uninitialized section index internal error on Tru64 5.1
- To: gdb-patches at sources dot redhat dot com
- Subject: Uninitialized section index internal error on Tru64 5.1
- From: Joel Brobecker <brobecker at act-europe dot fr>
- Date: Thu, 10 May 2001 21:44:47 +0200
Hi,
While working on gdb on Tru64 5.1, we noticed the following internal
error sometimes happening at the begining of a gdb session:
> gdb/mdebugread.c:2448: gdb-internal-error: Section index is uninitialized
>
> An internal GDB error was detected. This may make further
> debugging unreliable. Continue this debugging session? (y or n) n
To reproduce the problem, simply compile the following C program:
mach.c:
<<
int
main (void)
{
return 0;
};
>>
Make sure libmach is linked in when building the program:
% gcc -o mach mach.c -lmach
After for investigation, I found that gdb was looking for a symbol in
the .bss section of libmach.so, but there is none (which explains why
the section index is not initialized). Instead, there is a .sbss
section, where the symbol is localized.
I modified default_symfile_offsets () to use the .sbss section if the
.bss one does not exist. In that change, I am assuming that a bss and a
sbss section are mutually exclusive.
This change has been integrated in ACT's version of gdb a few months
ago, and has worked well so far. I am attaching a patch that includes
this change along with the ChangeLog.
--
Joel
PS: Please note that I am sending this patch on behalf of ACT (Ada Core
Technologies). I haven't filed an assignment for gdb changes under my
name, but ACT has.
Index: gdb/symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 symfile.c
*** symfile.c 2001/04/05 02:02:13 1.31
--- symfile.c 2001/05/10 19:41:39
*************** default_symfile_offsets (struct objfile
*** 529,534 ****
--- 529,536 ----
objfile->sect_index_data = sect->index;
sect = bfd_get_section_by_name (objfile->obfd, ".bss");
+ if (!sect)
+ sect = bfd_get_section_by_name (objfile->obfd, ".sbss");
if (sect)
objfile->sect_index_bss = sect->index;
Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.1223
diff -c -3 -p -r1.1223 ChangeLog
*** ChangeLog 2001/05/07 20:02:24 1.1223
--- ChangeLog 2001/05/10 19:41:42
***************
*** 1,3 ****
--- 1,8 ----
+ 2001-05-10 J. Brobecker <brobecker@act-europe.fr>
+
+ * symfile.c (default_symfile_offsets): use the .sbss section in
+ place of the .bss section when the latter does not exist.
+
2001-05-07 Andrew Cagney <ac131313@redhat.com>
* MAINTAINERS: I'm no longer actively maintaining the mn10300