Re: [patch] Fix assert crashes with minidebuginfo

Jan Kratochvil
2013-02-01T19:06:48Z

On Fri, 01 Feb 2013 19:21:34 +0100, Jan Kratochvil wrote:
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 63bf329..6f968b7 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -823,7 +823,12 @@ static void
> read_symbols (struct objfile *objfile, int add_flags)
> {
> (*objfile->sf->sym_read) (objfile, add_flags);
> - if (!objfile_has_partial_symbols (objfile))
> +
> + /* find_separate_debug_file_in_section should be called only if there is
> + single binary with no existing separate debug info file. */
> + if (!objfile_has_partial_symbols (objfile)
> + && objfile->separate_debug_objfile == NULL
> + && objfile->separate_debug_objfile_backlink == NULL)
> {
> bfd *abfd = find_separate_debug_file_in_section (objfile);
> struct cleanup *cleanup = make_cleanup_bfd_unref (abfd);

As discussed with Tom off-list:

first entry:
* SYM_READ reads separate .debug file.

second entry, called for the .debug file:
* nothing interesting as objfile_has_partial_symbols (objfile).

first entry continues:
* But the primary file still !objfile_has_partial_symbols (objfile),
therefore minidebuginfo is read as a secondary debug info file
(those are supported for MacOSX).

third entry, called for the minidebuginfo
* SYM_READ starts to search for separate debug info (via its PT_NOTE
build-id) file for the minidebuginfo file.
=> crash

Regards,
Jan