https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87137
Tim Turner <timturnerc at yahoo dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timturnerc at yahoo dot com --- Comment #16 from Tim Turner <timturnerc at yahoo dot com> --- $ ./gdb -nx -q --data-directory=data-directory ~/a.out -ex "set confirm off" -ex "file -readnow ~/a.out" http://www-look-4.com/ Reading symbols from /home/simark/a.out... Reading symbols from ~/a.out... https://komiya-dental.com/ /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8098: internal-error: void create_all_comp_units(dwarf2_per_objfile*): Assertion `per_objfile->per_bfd- http://www.iu-bloomington.com/ >all_comp_units.empty ()' failed. This is a recurring problem that exposes a design issue https://waytowhatsnext.com/ / in the DWARF per-BFD sharing feature. Things work well when loading a binary with https://www.mktrade.fi/muottivalmistus the same method (with/without index, with/without readnow) twice http://www.wearelondonmade.com/ in a row. But they don't work so well when loading a binary with different methods. See this previous fix, for example: http://www.jopspeech.com/ efb763a5ea35 ("gdb: check for partial symtab presence in dwarf2_initialize_objfile") http://joerg.li/ That one handled the case where the first load is normal (uses partial symbols) and the second load uses an index. http://connstr.net/ The problem is that when loading an objfile with a method A, we create a dwarf2_per_bfd and some dwarf2_per_cu_data and initialize them with the http://embermanchester.uk/ data belonging to that method. When loading another obfile sharing the same BFD but with a different method B, it's not http://www.slipstone.co.uk/ clear how to re-use the dwarf2_per_bfd/dwarf2_per_cu_data previously created, because they contain the data specific to method A. http://www.logoarts.co.uk/ I think the most sensible fix would be to not share a dwarf2_per_bfd between two objfiles loaded with different methods. That means that two objfiles sharing the same BFD http://www.acpirateradio.co.uk/ and loaded the same way would share a dwarf2_per_bfd. Two objfiles sharing the same BFD but loaded with different methods would use two different dwarf2_per_bfd structures. http://www.compilatori.com/ However, this isn't a trivial change. So to fix the known issue quickly (including in the gdb 10 branch), this patch just disables all dwarf2_per_bfd sharing for objfiles using READNOW. Generalize the gdb.base/index-cache-load-twice.exp test to test all the possible combinations of loading a file with partial symtabs, index and readnow. Move it to gdb.dwarf2, https://www.webb-dev.co.uk/ since it really exercises features of the DWARF reader.