This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Trunk GDB dumps core in solib.c:symbol_add_stub
- To: gdb at sourceware dot cygnus dot com
- Subject: Trunk GDB dumps core in solib.c:symbol_add_stub
- From: "Peter.Schauer" <Peter dot Schauer at regent dot e-technik dot tu-muenchen dot de>
- Date: Tue, 2 May 2000 13:30:23 MET DST
- Cc: ezannoni at cygnus dot com
This change:
2000-04-17 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* solib.c (symbol_add_stub): The special field text_addr is not
available anymore. Search for the .text field the hard way.
causes a GDB core dump on Solaris x86 as soon as a simple main is linked
against -lintl (which contains no .text section) and GDB is told to run to
to main:
pes@eno_2439$ cat main.c
int
main()
{
return 0;
}
pes@eno_2440$ gcc -g main.c -lintl
pes@eno_2441$ gdb a.out
GNU gdb 20000204
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.6"...
(gdb) b main
Breakpoint 1 at 0x8048a4b: file main.c, line 4.
(gdb) r
Starting program: /users/pes/tst/a.out
Segmentation Fault(coredump)
The patch below gets rid of the core dump, but I am not sure if it
does the right thing (don't we have to consider the lowest section ?).
--- gdb/solib.c.orig Thu Apr 20 17:36:56 2000
+++ gdb/solib.c Sun Apr 30 12:14:52 2000
@@ -1188,11 +1188,15 @@ symbol_add_stub (arg)
/* Look for the index for the .text section in the sap structure. */
text_section = bfd_get_section_by_name (so->abfd, ".text");
- for (i = 0; i < MAX_SECTIONS && sap->other[i].name; i++)
- if (sap->other[i].sectindex == text_section->index)
- break;
-
- sap->other[i].addr = text_addr;
+ if (text_section != NULL)
+ {
+ for (i = 0; i < MAX_SECTIONS && sap->other[i].name; i++)
+ if (sap->other[i].sectindex == text_section->index)
+ break;
+
+ if (i < MAX_SECTIONS)
+ sap->other[i].addr = text_addr;
+ }
so->objfile = symbol_file_add (so->so_name, so->from_tty,
sap, 0, OBJF_SHARED);
free_section_addr_info (sap);
--
Peter Schauer pes@regent.e-technik.tu-muenchen.de