This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
src/gdb ChangeLog machoread.c
- From: brobecke at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 1 Jul 2011 18:36:36 -0000
- Subject: src/gdb ChangeLog machoread.c
CVSROOT: /cvs/src
Module name: src
Changes by: brobecke@sourceware.org 2011-07-01 18:36:36
Modified files:
gdb : ChangeLog machoread.c
Log message:
[mach-o] get rid of current_oso global
This current_oso global was used to store the OSO's symbol table
in order to relocate common symbols. But it is also making the
assumption that all sections are going to be immediately relocated
as macho_add_oso_symfile does:
- Initialize the current_oso
- Use it through symbol_file_add_from_bfd
- Reset the current_oso (to all fields NULL)
What actually happens is that the .debug_frame section gets read
lazily, and thus relocated at a later time. This relocation causes
current_oso.symbol_table to be initialized (see macho_symfile_relocate)
again. And this eventually causes to trip the...
gdb_assert (current_oso.symbol_table == NULL);
...assertion to fail because the symbol_table was never free'ed.
To be complete, this happens because macho_symfile_relocate was
called outside of macho_add_oso_symfile's control, where the
set-global/use/unset-global dance happens.
But it looks like keeping this global around is not necessary, as
this symbol table is only used to relocate the common symbols.
We can do that prior to relocating the rest of the symbols.
gdb/ChangeLog:
* machoread.c (struct macho_oso_data): Delete.
(current_oso): Delete.
(macho_relocate_common_syms): New function, mostly extracted
out of
(macho_add_oso_symfile): Call macho_relocate_common_syms.
Remove code that sets and unset current_oso.
(macho_symfile_relocate): Delete handling of common symbols,
now moved to macho_relocate_common_syms.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13146&r2=1.13147
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/machoread.c.diff?cvsroot=src&r1=1.28&r2=1.29