Added new domain MODULE_DOMAIN for fortran modules to avoid
issues with sharing namespaces (e.g. when a variable currently
in scope has the same name as a module).
(gdb) ptype modname
old> No symbol "modname" in current context.
new> type = module modname
This fixes PR 15209 and also addresses the issue
with sharing namespaces:
https://sourceware.org/ml/gdb-patches/2013-02/msg00643.html
2013-11-19 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
* cp-namespace.c (cp_lookup_nested_symbol): Enable
nested lookups for fortran modules.
* dwarf2read.c (read_module): Add fortran module to
the symbol table.
(add_partial_symbol, add_partial_module): Add fortran
module to the partial symbol table.
(new_symbol_full): Create full symbol for fortran module.
* f-exp.y (yylex): Add new module domain to be parsed.
* symtab.h: New domain for fortran modules.
testsuite/
* gdb.fortran/module.exp: Completion matches fortran module
names as well. ptype/whatis on modules return a proper type.
Add new check for having the correct scope.
This patch is purely mechanical. It removes gdb_stat.h and changes
the code to use sys/stat.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/gdb_stat.h: Remove.
* ada-lang.c: Use sys/stat.h, not gdb_stat.h.
* common/filestuff.c: Use sys/stat.h, not gdb_stat.h.
* common/linux-osdata.c: Use sys/stat.h, not gdb_stat.h.
* corefile.c: Use sys/stat.h, not gdb_stat.h.
* ctf.c: Use sys/stat.h, not gdb_stat.h.
* darwin-nat.c: Use sys/stat.h, not gdb_stat.h.
* dbxread.c: Use sys/stat.h, not gdb_stat.h.
* dwarf2read.c: Use sys/stat.h, not gdb_stat.h.
* exec.c: Use sys/stat.h, not gdb_stat.h.
* gdbserver/linux-low.c: Use sys/stat.h, not gdb_stat.h.
* gdbserver/remote-utils.c: Use sys/stat.h, not gdb_stat.h.
* inf-child.c: Use sys/stat.h, not gdb_stat.h.
* jit.c: Use sys/stat.h, not gdb_stat.h.
* linux-nat.c: Use sys/stat.h, not gdb_stat.h.
* m68klinux-nat.c: Use sys/stat.h, not gdb_stat.h.
* main.c: Use sys/stat.h, not gdb_stat.h.
* mdebugread.c: Use sys/stat.h, not gdb_stat.h.
* mi/mi-cmd-env.c: Use sys/stat.h, not gdb_stat.h.
* nto-tdep.c: Use sys/stat.h, not gdb_stat.h.
* objfiles.c: Use sys/stat.h, not gdb_stat.h.
* procfs.c: Use sys/stat.h, not gdb_stat.h.
* remote-fileio.c: Use sys/stat.h, not gdb_stat.h.
* remote-mips.c: Use sys/stat.h, not gdb_stat.h.
* remote.c: Use sys/stat.h, not gdb_stat.h.
* rs6000-nat.c: Use sys/stat.h, not gdb_stat.h.
* sol-thread.c: Use sys/stat.h, not gdb_stat.h.
* solib-spu.c: Use sys/stat.h, not gdb_stat.h.
* source.c: Use sys/stat.h, not gdb_stat.h.
* symfile.c: Use sys/stat.h, not gdb_stat.h.
* symmisc.c: Use sys/stat.h, not gdb_stat.h.
* symtab.c: Use sys/stat.h, not gdb_stat.h.
* top.c: Use sys/stat.h, not gdb_stat.h.
* xcoffread.c: Use sys/stat.h, not gdb_stat.h.
This removes gdb_string.h. This patch is purely mechanical. I
created it by running the two commands:
git rm common/gdb_string.h
perl -pi -e's/"gdb_string.h"/<string.h>/;' *.[chyl] */*.[chyl]
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/gdb_string.h: Remove.
* aarch64-tdep.c: Use string.h, not gdb_string.h.
* ada-exp.y: Use string.h, not gdb_string.h.
* ada-lang.c: Use string.h, not gdb_string.h.
* ada-lex.l: Use string.h, not gdb_string.h.
* ada-typeprint.c: Use string.h, not gdb_string.h.
* ada-valprint.c: Use string.h, not gdb_string.h.
* aix-thread.c: Use string.h, not gdb_string.h.
* alpha-linux-tdep.c: Use string.h, not gdb_string.h.
* alpha-mdebug-tdep.c: Use string.h, not gdb_string.h.
* alpha-nat.c: Use string.h, not gdb_string.h.
* alpha-osf1-tdep.c: Use string.h, not gdb_string.h.
* alpha-tdep.c: Use string.h, not gdb_string.h.
* alphanbsd-tdep.c: Use string.h, not gdb_string.h.
* amd64-dicos-tdep.c: Use string.h, not gdb_string.h.
* amd64-linux-nat.c: Use string.h, not gdb_string.h.
* amd64-linux-tdep.c: Use string.h, not gdb_string.h.
* amd64-nat.c: Use string.h, not gdb_string.h.
* amd64-sol2-tdep.c: Use string.h, not gdb_string.h.
* amd64fbsd-tdep.c: Use string.h, not gdb_string.h.
* amd64obsd-tdep.c: Use string.h, not gdb_string.h.
* arch-utils.c: Use string.h, not gdb_string.h.
* arm-linux-nat.c: Use string.h, not gdb_string.h.
* arm-linux-tdep.c: Use string.h, not gdb_string.h.
* arm-tdep.c: Use string.h, not gdb_string.h.
* arm-wince-tdep.c: Use string.h, not gdb_string.h.
* armbsd-tdep.c: Use string.h, not gdb_string.h.
* armnbsd-nat.c: Use string.h, not gdb_string.h.
* armnbsd-tdep.c: Use string.h, not gdb_string.h.
* armobsd-tdep.c: Use string.h, not gdb_string.h.
* avr-tdep.c: Use string.h, not gdb_string.h.
* ax-gdb.c: Use string.h, not gdb_string.h.
* ax-general.c: Use string.h, not gdb_string.h.
* bcache.c: Use string.h, not gdb_string.h.
* bfin-tdep.c: Use string.h, not gdb_string.h.
* breakpoint.c: Use string.h, not gdb_string.h.
* build-id.c: Use string.h, not gdb_string.h.
* buildsym.c: Use string.h, not gdb_string.h.
* c-exp.y: Use string.h, not gdb_string.h.
* c-lang.c: Use string.h, not gdb_string.h.
* c-typeprint.c: Use string.h, not gdb_string.h.
* c-valprint.c: Use string.h, not gdb_string.h.
* charset.c: Use string.h, not gdb_string.h.
* cli-out.c: Use string.h, not gdb_string.h.
* cli/cli-cmds.c: Use string.h, not gdb_string.h.
* cli/cli-decode.c: Use string.h, not gdb_string.h.
* cli/cli-dump.c: Use string.h, not gdb_string.h.
* cli/cli-interp.c: Use string.h, not gdb_string.h.
* cli/cli-logging.c: Use string.h, not gdb_string.h.
* cli/cli-script.c: Use string.h, not gdb_string.h.
* cli/cli-setshow.c: Use string.h, not gdb_string.h.
* cli/cli-utils.c: Use string.h, not gdb_string.h.
* coffread.c: Use string.h, not gdb_string.h.
* common/common-utils.c: Use string.h, not gdb_string.h.
* common/filestuff.c: Use string.h, not gdb_string.h.
* common/linux-procfs.c: Use string.h, not gdb_string.h.
* common/linux-ptrace.c: Use string.h, not gdb_string.h.
* common/signals.c: Use string.h, not gdb_string.h.
* common/vec.h: Use string.h, not gdb_string.h.
* core-regset.c: Use string.h, not gdb_string.h.
* corefile.c: Use string.h, not gdb_string.h.
* corelow.c: Use string.h, not gdb_string.h.
* cp-abi.c: Use string.h, not gdb_string.h.
* cp-support.c: Use string.h, not gdb_string.h.
* cp-valprint.c: Use string.h, not gdb_string.h.
* cris-tdep.c: Use string.h, not gdb_string.h.
* d-lang.c: Use string.h, not gdb_string.h.
* dbxread.c: Use string.h, not gdb_string.h.
* dcache.c: Use string.h, not gdb_string.h.
* demangle.c: Use string.h, not gdb_string.h.
* dicos-tdep.c: Use string.h, not gdb_string.h.
* disasm.c: Use string.h, not gdb_string.h.
* doublest.c: Use string.h, not gdb_string.h.
* dsrec.c: Use string.h, not gdb_string.h.
* dummy-frame.c: Use string.h, not gdb_string.h.
* dwarf2-frame.c: Use string.h, not gdb_string.h.
* dwarf2loc.c: Use string.h, not gdb_string.h.
* dwarf2read.c: Use string.h, not gdb_string.h.
* elfread.c: Use string.h, not gdb_string.h.
* environ.c: Use string.h, not gdb_string.h.
* eval.c: Use string.h, not gdb_string.h.
* event-loop.c: Use string.h, not gdb_string.h.
* exceptions.c: Use string.h, not gdb_string.h.
* exec.c: Use string.h, not gdb_string.h.
* expprint.c: Use string.h, not gdb_string.h.
* f-exp.y: Use string.h, not gdb_string.h.
* f-lang.c: Use string.h, not gdb_string.h.
* f-typeprint.c: Use string.h, not gdb_string.h.
* f-valprint.c: Use string.h, not gdb_string.h.
* fbsd-nat.c: Use string.h, not gdb_string.h.
* findcmd.c: Use string.h, not gdb_string.h.
* findvar.c: Use string.h, not gdb_string.h.
* fork-child.c: Use string.h, not gdb_string.h.
* frame.c: Use string.h, not gdb_string.h.
* frv-linux-tdep.c: Use string.h, not gdb_string.h.
* frv-tdep.c: Use string.h, not gdb_string.h.
* gdb.c: Use string.h, not gdb_string.h.
* gdb_bfd.c: Use string.h, not gdb_string.h.
* gdbarch.c: Use string.h, not gdb_string.h.
* gdbtypes.c: Use string.h, not gdb_string.h.
* gnu-nat.c: Use string.h, not gdb_string.h.
* gnu-v2-abi.c: Use string.h, not gdb_string.h.
* gnu-v3-abi.c: Use string.h, not gdb_string.h.
* go-exp.y: Use string.h, not gdb_string.h.
* go-lang.c: Use string.h, not gdb_string.h.
* go32-nat.c: Use string.h, not gdb_string.h.
* hppa-hpux-tdep.c: Use string.h, not gdb_string.h.
* hppa-linux-nat.c: Use string.h, not gdb_string.h.
* hppanbsd-tdep.c: Use string.h, not gdb_string.h.
* hppaobsd-tdep.c: Use string.h, not gdb_string.h.
* i386-cygwin-tdep.c: Use string.h, not gdb_string.h.
* i386-dicos-tdep.c: Use string.h, not gdb_string.h.
* i386-linux-nat.c: Use string.h, not gdb_string.h.
* i386-linux-tdep.c: Use string.h, not gdb_string.h.
* i386-nto-tdep.c: Use string.h, not gdb_string.h.
* i386-sol2-tdep.c: Use string.h, not gdb_string.h.
* i386-tdep.c: Use string.h, not gdb_string.h.
* i386bsd-tdep.c: Use string.h, not gdb_string.h.
* i386gnu-nat.c: Use string.h, not gdb_string.h.
* i386nbsd-tdep.c: Use string.h, not gdb_string.h.
* i386obsd-tdep.c: Use string.h, not gdb_string.h.
* i387-tdep.c: Use string.h, not gdb_string.h.
* ia64-libunwind-tdep.c: Use string.h, not gdb_string.h.
* ia64-linux-nat.c: Use string.h, not gdb_string.h.
* inf-child.c: Use string.h, not gdb_string.h.
* inf-ptrace.c: Use string.h, not gdb_string.h.
* inf-ttrace.c: Use string.h, not gdb_string.h.
* infcall.c: Use string.h, not gdb_string.h.
* infcmd.c: Use string.h, not gdb_string.h.
* inflow.c: Use string.h, not gdb_string.h.
* infrun.c: Use string.h, not gdb_string.h.
* interps.c: Use string.h, not gdb_string.h.
* iq2000-tdep.c: Use string.h, not gdb_string.h.
* irix5-nat.c: Use string.h, not gdb_string.h.
* jv-exp.y: Use string.h, not gdb_string.h.
* jv-lang.c: Use string.h, not gdb_string.h.
* jv-typeprint.c: Use string.h, not gdb_string.h.
* jv-valprint.c: Use string.h, not gdb_string.h.
* language.c: Use string.h, not gdb_string.h.
* linux-fork.c: Use string.h, not gdb_string.h.
* linux-nat.c: Use string.h, not gdb_string.h.
* lm32-tdep.c: Use string.h, not gdb_string.h.
* m2-exp.y: Use string.h, not gdb_string.h.
* m2-typeprint.c: Use string.h, not gdb_string.h.
* m32c-tdep.c: Use string.h, not gdb_string.h.
* m32r-linux-nat.c: Use string.h, not gdb_string.h.
* m32r-linux-tdep.c: Use string.h, not gdb_string.h.
* m32r-rom.c: Use string.h, not gdb_string.h.
* m32r-tdep.c: Use string.h, not gdb_string.h.
* m68hc11-tdep.c: Use string.h, not gdb_string.h.
* m68k-tdep.c: Use string.h, not gdb_string.h.
* m68kbsd-tdep.c: Use string.h, not gdb_string.h.
* m68klinux-nat.c: Use string.h, not gdb_string.h.
* m68klinux-tdep.c: Use string.h, not gdb_string.h.
* m88k-tdep.c: Use string.h, not gdb_string.h.
* macrocmd.c: Use string.h, not gdb_string.h.
* main.c: Use string.h, not gdb_string.h.
* mdebugread.c: Use string.h, not gdb_string.h.
* mem-break.c: Use string.h, not gdb_string.h.
* memattr.c: Use string.h, not gdb_string.h.
* memory-map.c: Use string.h, not gdb_string.h.
* mep-tdep.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-break.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-disas.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-env.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-stack.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-var.c: Use string.h, not gdb_string.h.
* mi/mi-cmds.c: Use string.h, not gdb_string.h.
* mi/mi-console.c: Use string.h, not gdb_string.h.
* mi/mi-getopt.c: Use string.h, not gdb_string.h.
* mi/mi-interp.c: Use string.h, not gdb_string.h.
* mi/mi-main.c: Use string.h, not gdb_string.h.
* mi/mi-parse.c: Use string.h, not gdb_string.h.
* microblaze-rom.c: Use string.h, not gdb_string.h.
* microblaze-tdep.c: Use string.h, not gdb_string.h.
* mingw-hdep.c: Use string.h, not gdb_string.h.
* minidebug.c: Use string.h, not gdb_string.h.
* minsyms.c: Use string.h, not gdb_string.h.
* mips-irix-tdep.c: Use string.h, not gdb_string.h.
* mips-linux-tdep.c: Use string.h, not gdb_string.h.
* mips-tdep.c: Use string.h, not gdb_string.h.
* mips64obsd-tdep.c: Use string.h, not gdb_string.h.
* mipsnbsd-tdep.c: Use string.h, not gdb_string.h.
* mipsread.c: Use string.h, not gdb_string.h.
* mn10300-linux-tdep.c: Use string.h, not gdb_string.h.
* mn10300-tdep.c: Use string.h, not gdb_string.h.
* monitor.c: Use string.h, not gdb_string.h.
* moxie-tdep.c: Use string.h, not gdb_string.h.
* mt-tdep.c: Use string.h, not gdb_string.h.
* nbsd-tdep.c: Use string.h, not gdb_string.h.
* nios2-linux-tdep.c: Use string.h, not gdb_string.h.
* nto-procfs.c: Use string.h, not gdb_string.h.
* nto-tdep.c: Use string.h, not gdb_string.h.
* objc-lang.c: Use string.h, not gdb_string.h.
* objfiles.c: Use string.h, not gdb_string.h.
* opencl-lang.c: Use string.h, not gdb_string.h.
* osabi.c: Use string.h, not gdb_string.h.
* osdata.c: Use string.h, not gdb_string.h.
* p-exp.y: Use string.h, not gdb_string.h.
* p-lang.c: Use string.h, not gdb_string.h.
* p-typeprint.c: Use string.h, not gdb_string.h.
* parse.c: Use string.h, not gdb_string.h.
* posix-hdep.c: Use string.h, not gdb_string.h.
* ppc-linux-nat.c: Use string.h, not gdb_string.h.
* ppc-sysv-tdep.c: Use string.h, not gdb_string.h.
* ppcfbsd-tdep.c: Use string.h, not gdb_string.h.
* ppcnbsd-tdep.c: Use string.h, not gdb_string.h.
* ppcobsd-tdep.c: Use string.h, not gdb_string.h.
* printcmd.c: Use string.h, not gdb_string.h.
* procfs.c: Use string.h, not gdb_string.h.
* prologue-value.c: Use string.h, not gdb_string.h.
* python/py-auto-load.c: Use string.h, not gdb_string.h.
* python/py-gdb-readline.c: Use string.h, not gdb_string.h.
* ravenscar-thread.c: Use string.h, not gdb_string.h.
* regcache.c: Use string.h, not gdb_string.h.
* registry.c: Use string.h, not gdb_string.h.
* remote-fileio.c: Use string.h, not gdb_string.h.
* remote-m32r-sdi.c: Use string.h, not gdb_string.h.
* remote-mips.c: Use string.h, not gdb_string.h.
* remote-sim.c: Use string.h, not gdb_string.h.
* remote.c: Use string.h, not gdb_string.h.
* reverse.c: Use string.h, not gdb_string.h.
* rs6000-aix-tdep.c: Use string.h, not gdb_string.h.
* ser-base.c: Use string.h, not gdb_string.h.
* ser-go32.c: Use string.h, not gdb_string.h.
* ser-mingw.c: Use string.h, not gdb_string.h.
* ser-pipe.c: Use string.h, not gdb_string.h.
* ser-tcp.c: Use string.h, not gdb_string.h.
* ser-unix.c: Use string.h, not gdb_string.h.
* serial.c: Use string.h, not gdb_string.h.
* sh-tdep.c: Use string.h, not gdb_string.h.
* sh64-tdep.c: Use string.h, not gdb_string.h.
* shnbsd-tdep.c: Use string.h, not gdb_string.h.
* skip.c: Use string.h, not gdb_string.h.
* sol-thread.c: Use string.h, not gdb_string.h.
* solib-dsbt.c: Use string.h, not gdb_string.h.
* solib-frv.c: Use string.h, not gdb_string.h.
* solib-osf.c: Use string.h, not gdb_string.h.
* solib-spu.c: Use string.h, not gdb_string.h.
* solib-target.c: Use string.h, not gdb_string.h.
* solib.c: Use string.h, not gdb_string.h.
* somread.c: Use string.h, not gdb_string.h.
* source.c: Use string.h, not gdb_string.h.
* sparc-nat.c: Use string.h, not gdb_string.h.
* sparc-sol2-tdep.c: Use string.h, not gdb_string.h.
* sparc-tdep.c: Use string.h, not gdb_string.h.
* sparc64-tdep.c: Use string.h, not gdb_string.h.
* sparc64fbsd-tdep.c: Use string.h, not gdb_string.h.
* sparc64nbsd-tdep.c: Use string.h, not gdb_string.h.
* sparcnbsd-tdep.c: Use string.h, not gdb_string.h.
* spu-linux-nat.c: Use string.h, not gdb_string.h.
* spu-multiarch.c: Use string.h, not gdb_string.h.
* spu-tdep.c: Use string.h, not gdb_string.h.
* stabsread.c: Use string.h, not gdb_string.h.
* stack.c: Use string.h, not gdb_string.h.
* std-regs.c: Use string.h, not gdb_string.h.
* symfile.c: Use string.h, not gdb_string.h.
* symmisc.c: Use string.h, not gdb_string.h.
* symtab.c: Use string.h, not gdb_string.h.
* target.c: Use string.h, not gdb_string.h.
* thread.c: Use string.h, not gdb_string.h.
* tilegx-linux-nat.c: Use string.h, not gdb_string.h.
* tilegx-tdep.c: Use string.h, not gdb_string.h.
* top.c: Use string.h, not gdb_string.h.
* tracepoint.c: Use string.h, not gdb_string.h.
* tui/tui-command.c: Use string.h, not gdb_string.h.
* tui/tui-data.c: Use string.h, not gdb_string.h.
* tui/tui-disasm.c: Use string.h, not gdb_string.h.
* tui/tui-file.c: Use string.h, not gdb_string.h.
* tui/tui-layout.c: Use string.h, not gdb_string.h.
* tui/tui-out.c: Use string.h, not gdb_string.h.
* tui/tui-regs.c: Use string.h, not gdb_string.h.
* tui/tui-source.c: Use string.h, not gdb_string.h.
* tui/tui-stack.c: Use string.h, not gdb_string.h.
* tui/tui-win.c: Use string.h, not gdb_string.h.
* tui/tui-windata.c: Use string.h, not gdb_string.h.
* tui/tui-winsource.c: Use string.h, not gdb_string.h.
* typeprint.c: Use string.h, not gdb_string.h.
* ui-file.c: Use string.h, not gdb_string.h.
* ui-out.c: Use string.h, not gdb_string.h.
* user-regs.c: Use string.h, not gdb_string.h.
* utils.c: Use string.h, not gdb_string.h.
* v850-tdep.c: Use string.h, not gdb_string.h.
* valarith.c: Use string.h, not gdb_string.h.
* valops.c: Use string.h, not gdb_string.h.
* valprint.c: Use string.h, not gdb_string.h.
* value.c: Use string.h, not gdb_string.h.
* varobj.c: Use string.h, not gdb_string.h.
* vax-tdep.c: Use string.h, not gdb_string.h.
* vaxnbsd-tdep.c: Use string.h, not gdb_string.h.
* vaxobsd-tdep.c: Use string.h, not gdb_string.h.
* windows-nat.c: Use string.h, not gdb_string.h.
* xcoffread.c: Use string.h, not gdb_string.h.
* xml-support.c: Use string.h, not gdb_string.h.
* xstormy16-tdep.c: Use string.h, not gdb_string.h.
* xtensa-linux-nat.c: Use string.h, not gdb_string.h.
* dwarf2read.c (read_index_from_section): Update comment.
(struct dw2_symtab_iterator): New member global_seen.
(dw2_symtab_iter_init): Initialize it.
(dw2_symtab_iter_next): Skip duplicate global symbols.
(dw2_expand_symtabs_matching): Ditto.
* dwarf2read.c (dwarf2_read_debug): Change to unsigned int.
(create_debug_types_hash_table): Only print debugging messages for
each TU if dwarf2-read >= 2.
(process_queue): Ditto.
(_initialize_dwarf2_read): Make "set debug dwarf2-read" a zuinteger.
Update doc string.
doc/
* gdb.texinfo (Debugging Output): Update text for
"set debug dwarf2-read".
When reading objects with corrupt debug information it is possible that
the sibling chain can form a loop, which leads to an infinite loop and
memory exhaustion.
Avoid this situation by disregarding and DW_AT_sibling values that point
to a lower address than the current entry.
gdb/ChangeLog:
2013-11-06 Will Newton <will.newton@linaro.org>
PR gdb/12866
* dwarf2read.c (skip_one_die): Sanity check DW_AT_sibling
values. (read_partial_die): Likewise.
The first one, dw2_get_real_path from gdb/dwarf2read.c, was actually
making use of OBSTACK_CALLOC which already calls "sizeof" for its third
argument.
The second, download_tracepoint_1 from gdb/gdbserver/tracepoint.c, was
explicitly calling "sizeof" inside another "sizeof".
This patch fixed both functions.
gdb/ChangeLog
2013-10-16 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/16014
* dwarf2read.c (dw2_get_real_path): Remove unnecessary call to
sizeof.
gdb/gdbserver/ChangeLog
2013-10-16 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/16014
* tracepoint.c (download_tracepoint_1): Remove unnecessary double
call to sizeof.
* bfd-in2.h: Rebuild.
* opncls.c (bfd_get_alt_debug_link_info): Change type of
buildid_len to bfd_size_type.
gdb
* dwarf2read.c (dwarf2_get_dwz_file): Update for type change in
bfd_get_alt_debug_link_info.
This patch fixes gdb PR symtab/15597.
The bug is that the .gnu_debugaltlink section includes the build-id of
the alt file, but gdb does not use it.
This patch fixes the problem by changing gdb to do what it ought to
always have done: verify the build id of the file found using the
filename in .gnu_debugaltlink; and if that does not match, try to find
the correct debug file using the build-id and debug-file-directory.
This patch touches BFD. Previously, gdb had its own code for parsing
.gnu_debugaltlink; I changed it to use the BFD functions after those
were introduced. However, the BFD functions are incorrect -- they
assume that .gnu_debugaltlink is formatted like .gnu_debuglink.
However, it it is not. Instead, it consists of a file name followed
by the build-id -- no alignment, and the build-id is not a CRC.
Fixing this properly is a bit of a pain. But, because
separate_alt_debug_file_exists just has a FIXME for the build-id case,
I did not fix it properly. Instead I introduced a hack. This leaves
BFD working just as well as it did before my patch.
I'm willing to do something better here but I could use some guidance
as to what. It seems that the build-id code in BFD is largely punted
on.
FWIW gdb is the only user of bfd_get_alt_debug_link_info outside of
BFD itself.
I moved the build-id logic out of elfread.c and into a new file.
This seemed cleanest to me.
Writing a test case was a bit of a pain. I added a couple new
features to the DWARF assembler to handle this.
Built and regtested on x86-64 Fedora 18.
* bfd-in2.h: Rebuild.
* opncls.c (bfd_get_alt_debug_link_info): Add buildid_len
parameter. Change type of buildid_out. Update.
(get_alt_debug_link_info_shim): New function.
(bfd_follow_gnu_debuglink): Use it.
* Makefile.in (SFILES): Add build-id.c.
(HFILES_NO_SRCDIR): Add build-id.h.
* build-id.c: New file, largely from elfread.c. Modified
most functions.
* build-id.h: New file.
* dwarf2read.c (dwarf2_get_dwz_file): Update for change to
bfd_get_alt_debug_link_info. Verify dwz file's build-id.
Search for dwz file using build-id.
* elfread.c (build_id_bfd_get, build_id_verify)
(build_id_to_debug_filename, find_separate_debug_file): Remove.
* gdb.dwarf2/dwzbuildid.exp: New file.
* lib/dwarf.exp (Dwarf::_section): Add "flags" and "type"
parameters.
(Dwarf::_defer_output): Change "section" parameter to
"section_spec"; update.
(Dwarf::gnu_debugaltlink, Dwarf::_note, Dwarf::build_id): New
procs.
* NEWS: Mention support for DWP file format version 2.
* dwarf2read.c (dwarf2_section_info): Convert asection field to a
union of asection, containing_section. New fields virtual_offset
and is_virtual. Change type of readin filed from int to char.
(dwo_sections, dwo_file): Tweak comments.
(dwp_v2_section_ids): New enum.
(dwp_sections): New fields abbrev, info, line, loc, macinfo, macro,
str_offsets, types.
(virtual_v1_dwo_sections): Renamed from virtual_dwo_sections.
All uses updated.
(virtual_v2_dwo_sections): New struct.
(dwp_hash_table): New fields version, nr_columns. Change type of
section_pool field to a union.
(dwp_file): New field version.
(dwarf2_has_info): Check for virtual sections.
(get_containing_section): New function.
(get_section_bfd_owner, get_section_bfd_section): Call it.
(dwarf2_locate_sections): Update.
(dwarf2_section_empty_p): Update.
(dwarf2_read_section): Handle virtual sections.
(locate_dwz_sections): Update.
(create_dwp_hash_table): Document and handle V2 format.
(locate_v1_virtual_dwo_sections): Renamed from
locate_virtual_dwo_sections and update. All callers updated.
(create_dwo_unit_in_dwp_v1): Renamed from create_dwo_in_dwp.
Delete arg htab. Rename arg section_index to unit_index.
All callers updated.
(MAX_NR_V1_DWO_SECTIONS): Renamed from MAX_NR_DWO_SECTIONS.
All uses updated.
(create_dwp_v2_section, create_dwo_unit_in_dwp_v2): New functions.
(lookup_dwo_unit_in_dwp): Add V2 support.
(dwarf2_locate_dwo_sections): Update.
(dwarf2_locate_common_dwp_sections): Renamed from
dwarf2_locate_dwp_sections and update. All callers updated.
(dwarf2_locate_v2_dwp_sections): New function.
(open_and_init_dwp_file): Add V2 support.
(read_str_index): New locals str_section, str_offsets_section.
(dwp_file): Split loaded_cutus into loaded_cus, loaded_tus.
All uses updated.
(dwarf2_section_empty_p): Rename arg from "info" to "section".
(dwarf2_read_section): Delete unused local "header". Add section
name to error message.
(create_dwo_in_dwp): Tweak comment.
(MAX_NR_DWO_SECTIONS): Combine count of .debug_macro + .debug_macinfo.
(get_section_bfd_owner, get_section_bfd_section): New functions.
(get_section_name, get_section_file_name): New functions.
(get_section_id, get_section_flags): New functions.
(*): Use new functions to access section fields.
(lookup_dwo_unit_in_dwp): Renamed from lookup_dwo_in_dwp. Remove
arg "htab". All callers updated.
(create_debug_types_hash_table): Remove redundant copy of
abbrev_section.
(create_dwo_in_dwp): Tweak comments.
(read_str_index): Tweak comment. Record dwarf form name in static
local.
gdb/
2013-09-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (open_and_init_dwp_file): Try open_dwp_file also with
objfile->original_name.
gdb/testsuite/
2013-09-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dwp-symlink.c: New file.
* gdb.dwarf2/dwp-symlink.exp: New file.
(queue_and_load_dwo_tu): New function.
(lookup_dwo_signatured_type): Set per_cu.tu_read.
(maybe_queue_comp_unit): Rename this_cu argument to dependent_cu.
Make dependent_cu optional.
(dw2_do_instantiate_symtab): If we just loaded a CU from a DWO,
and an older .gdb_index is in use, queue and load all its TUs too.
testsuite/
* gdb.base/enumval.c (ZERO): New enum value.
(main): Use it
* gdb.base/enumval.exp: Test ability to print ZERO.
gdb/
2013-09-04 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup: Change OPF_DISABLE_REALPATH to OPF_RETURN_REALPATH.
* cli/cli-cmds.c (find_and_open_script): Add OPF_RETURN_REALPATH to
variable search_flags.
* defs.h (OPF_DISABLE_REALPATH): Rename to ...
(OPF_RETURN_REALPATH): ... here.
* dwarf2read.c (try_open_dwop_file): Set OPF_RETURN_REALPATH for flags.
* exec.c (exec_file_attach): Remove OPF_DISABLE_REALPATH from openp
call. Twice.
* nto-tdep.c (nto_find_and_open_solib): Add OPF_RETURN_REALPATH for
openp call.
* solib.c (solib_find): Likewise. Four times.
* source.c (openp): Change OPF_DISABLE_REALPATH to OPF_RETURN_REALPATH
in the function comment and for the realpath_fptr variable.
(source_full_path_of): Add OPF_RETURN_REALPATH for openp call.
(find_and_open_source): Likewise. Twice.
* symfile.c (symfile_bfd_open): Likewise, also twice.
(pending_macros): Ditto.
(get_macro_table): New function.
(buildsym_init): Initialize subfile_stack.
* coffread.c (type_vector,type_vector_length): Moved here from
buildsym.h.
(INITIAL_TYPE_VECTOR_LENGTH): Ditto.
(coff_symtab_read): Use it.
* dbxread.c (read_ofile_symtab): Delete init of subfile_stack.
* dwarf2read.c (macro_start_file): Replace uses of pending_macros
with call to get_macro_table.
* stabsread.c (type_vector,type_vector_length): Moved here from
buildsym.h.
(INITIAL_TYPE_VECTOR_LENGTH): Ditto.
* buildsym.h (get_macro_table): Declare.
This fixes some derivation.exp regressions with "dwz -m".
The bug here is that the imported PU is given language_minimal.
However, it ought to be C++.
The "pretend language" machinery exists to solve this problem, but it
wasn't handled in process_psymtab_comp_unit. So, this patch adds it
there.
Built and regtested, both normally and using "dwz -m", on x86-64
Fedora 18.
PR symtab/15028:
* dwarf2read.c (struct process_psymtab_comp_unit_data): New.
(process_psymtab_comp_unit_reader): Use it.
(process_psymtab_comp_unit): Update. Add "pretend_language"
argument.
(dwarf2_build_psymtabs_hard): Update.
(scan_partial_symbols): Pass CU's language to
process_psymtab_comp_unit.
After the previous patch in the series, nothing uses the "quick"
method find_symbol_file.
This patch removes it.
Tested by rebuilding.
* dwarf2read.c (dw2_get_primary_filename_reader): Remove.
(dwarf2_gdb_index_functions): Update.
* psymtab.c (find_symbol_file_from_partial): Remove.
(psym_functions): Update.
* symfile.h (struct quick_symbol_functions) <find_symbol_file>:
Remove.
Doug pointed out a while ago that in the final dwz -m patch, nothing
ever set symtab::user.
This patch fixes this oversight and adds a test case showing why it is
important.
Built and regtested (both ways) on x86-64 Fedora 18.
The new test unconditionally tests the partial unit machinery, which I
think is an added plus.
* dwarf2read.c (recursively_compute_inclusions): Add
"immediate_parent" argument. Set symtab's "user" field
if not set.
(compute_symtab_includes): Update.
* gdb.dwarf2/dwz.exp: New file.
* dwarf2read.c (struct dwarf2_per_cu_data): New member tu_read.
(fill_in_sig_entry_from_dwo_entry): Reorganize asserts.
Add assert of sig_entry->dwo_unit == NULL.
(lookup_dwo_signatured_type): Don't assign TU to a DWO if the TU
had already been read.
(read_signatured_type): Set per_cu.tu_read.
testsuite/
* gdb.dwarf2/fission-mix.exp: New file.
* gdb.dwarf2/fission-mix.h: New file.
* gdb.dwarf2/fission-mix.c: New file.
* gdb.dwarf2/fission-mix2.c: New file.
* dwarf2read.c (recursively_compute_inclusions): Change type of result
parameter to VEC (symtab_ptr) **. New parameter all_type_symtabs.
Watch for duplicate symtabs coming from type units.
(compute_symtab_includes): Update call to
recursively_compute_inclusions. Build vector of included symtabs
instead of per_cus.
* symtab.h (symtab_ptr): New typedef.
(DEF_VEC_P (symtab_ptr)): New VEC type.
* linespec.c (symtab_p): Delete. All uses updated to use symtab_ptr
instead.
init_cutu_and_read_dies creates an outer cleanup and uses its
immediately nested inner cleanup conditionally. This seems overly
complicated to me; simpler is to just deal with the outer cleanup and
drop the inner one. That is what this patch implements.
* dwarf2read.c (init_cutu_and_read_dies): Remove 'free_cu_cleanup'.
Simplify cleanup handling.
dwarf_decode_line_header has one return that is missing a call to
do_cleanups. This patch adds it.
This was found using the cleanup checker.
* dwarf2read.c (dwarf_decode_line_header): Call do_cleanups
on all return paths.
BFD recently got a few functions related to "dwz" files. This patch
changes gdb to use them, just to share a bit more code.
This changes dwarf2_get_dwz_file to possibly return NULL. This
simplified a bit of code elsewhere.
Built and regtested on x86-64 Fedora 18. I specifically regtested it
using my pending dwz test case.
* dwarf2read.c (dwarf2_get_dwz_file): Return NULL if
.gnu_debugaltlink not found. Use bfd_get_alt_debug_link_info.
(dwarf2_read_index, create_all_comp_units): Update.
* dwarf2read.c (try_open_dwop_file): New arg search_cwd.
All callers updated.
(open_dwp_file): If we can't find the dwp file, search the basename
in debug-file-directory.
before using it.
(dw2_expand_symtabs_matching): Fix symbol kind validity check.
Move test of cu_index closer to use. Print complaint if cu_index
is bad.
This patch fixes a case of multiple calls freeing the same data
while free-ing objfiles that have child objfiles (separate debug
info, as is the case on Darwin targets).
Following the code, free_objfile_separate_debug iterates over
all child objfiles of the parent objfile, calling free_objfile:
for (child = objfile->separate_debug_objfile; child;)
{
struct objfile *next_child = child->separate_debug_objfile_link;
free_objfile (child);
child = next_child;
}
This causes, among other things, the free'ing of the child objfile's
private data:
/* Discard any data modules have associated with the objfile. The function
still may reference objfile->obfd. */
objfile_free_data (objfile);
This indirectly calls(back) dwarf2_per_objfile_free, which tries
to free the dwarf2read-specific data by using the dwarf2_per_objfile
global, eg:
for (ix = 0; ix < dwarf2_per_objfile->n_comp_units; ++ix)
Even if we were lucky enough the first time around that this global
actually corresponds to the objfile being destroyed, the global
will still have the same value at the second iteration, and thus
become dangling. Indeed, after dwarf2_per_objfile_free returns
eventually back to free_objfile, free_objfile then deallocates
its objfile_obstack, where the dwarf2_per_objfile is allocated.
Ironically, there should be no need to access that global at all,
here, since the data is passed as an argument of the callback.
And it looks like the dwo/dwp/[...]-handling code is in fact already
using that argument, rather than the global.
This patch thus fixes the problem by doing the same, replacing
all references to DWARF2_PER_OBJFILE by uses of DATA instead.
gdb/ChangeLog:
* dwarf2read.c (dwarf2_per_objfile): Replace uses of
DWARF2_PER_OBJFILE by uses of DATA instead.
Building gdb on GNU/Linux, for --host=i586-pc-msdosdjgpp, I get:
../../src/gdb/dwarf2read.c: In function 'create_dwp_hash_table':
../../src/gdb/dwarf2read.c:8626:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
../../src/gdb/dwarf2read.c:8632:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
../../src/gdb/dwarf2read.c: In function 'create_dwo_in_dwp':
../../src/gdb/dwarf2read.c:8754:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' [-Werror=format]
../../src/gdb/dwarf2read.c: In function 'open_and_init_dwp_file':
../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Werror=format]
../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Werror=format]
And:
$ grep uint32_t /usr/i586-pc-msdosdjgpp/sys-include/*
/usr/i586-pc-msdosdjgpp/sys-include/stdint.h:typedef unsigned long uint32_t;
As decided on the discussion at
<http://sourceware.org/ml/gdb-patches/2013-05/msg00788.html>, use
pulongest rather than PRIu32.
Tested on F17. Also confirmed GDB still builds OK with
--host=i686-w64-mingw32.
gdb/
2013-05-23 Pedro Alves <palves@redhat.com>
* dwarf2read.c (create_dwp_hash_table, create_dwo_in_dwp)
(open_and_init_dwp_file): Use %s/pulongest instead of %u for
printing uint32_t variables.
For Fission.
* dwarf2read.c (struct dwarf2_per_cu_data): New member
reading_dwo_directly.
(struct signatured_type): New member dwo_unit.
(struct die_reader_specs): New member comp_dir.
(create_signatured_type_table_from_index): Use malloc for
all_type_units instead of objfile's obstack.
(create_all_type_units): Ditto.
(fill_in_sig_entry_from_dwo_entry): New function.
(add_type_unit): New function.
(lookup_dwo_signatured_type): New function.
(lookup_dwp_signatured_type): New function.
(lookup_signatured_type): New arg cu. All callers updated.
(init_cu_die_reader): Initialize comp_dir.
(read_cutu_die_from_dwo): New arg stub_comp_dir. All callers updated.
Change assert of matching type signatures to call error on mismatch.
(lookup_dwo_unit): Add assert.
(init_tu_and_read_dwo_dies): New function.
(init_cutu_and_read_dies): Call it.
(build_type_unit_groups): Handle case of no type unit groups created.
(hash_dwo_file, eq_dwo_file): Handle missing comp_dir.
(lookup_dwo_cutu): Tweak complaint.
(dwarf2_free_abbrev_table): Check for NULL abbrev_table.
(dwarf2_per_objfile_free): Free all_type_units.
This makes sure that the types of the arguments are taken into account
when performing an inferior function call to a non-C (or C-like)
function. In particular, this makes sure that the arguments are
appropriatly converted to the correct type.
For instance, on x86_64-linux, with the following Ada code:
procedure Set_Float (F : Float) is
begin
Global_Float := F;
end Set_Float;
The following sequence shows that Float arguments are incorrectly
passed (Ada's Float type is the equivalent of type "float" in C):
(gdb) call set_float (2.0)
(gdb) print global_float
$1 = 0.0
Putting a breakpoint inside set_float to inspect the value of
register xmm0 gives the first hint of the problem:
(gdb) p $xmm0
$2 = (v4_float => (0 => 0.0, 2.0, 0.0, 0.0),
v2_double => (0 => 2.0, 0.0),
[...]
It shows that the argument was passed as a double.
The code responsible for doing appropriate type conversions
for the arguments (value_arg_coerce) found that our function
was not prototyped, and thus could not use typing information
for the arguments. Instead, it defaulted to the value of "set
coerce-float-to-double", which by default is true, to determine
the argument type.
This patch fixes the problem by setting the PROTOTYPE flag
for all functions of any language except C and Objective C.
gdb/ChangeLog:
* dwarf2read.c (prototyped_function_p): New function.
(read_subroutine_type): Use it.
gdb/testsuite/ChangeLog:
* gdb.ada/float_param: New testcase.
(init_cutu_and_read_dies): Flag a complaint, not error, for bad
DWO stub. If DWO isn't found, just use stub.
(lookup_dwo_cutu): Don't try DWO if there's a DWP file.
This fixes the remaining issues necessary to make the DWARF reader
-Wpointer-sign clean. The 'filename' bit should be obvious.
'constant_pool' holds the contents of an obstack, which are 'char *'.
gdb_byte would work too, but it'd need more casts elsewhere, so I just
chose the minimal approach. Any way would be fine with me.
gdb/
2013-04-19 Pedro Alves <palves@redhat.com>
* dwarf2read.c (dwarf2_get_dwz_file): Add cast to const char *.
(read_index_from_section): Add cast to 'char *'.
-Wpointer-sign catches all these cases across the codebase that should
be using gdb_byte for raw target bytes. I think these are all
obvious, hence I've collapsed into a single patch.
gdb/
2013-04-19 Pedro Alves <palves@redhat.com>
* aarch64-tdep.c (aarch64_default_breakpoint): Change type to
gdb_byte[].
(aarch64_breakpoint_from_pc): Change return type to gdb_byte *.
* ada-lang.c (ada_value_assign): Use gdb_byte.
* alphanbsd-tdep.c (sigtramp_retcode): Change type to gdb_byte[].
(alphanbsd_sigtramp_offset): Use gdb_byte.
* arm-linux-tdep.c (arm_linux_arm_le_breakpoint)
(arm_linux_arm_be_breakpoint, eabi_linux_arm_le_breakpoint)
(eabi_linux_arm_be_breakpoint, arm_linux_thumb_be_breakpoint)
(arm_linux_thumb_le_breakpoint, arm_linux_thumb2_be_breakpoint)
(arm_linux_thumb2_le_breakpoint): Change type to gdb_byte[].
* arm-tdep.c (arm_stub_unwind_sniffer)
(arm_displaced_init_closure): Use gdb_byte.
(arm_default_arm_le_breakpoint, arm_default_arm_be_breakpoint)
(arm_default_thumb_le_breakpoint)
(arm_default_thumb_be_breakpoint): Change type to gdb_byte[].
* arm-tdep.h (struct gdbarch_tdep) <arm_breakpoint,
thumb_breakpoint, thumb2_breakpoint>: Change type to gdb_byte *.
* arm-wince-tdep.c (arm_wince_le_breakpoint)
(arm_wince_thumb_le_breakpoint): Change type to gdb_byte[].
* armnbsd-tdep.c (arm_nbsd_arm_le_breakpoint)
(arm_nbsd_arm_be_breakpoint, arm_nbsd_thumb_le_breakpoint)
(arm_nbsd_thumb_be_breakpoint): Change type to gdb_byte[].
* armobsd-tdep.c (arm_obsd_thumb_le_breakpoint)
(arm_obsd_thumb_be_breakpoint): Change type to gdb_byte[].
* cris-tdep.c (push_stack_item, cris_push_dummy_call)
(cris_store_return_value, cris_extract_return_value): Use
gdb_byte.
(constraint): Change type of parameter to char * from signed
char*. Use gdb_byte.
* dwarf2loc.c (read_pieced_value, write_pieced_value): Change type
of local buffer to gdb_byte *.
* dwarf2read.c (read_index_from_section): Use gdb_byte.
(create_dwp_hash_table): Change type of locals to gdb_byte *.
(add_address_entry): Change type of local buffer to gdb_byte[].
* frv-tdep.c (frv_adjust_breakpoint_address, find_func_descr)
(frv_push_dummy_call): Use gdb_byte.
* hppa-hpux-tdep.c (hppa_hpux_push_dummy_code)
(hppa_hpux_supply_ss_fpblock, hppa_hpux_supply_ss_wide)
(hppa_hpux_supply_save_state): Use gdb_byte.
* hppa-tdep.c (hppa32_push_dummy_call)
(hppa64_convert_code_addr_to_fptr): Use gdb_byte.
* ia64-tdep.c (extract_bit_field, replace_bit_field)
(slotN_contents, replace_slotN_contents): Change type of parameter
to gdb_byte *.
(fetch_instruction, ia64_pseudo_register_write)
(ia64_register_to_value, ia64_value_to_register)
(ia64_extract_return_value, ia64_store_return_value)
(ia64_push_dummy_call): Use gdb_byte.
* m32c-tdep.c (m32c_return_value): Remove cast.
* m68hc11-tdep.c (m68hc11_pseudo_register_write)
(m68hc11_push_dummy_call, m68hc11_store_return_value): Use
gdb_byte.
* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Use gdb_byte.
* mn10300-tdep.c (mn10300_store_return_value)
(mn10300_breakpoint_from_pc, mn10300_push_dummy_call): Use
gdb_byte.
* moxie-tdep.c (moxie_process_readu): Use gdb_byte.
(moxie_process_record): Remove casts.
* ppc-ravenscar-thread.c (supply_register_at_address)
(ppc_ravenscar_generic_store_registers): Use gdb_byte.
* ravenscar-thread.c (get_running_thread_id): Use gdb_byte.
* remote-m32r-sdi.c (m32r_fetch_register): Use gdb_byte.
* remote-mips.c (mips_xfer_memory): Use gdb_byte.
* remote.c (compare_sections_command): Use gdb_byte.
* score-tdep.c (score7_free_memblock): Change type of parameter to
gdb_byte *.
* sh-tdep.c (sh_justify_value_in_reg): Change return type to
gdb_byte *. Use gdb_byte.
(sh_push_dummy_call_fpu): Use gdb_byte.
(sh_extract_return_value_nofpu, sh_extract_return_value_fpu)
(sh_store_return_value_nofpu, sh_store_return_value_fpu)
(sh_register_convert_to_virtual, sh_register_convert_to_raw):
Change parameter type to 'gdb_byte *'. Use gdb_byte.
(sh_pseudo_register_read, sh_pseudo_register_write): Use gdb_byte.
* sh64-tdep.c (sh64_push_dummy_call): Use gdb_byte.
(sh64_store_return_value, sh64_register_convert_to_virtual):
Change parameter type to 'gdb_byte *'. Use gdb_byte.
(sh64_pseudo_register_write): Use gdb_byte.
* solib-darwin.c (darwin_current_sos): Add casts to 'gdb_byte *'.
* solib-irix.c (fetch_lm_info): Likewise. Use gdb_byte for byte
buffer.
(irix_current_sos): Use gdb_byte.
* solib-som.c (som_current_sos): Use gdb_byte.
* sparc-ravenscar-thread.c (supply_register_at_address)
(sparc_ravenscar_generic_store_registers): Use gdb_byte.
* spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'.
* spu-tdep.c (spu_get_overlay_table): Use gdb_byte.
* tic6x-tdep.c (tic6x_breakpoint_from_pc): Change return type to
'gdb_byte *'.
* tic6x-tdep.h (struct gdbarch_tdep) <breakpoint>: Change type to
'gdb_byte *'.
* tracepoint.c (tfile_fetch_registers): Use gdb_byte.
* xstormy16-tdep.c (xstormy16_extract_return_value)
(xstormy16_store_return_value): Change parameter type to
'gdb_byte *'. Adjust.
(xstormy16_push_dummy_call): Use gdb_byte.
* xtensa-tdep.c (xtensa_scan_prologue, call0_ret)
(call0_analyze_prologue, execute_code): Use gdb_byte.
(struct attribute): Replace member signatured_type with signature.
(DW_SIGNATURE): Replaces DW_SIGNATURE_TYPE.
(read_call_site_scope): Call follow_die_ref instead of
follow_die_ref_or_sig.
(read_structure_type): Rewrite handling of signatured types.
(read_enumeration_type): Ditto.
(read_attribute_value): Update.
(build_error_marker_type): New function.
(lookup_die_type): Add assert. Rewrite handling of signatured types.
Don't call error for bad types, just build an error marker type.
(dump_die_shallow): Update.
(follow_die_sig_1): Renamed from follow_die_sig.
Don't call error for bad types, instead return NULL.
(follow_die_sig): New function.
(get_signatured_type, get_DW_AT_signature_type): New functions.
(struct create_dwo_cu_data): Renamed from create_dwo_info_table_data.
(create_dwo_cu_reader): Renamed from
create_dwo_debug_info_hash_table_reader.
(create_dwo_cu): Renamed from create_dwo_debug_info_hash_table.
Remove support for multiple CUs in a DWO file.
(open_and_init_dwo_file, lookup_dwo_cutu): Update.
* c-lang.c (cplus_language_defn): Use gdb_demangle.
* c-typeprint.c (c_type_print_base): Use gdb_demangle.
* cp-support.c (mangled_name_to_comp): Use gdb_demangle.
(gdb_demangle): New function.
* cp-support.h (gdb_demangle): Declare.
* dwarf2read.c (dwarf2_physname, fixup_partial_die)
(dwarf2_name): Use gdb_demangle.
* gdbtypes.c (check_stub_method): Use gdb_demangle.
* gnu-v3-abi.c (gnuv3_rtti_type): Strip @plt and version
suffixes from name.
(gnuv3_print_method_ptr): Use gdb_demangle.
* jv-lang.c (java_demangle): Use gdb_demangle.
* jv-typeprint.c (java_type_print_base): Use gdb_demangle.
* language.c (unk_lang_demangle): Use gdb_demangle.
* symtab.c (symbol_find_demangled_name)
(demangle_for_lookup): Use gdb_demangle.
const.
* dwarf2read.c (struct dwarf2_section_info) <buffer>: Now const.
(struct die_reader_specs) <buffer>: Likewise.
(die_reader_func_ftype): Make 'info_ptr' const.
(struct line_header) <include_dirs, statement_program_start,
statement_program_end>: Now const.
(struct file_entry) <name>: Likewise.
(struct partial_die_info) <sibling>: Likewise.
(struct dwarf_block) <data>: Likewise.
(dwarf2_read_section): Remove cast.
(dwarf2_get_section_info): Make 'bufp' const.
(read_index_from_section): Constify.
(dw2_get_file_names_reader): Make 'info_ptr' const.
(dw2_get_primary_filename_reader): Likewise.
(read_comp_unit_head): Make 'info_ptr' and return type const.
(read_and_check_comp_unit_head, read_and_check_type_unit_head):
Likewise.
(read_abbrev_offset): Constify.
(dwarf2_create_include_psymtab): Make 'name' const.
(create_debug_types_hash_table): Update.
(read_cutu_die_from_dwo): Make 'result_info_ptr' const.
(init_cutu_and_read_dies, init_cutu_and_read_dies_no_follow):
Constify.
(process_psymtab_comp_unit_reader, build_type_psymtabs_reader)
(load_partial_comp_unit_reader): Make 'info_ptr' const.
(read_comp_units_from_section): Constify.
(peek_abbrev_code, peek_die_abbrev, skip_children, skip_one_die)
(locate_pdi_sibling, load_full_comp_unit_reader): Make 'info_ptr'
const.
(dwarf2_compute_name, setup_type_unit_groups): Constify.
(create_dwo_debug_info_hash_table): Make 'info_ptr' const.
(create_dwp_hash_table, dwarf2_ranges_read)
(dwarf2_record_block_ranges): Constify.
(read_die_and_children, read_die_and_siblings_1)
(read_die_and_siblings): Make 'info_ptr' and 'new_info_ptr'
const.
(read_full_die_1, read_full_die): Make 'info_ptr' const.
(abbrev_table_read_table): Constify.
(load_partial_dies): Make 'info_ptr' const.
(read_partial_die, read_attribute_value, read_attribute): Make
'info_ptr' and return type const.
(read_address, read_initial_length)
(read_checked_initial_length_and_offset, read_offset)
(read_offset_1, read_n_bytes, read_direct_string): Make 'buf'
const.
(read_direct_string): Make 'buf' and return type const.
(read_indirect_string_at_offset, read_indirect_string_from_dwz)
(read_indirect_string): Make return type const.
(read_unsigned_leb128, read_signed_leb128): Make 'buf' const.
(read_addr_index_from_leb128, dwarf2_read_addr_index_reader): Make
'info_ptr' const.
(read_str_index): Make return type const.
(add_include_dir): Make 'include_dir' const.
(add_file_name): Make 'name' const.
(dwarf_decode_line_header): Constify.
(psymtab_include_file_name): Make return type const.
(dwarf_decode_lines_1, dwarf_decode_lines): Constify.
(dwarf2_start_subfile): Make 'filename' const.
(dwarf2_const_value_attr): Make 'bytes' const.
(read_signatured_type_reader): Make 'info_ptr' const.
(decode_locdesc): Constify.
(skip_form_bytes): Make 'bytes', 'buffer_end', and return type
const.
(skip_unknown_opcode): Make 'opcode_definitions', 'mac_ptr',
'mac_end', and return type const.
(dwarf_parse_macro_header): Make 'mac_ptr' and return type const.
(dwarf_decode_macro_bytes): Make 'mac_ptr', 'mac_end', and return
type const.
(per_cu_header_read_in): Constify.
* symfile.h (dwarf2_get_section_info): Update.
read_die_and_siblings.
(read_die_and_siblings): New function.
(read_cutu_die_from_dwo): Dump die if requested.
(read_die_and_children): Call read_full_die_1 and
read_die_and_siblings_1.
(read_full_die): Dump die if requested.
* dwarf2read.c (read_comp_units_from_section): Add debugging printf.
Rename member name to dwo_name. All uses updated.
(hash_dwo_file): Include comp_dir in computation.
(eq_dwo_file): Ditto.
(lookup_dwo_file_slot): New arg comp_dir. All callers updated.
(create_dwo_in_dwp, lookup_dwo_in_dwp, open_and_init_dwo_file): Ditto.
type_unit_group ...
(struct signatured_type): ... to here.
(sig_type_ptr): New typedef.
(type_unit_group): Delete member 't.first_cu'. Move member 'tus'
out of union 't'. All uses updated.
(dw2_get_file_names_reader): Assert not called for a type unit.
(dw2_get_file_names): Assert not called for a type unit or type
unit group.
(build_type_psymtabs_reader): Assert called for a type unit.
(build_type_psymtab_dependencies): Assert called for a type unit group.
Delete arg is_dwp. All callers updated.
(open_dwp_file): New function.
(open_and_init_dwp_file): Call it.
(get_dwp_file): New function.
(lookup_dwo_cutu): Call it.
(compute_symtab_includes): Remove unnecessary forward declaration.
(die_needs_namespace): Add comment marking group of functions for
dwarf2 name computation.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Put continue after
any successful compare_filenames_for_search or FILENAME_CMP.
* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
* symtab.c (iterate_over_some_symtabs): Likewise.
Fix entry-values in C++ across CUs.
* dwarf2loc.c (call_site_to_target_addr) <FIELD_LOC_KIND_PHYSNAME>: Use
lookup_minimal_symbol. Add a comment.
* dwarf2read.c
(read_call_site_scope) <is_ref_attr> <die_is_declaration>: Prefer
DW_AT_linkage_name.
gdb/testsuite/
Fix entry-values in C++ across CUs.
* gdb.arch/amd64-tailcall-cxx.exp: New file.
* gdb.arch/amd64-tailcall-cxx1.S: New file.
* gdb.arch/amd64-tailcall-cxx1.cc: New file.
* gdb.arch/amd64-tailcall-cxx2.S: New file.
* gdb.arch/amd64-tailcall-cxx2.cc: New file.
* dwarf2read.c (file_file_name): New function with code from
file_full_name.
(file_full_name): Move most of the code to file_file_name.
(macro_start_file): Rename variable full_name to file_name and use
file_file_name for it. Add comp_dir parameter to new_macro_table.
* macrocmd.c (show_pp_source_pos): New variable fullname. Replace any
macro_source_file->filename access by macro_source_fullname call.
* macroscope.c (_initialize_macroscope): Update the new_macro_table
caller.
* macrotab.c (struct macro_table): New field comp_dir.
(macro_include): New variables link_fullname and source_fullname.
Replace any macro_source_file->filename access by macro_source_fullname
call.
(macro_lookup_inclusion): Remove the partial filenames checking code.
(check_for_redefinition): New variables source_fullname and
found_key_fullname. Replace any macro_source_file->filename access by
macro_source_fullname call.
(macro_undef): New variables source_fullname and key_fullname. Replace
any macro_source_file->filename access by macro_source_fullname call.
(macro_lookup_definition): New variables retval and source_fullname.
Replace any macro_source_file->filename access by macro_source_fullname
call.
(foreach_macro): New variable key_fullname. Replace any
macro_source_file->filename access by macro_source_fullname call.
(foreach_macro_in_scope): New variable datum_fullname. Replace any
macro_source_file->filename access by macro_source_fullname call.
(new_macro_table): Add parameter comp_dir. Initialize T with it.
(macro_source_fullname): New function.
* macrotab.h (struct macro_source_file): Extent the filename field
comment.
(new_macro_table): New parameter comp_dir, add a comment for it.
(macro_source_fullname): new declaration.
gdb/testsuite/
* gdb.linespec/base/one/header.h: New file.
* gdb.linespec/base/two/header.h: New file.
* gdb.linespec/macro-relative.c: New file.
* gdb.linespec/macro-relative.exp: New file.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Move variable
this_real_name to outer block. Use it also for
compare_filenames_for_search.
(dw2_expand_symtabs_matching): New variable this_real_name. Use it
with dw2_get_real_path for file_matcher, considering also
BASENAMES_MAY_DIFFER.
(file_full_name): Prepend COMP_DIR even for relative lh->INCLUDE_DIRS.
* dwarf2read.c (dw2_expand_symtabs_matching): Add basenames parameter
to the file_matcher parameter. Pass 0 to it.
(dwarf2_create_include_psymtab): Copy also DIRNAME.
* psymtab.c (partial_map_symtabs_matching_filename): Drop handling of
NULL psymtab_to_fullname result.
(psymtab_to_fullname): Remove variable r. Never return NULL, assemble
an expected filename instead.
(expand_symtabs_matching_via_partial): Add basenames parameter to the
file_matcher parameter. Call also psymtab_to_fullname, after newly
considering BASENAMES_MAY_DIFFER.
* source.c (rewrite_source_path): Remove static.
* source.h (rewrite_source_path): New declaration.
* symfile.h (struct quick_symbol_functions): Add basenames parameter to
the expand_symtabs_matching field. Comment it.
* symtab.c (file_matches): New function comment. Add parameter
basenames, implement it.
(search_symbols_file_matches): Add basenames parameter. Update the
file_matches caller.
(search_symbols): Match FILES also against symtab_to_fullname.
Optimize it for BASENAMES_MAY_DIFFER.
gdb/testsuite/
* gdb.base/fullpath-expand-func.c: New file.
* gdb.base/fullpath-expand.c: New file.
* gdb.base/fullpath-expand.exp: New file.
* gdb.base/realname-expand-real.c: New file.
* gdb.base/realname-expand.c: New file.
* gdb.base/realname-expand.exp: New file.
* ada-lang.c (user_select_syms): Replace symtab->filename refererences
by symtab_to_filename_for_display calls.
* breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise.
(clear_command): New variable sal_fullname, initialize it. Replace
compare_filenames_for_search by filename_cmp with sal_fullname.
(say_where, update_static_tracepoint): Replace symtab->filename
refererences by symtab_to_filename_for_display calls.
* cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec):
Likewise.
* dwarf2read.c: Include source.h.
(fixup_go_packaging): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* linespec.c (add_sal_to_sals): Rename variable filename to fullname.
Replace symtab->filename refererences by symtab_to_filename_for_display
calls.
(create_sals_line_offset, convert_linespec_to_sals): New variable
fullname, initialize it, replace symtab->filename reference by the
variable.
* linux-fork.c: Include source.h.
(info_checkpoints_command): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* macroscope.c (sal_macro_scope): Replace symtab->filename refererences
by symtab_to_filename_for_display calls.
* mdebugread.c: Include source.h.
(psymtab_to_symtab_1): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
(mi_cmd_file_list_exec_source_files): Likewise.
* printcmd.c: Include source.h.
(build_address_symbolic): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* psymtab.c (partial_map_symtabs_matching_filename)
(read_psymtabs_with_fullname): Call compare_filenames_for_search also
with psymtab_to_fullname.
* python/py-symtab.c (stpy_str): Replace symtab->filename refererences
by symtab_to_filename_for_display calls.
(stpy_get_filename): New variable filename, initialize it, use instead
of symtab->filename refererences.
(salpy_str): Make variable filename const char *. Replace
symtab->filename refererences by symtab_to_filename_for_display calls.
* skip.c: Include source.h and filenames.h.
(skip_file_command): Remove const from the symtab variable. Replace
symtab->filename refererences by symtab_to_fullname call.
(function_name_is_marked_for_skip): New variables searched_for_fullname
and fullname. Use them to search also with symtab's fullname.
* source.c (find_source_lines): Replace symtab->filename refererences
by symtab_to_filename_for_display calls.
(print_source_lines_base): New variable filename, use it instead of
symtab->filename. Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
(line_info, forward_search_command): Replace symtab->filename
refererences by symtab_to_filename_for_display calls.
(reverse_search_command): Replace symtab->filename refererences by
symtab_to_filename_for_display calls. New variable filename for it.
* stack.c (frame_info): Likewise.
* symmisc.c: Include source.h.
(dump_objfile, dump_symtab_1, maintenance_print_symbols)
(maintenance_info_symtabs): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* symtab.c (iterate_over_some_symtabs): Call
compare_filenames_for_search also with symtab_to_fullname.
(lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace
symtab->filename refererences by symtab_to_filename_for_display calls.
(find_line_symtab): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
(file_matches): Replace filename_cmp by compare_filenames_for_search.
(print_symbol_info): Make the last parameter const char *. New
variable s_filename. Use it in the function.
(symtab_symbol_info): Make the last_filename variable const char *.
Replace symtab->filename refererences by symtab_to_filename_for_display
calls.
(rbreak_command): New variable fullname. Use it. Replace
symtab->filename refererence by symtab_to_filename_for_display call.
* tracepoint.c (set_traceframe_context, trace_find_line_command)
(print_one_static_tracepoint_marker): Replace symtab->filename
refererences by symtab_to_filename_for_display calls.
* tui/tui-source.c (tui_set_source_content): New variables filename and
s_filename. Replace symtab->filename refererences by this variable.
Replace other symtab->filename refererences by
symtab_to_filename_for_display calls.
Code cleanup.
* dwarf2read.c (dw2_expand_symtabs_with_filename): Rename to ...
(dw2_expand_symtabs_with_fullname): ... here. Rename parameter
filename to fullname. Rename variable this_name to this_fullname.
Lowercase FILENAME_CMP call.
(dw2_find_symbol_file): New comment for the returned string.
(dwarf2_gdb_index_functions): Rename the function to
dw2_expand_symtabs_with_fullname.
* psymtab.c (read_psymtabs_with_filename): Rename to ...
(read_psymtabs_with_fullname): ... here. Rename parameter filename to
fullname.
(psym_functions): Rename the function to read_psymtabs_with_fullname.
* symfile.h (struct quick_symbol_functions): Rename field
expand_symtabs_with_filename to expand_symtabs_with_fullname and its
parameter filename to fullname. Document returned string meaning for
find_symbol_file.
* symtab.c (find_line_symtab): Rename the called function to
expand_symtabs_with_fullname.
Code cleanup.
* breakpoint.c (clear_command): Remove variable is_abs, unify the
call of filename_cmp with compare_filenames_for_search.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Remove variable
is_abs, unify the call of FILENAME_CMP with
compare_filenames_for_search. New gdb_asserts for real_path and name.
Unify the call of compare_filenames_for_search with FILENAME_CMP.
* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
* symfile.h (struct quick_symbol_functions): Extend the comment for
map_symtabs_matching_filename.
* symtab.c (compare_filenames_for_search): Remove the function comment
relative path requirement. Handle absolute filenames, with a comment.
(iterate_over_some_symtabs): Remove variable is_abs, unify the call of
FILENAME_CMP with compare_filenames_for_search. New gdb_asserts for
real_path and name. Unify the call of compare_filenames_for_search
with FILENAME_CMP.
(iterate_over_symtabs): New gdb_assert on REAL_PATH.
gdb/testsuite/
* gdb.mi/mi-fullname-deleted.exp: Use double last slash for $srcfileabs.
(compare_filenames_for_search does not match)
(compare_filenames_for_search does match): New tests.
Replace xfullpath calls by gdb_realpath calls.
* cli/cli-cmds.c (find_and_open_script): Remove xfullpath from the
function comment.
* dwarf2read.c (dw2_map_expand_apply): Remove parameter full_path.
Remove it from the iterate_over_some_symtabs call.
(dw2_map_symtabs_matching_filename): Remove parameter full_path.
Remove it from the dw2_map_expand_apply calls, remove a block handling
it.
* psymtab.c (partial_map_expand_apply): Remove parameter full_path.
Remove it from the iterate_over_some_symtabs call.
(partial_map_symtabs_matching_filename): Remove parameter full_path.
Remove it from the partial_map_expand_apply calls, remove a block
handling it. Drop gdb_realpath call and cleanups from the real_path
handling.
* source.c (openp): Drop the comment part about xfullpath. Replace
xfullpath calls by gdb_realpath calls.
(find_and_open_source): Replace xfullpath call by gdb_realpath call.
* symfile.h (struct quick_symbol_functions): Remove parameter full_path
from method map_symtabs_matching_filename and its comment.
* symmisc.c (maintenance_print_msymbols): Replace xfullpath call by
gdb_realpath call.
* symtab.c (iterate_over_some_symtabs): Remove parameter full_path,
remove it also from the function comment, remove a block handling it.
Drop gdb_realpath call and cleanups from the real_path handling.
(iterate_over_symtabs): Drop variable full_path and its use.
* symtab.h (iterate_over_some_symtabs): Remove parameter full_path.
* utils.c (xfullpath): Remove.
* utils.h (xfullpath): Remove.
gdb/testsuite/
* gdb.gdb/xfullpath.exp: Replace xfullpath calls by gdb_realpath calls.
* dwarf2read.c (dwarf2_per_cu_data): Split imported_symtabs and
type_unit_group out of union s. All uses updated.
(read_index_from_section): Watch for index version 8.
(follow_die_sig): If using .gdb_index version <= 7, record the TU as
an imported symtab.
(write_psymtabs_to_index): Increment version number to 8.
doc/
* gdb.texinfo (Index Section Format): Document .gdb_index version 8.
* symfile.c (obsavestring): Remove.
* ada-exp.y: Use obstack_copy0, not obsavestring.
* ada-lang.c: Use obstack_copy0, not obsavestring.
* coffread.c: Use obstack_copy0, not obsavestring.
* cp-namespace.c: Use obstack_copy0, not obsavestring.
* dbxread.c: Use obstack_copy0, not obsavestring.
* dwarf2read.c: Use obstack_copy0, not obsavestring.
* jit.c: Use obstack_copy0, not obsavestring.
* mdebugread.c: Use obstack_copy0, not obsavestring.
* psymtab.c: Use obstack_copy0, not obsavestring.
* stabsread.c: Use obstack_copy0, not obsavestring.
* xcoffread.c: Use obstack_copy0, not obsavestring.
Fix gdb.fortran/common-block.exp crash in PIE mode.
* dwarf2read.c (new_symbol_full) <DW_TAG_common_block>: Use
LOC_COMMON_BLOCK.
* f-valprint.c (info_common_command_for_block): Expect
LOC_COMMON_BLOCK in gdb_assert.
* symtab.h (struct general_symbol_info): Update comment for the
common_block member.
(domain_enum): Extend comment for the COMMON_BLOCK_DOMAIN member.
(enum address_class): New member LOC_COMMON_BLOCK.
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
Code cleanup.
* dwarf2read.c (fixup_go_packaging): Do not check symtab->FILENAME for
NULL.
* linespec.c (add_sal_to_sals): Likewise.
* psympriv.h (allocate_psymtab): Add ATTRIBUTE_NONNULL.
* stack.c (print_frame): Do not check symtab->FILENAME for NULL.
* symfile.h (allocate_symtab): Add ATTRIBUTE_NONNULL.
* symtab.h (struct symtab): Add comment it is never NULL for filename.
* tracepoint.c (set_traceframe_context): Do not check symtab->FILENAME
for NULL.
* tui/tui-source.c (tui_set_source_content): Likewise.
Code cleanup.
* breakpoint.c (clear_command): Remove variable sal_name_len and its
initialization, remove it from the compare_filenames_for_search call.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Remove variable
name_len and its initialization, remove it from the
compare_filenames_for_search calls.
* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
* symtab.c (compare_filenames_for_search): Remove the search_len
parameter, update the function comment, new variable search_len
initialized from SEARCH_NAME.
(iterate_over_some_symtabs): Remove variable name_len and its
initialization, remove it from the compare_filenames_for_search calls.
* symtab.h (compare_filenames_for_search): Remove the search_len
parameter,
* configure.ac (CC_HAS_LONG_LONG): Replace by AC_MSG_ERROR.
* defs.h (LONGEST, ULONGEST): Remove conditionalization for
CC_HAS_LONG_LONG.
* dwarf2-frame.c (DW64_CIE_ID): Likewise.
* dwarf2read.c (extract_cu_value): Remove the function.
(create_cus_from_index_list): Make the return type void, inline the
extract_cu_value caller, include new gdb_static_assert.
(create_cus_from_index): Make the return type void, update the function
comment, update the create_cus_from_index_list caller.
(create_signatured_type_table_from_index): Make the return type void,
inline the extract_cu_value caller, include new gdb_static_assert.
(dwarf2_read_index): Update the create_cus_from_index and
create_signatured_type_table_from_index caller.
* printcmd.c (ui_printf): Remove conditionalizations for
CC_HAS_LONG_LONG.
* config.in: Regenerate.
* configure: Regenerate.
gdb/doc/
* gdbint.texinfo (Host Definition): Remove CC_HAS_LONG_LONG.
* dwarf2read.c (struct dwarf2_cu): New field producer_is_gcc_lt_4_3.
Update the comment for checked_producer.
(check_producer): New forward declaration.
(producer_is_gcc_lt_4_3): New function.
(find_file_and_directory): Simulate *COMP_DIR only for gcc < 4.3.
(check_producer): Initialize also PRODUCER_IS_GCC_LT_4_3.
gdb/testsuite/
* gdb.dwarf2/dw2-compdir-oldgcc.S: New file.
* gdb.dwarf2/dw2-compdir-oldgcc.exp: New file.
* contrib/cc-with-tweaks.sh: Add -p parameter to invoke dwp.
* dwarf2read.c: #include "elf-bfd.h".
(struct dwarf2_per_objfile): New members dwp_checked, dwp_file.
(dwop_section_names): Renamed from dwo_section names. All uses
updated. Add entries for .debug_cu_index, .debug_tu_index.
(struct dwo_file): Rename dwo_name to name, dwo_bfd to dbfd.
All uses updated.
(struct dwp_sections): New type.
(struct virtual_dwo_sections): New type.
(struct dwp_hash_table): New type.
(struct dwp_file): New type.
(init_cutu_and_read_dies): Ensure DWO info/types section has been
read in. Handle DWOs coming from DWP files.
(lookup_dwo_file_slot): New function.
(dwarf2_locate_dwo_sections): Move definition closer to use.
(create_dwo_debug_info_hash_table_reader): Renamed from
create_debug_info_hash_table_reader. All callers updated.
(create_dwo_debug_info_hash_table): Renamed from
create_debug_info_hash_table. All callers updated.
(create_dwp_hash_table): New function.
(locate_virtual_dwo_sections, create_dwo_in_dwp): New functions.
(lookup_dwo_in_dwp): New function.
(try_open_dwop_file): Renamed from try_open_dwo_file. New parameter
is_dwp. All callers updated.
(open_dwop_file): Renamed from open_dwo_file. All callers updated.
(open_and_init_dwo_file): Renamed from init_dwo_file.
All callers updated.
(lookup_dwo_file): Delete.
(dwarf2_locate_dwp_sections): New function.
(hash_dwp_loaded_cutus, eq_dwp_loaded_cutus): New functions.
(allocate_dwp_loaded_cutus_table): New function.
(open_and_init_dwp_file): New function.
(lookup_dwo_cutu): New function.
(lookup_dwo_comp_unit, lookup_dwo_type_unit): Call it.
(read_common_block): Handle child DIEs with
DW_AT_data_member_location.
(new_symbol_full): Add special case for common blocks.
gdb/testsuite
* gdb.dwarf2/dw2-common-block.S: New file.
* gdb.dwarf2/dw2-common-block.exp: New file.
* dwarf2read.c (dwarf2_locate_sections): Move variable aflag here.
Move the SEC_HAS_CONTENTS check here - for any NAMES use.
(dwarf2_locate_sections) <eh_frame>: Move the variable and check from
here.
SIZE to size_t.
(dwarf2_evaluate_loc_desc): Likewise.
(dwarf2_loc_desc_needs_frame): Likewise.
(locexpr_describe_location_1): Likewise.
* dwarf2loc.h (struct dwarf2_locexpr_baton): Make SIZE as
size_t.
(struct dwarf2_loclist_baton): Likewise.
* dwarf2read.c (struct dwarf_block): Likewise.
(dump_die_shallow): Use pulongest to print dwarf_block.size.
(decode_locdesc): Expand SIZE and I to size_t.
and delete reference to --use-deprecated-index-sections.
* symfile.h (use_deprecated_index_sections): Delete.
* dwarf2read.c (use_deprecated_index_sections): Make static.
(read_index_from_section): Update wording of how to load
deprecated index sections.
(_initialize_dwarf2_read): New options
"set/show use-deprecated-index-sections".
* main.c (captured_main): Delete --use-deprecated-index-sections.
doc/
* gdb.texinfo (Mode Options): Delete --use-deprecated-index-sections.
(Index Files): Document how to control the use of deprecated index
sections.
(Index Section Format): Replace --use-deprecated-index-sections with
"set use-deprecated-index-sections on".
(locate_dwz_sections): Recognize .gdb_index.
(create_cus_from_index_list): New function.
(create_cus_from_index): Use it. Handle .dwz data.
(read_index_from_section): New function, extracted from
dwarf2_read_index.
(dwarf2_read_index): Use it. Read .gdb_index from dwz file,
if needed.
gdb_bfd_unref.
(free_dwo_file): Use gdb_bfd_unref.
* cli/cli-dump.c: Include gdb_bfd.h.
(bfd_openw_with_cleanup): Use gdb_bfd_ref.
(bfd_openr_with_cleanup): Likewise.
* windows-nat.c (windows_make_so): Use gdb_bfd_ref,
gdb_bfd_unref.
* utils.c: Include gdb_bfd.h.
(do_bfd_close_cleanup): Use gdb_bfd_unref.
* symfile.c: Include gdb_bfd.h.
(separate_debug_file_exists): Use gdb_bfd_unref.
(bfd_open_maybe_remote): Use gdb_bfd_ref.
(symfile_bfd_open): Use gdb_bfd_ref, gdb_bfd_unref.
(generic_load): Use gdb_bfd_ref.
(reread_symbols): Use gdb_bfd_unref.
* symfile-mem.c: Include gdb_bfd.h.
(symbol_file_add_from_memory): Use make_cleanup_bfd_close.
* spu-linux-nat.c (spu_bfd_open): Use gdb_bfd_ref, gdb_bfd_unref.
* solib.c: Include gdb_bfd.h.
(solib_bfd_fopen): Use gdb_bfd_ref.
(solib_bfd_open): Use gdb_bfd_unref.
(free_so_symbols): Use gdb_bfd_unref.
(reload_shared_libraries_1): Use gdb_bfd_unref.
* solib-spu.c: Include gdb_bfd.h.
(spu_bfd_fopen): Use gdb_bfd_ref, gdb_bfd_unref.
* solib-pa64.c (pa64_solib_create_inferior_hook): Use gdb_bfd_ref,
gdb_bfd_unref.
* solib-frv.c: Include gdb_bfd.h.
(enable_break2): Use gdb_bfd_unref.
* solib-dsbt.c: Include gdb_bfd.h.
(enable_break2): Use gdb_bfd_unref.
* solib-darwin.c: Include gdb_bfd.h.
(darwin_solib_get_all_image_info_addr_at_init): Use gdb_bfd_ref,
gdb_bfd_unref.
(darwin_bfd_open): Use gdb_bfd_unref.
* rs6000-nat.c (add_vmap): Use gdb_bfd_ref, gdb_bfd_unref.
* remote-mips.c: Include gdb_bfd.h.
(mips_load_srec): Use gdb_bfd_ref.
(pmon_load_fast): Use gdb_bfd_ref.
* remote-m32r-sdi.c: Include gdb_bfd.h.
(m32r_load): Use gdb_bfd_ref.
* record.c: Include gdb_bfd.h.
(record_save_cleanups): Use gdb_bfd_unref.
(cmd_record_save): Use gdb_bfd_unref.
* procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_ref,
gdb_bfd_unref.
* objfiles.h (gdb_bfd_close_or_warn): Remove.
(gdb_bfd_ref, gdb_bfd_unref): Move to gdb_bfd.h.
* objfiles.c: Include gdb_bfd.h.
(free_objfile): Use gdb_bfd_unref.
(gdb_bfd_close_or_warn, gdb_bfd_ref, gdb_bfd_unref): Move to
gdb_bfd.c.
* machoread.c (macho_add_oso_symfile): Use gdb_bfd_unref.
(macho_symfile_read_all_oso): Use gdb_bfd_ref, gdb_bfd_unref.
(macho_check_dsym): Likewise.
* m32r-rom.c: Include gdb_bfd.h.
(m32r_load): Use gdb_bfd_ref.
(m32r_upload_command): Use gdb_bfd_ref.
* jit.c: Include gdb_bfd.h.
(jit_bfd_try_read_symtab): Use gdb_bfd_ref, gdb_bfd_unref.
* gdb_bfd.h: New file.
* gdb_bfd.c: New file.
* gcore.c: Include gdb_bfd.h.
(create_gcore_bfd): Use gdb_bfd_ref.
(do_bfd_delete_cleanup): Use gdb_bfd_unref.
(gcore_command): Use gdb_bfd_unref.
* exec.c: Include gdb_bfd.h.
(exec_close): Use gdb_bfd_unref.
(exec_close_1): Use gdb_bfd_unref.
(exec_file_attach): Use gdb_bfd_ref.
* elfread.c: Include gdb_bfd.h.
(build_id_verify): Use gdb_bfd_unref.
* dsrec.c: Include gdb_bfd.h.
(load_srec): Use gdb_bfd_ref.
* corelow.c: Include gdb_bfd.h.
(core_close): Use gdb_bfd_unref.
(core_open): Use gdb_bfd_ref.
* bfd-target.c: Include gdb_bfd.h.
(target_bfd_xclose): Use gdb_bfd_unref.
(target_bfd_reopen): Use gdb_bfd_ref.
* Makefile.in (SFILES): Add gdb_bfd.c.
(HFILES_NO_SRCDIR): Add gdb_bfd.h.
(COMMON_OBS): Add gdb_bfd.o.
(type_unit_group): Embed "per_cu" member, remove pointer.
New union member "t", move member "tus" into it, all uses updated.
New member "hash", replaces member "line_offset, all uses updated.
(quick_file_names): Replace member "offset" with "hash", all uses
updated.
(hash_stmt_list_entry, eq_stmt_list_entry): New functions.
(hash_file_name_entry, eq_file_name_entry): Call them.
(hash_type_unit_group, eq_type_unit_group): Ditto.
(dw2_get_cu, dw2_get_primary_cu): Replace assert with a better one.
(dw2_get_file_names_reader): Fix file name table calculation for TUs.
(dw2_get_file_names): Update.
(create_type_unit_group): Replace "per_cu" arg with "cu".
All callers updated. Fix "quick" (.gdb_index) handling.
(get_type_unit_group): Replace "per_cu" arg with "cu".
All callers updated.
(build_type_unit_groups): Don't reset tu_stats.
* buildsym.c (end_symtab_1): Split it to ...
(end_symtab_get_static_block): ... this ...
(end_symtab_from_static_block): ... and this function.
(end_symtab, end_expandable_symtab): Call them.
* buildsym.h (end_symtab_get_static_block)
(end_symtab_from_static_block): New declarations.
* dwarf2read.c (process_full_comp_unit): New variable static_block.
Set its valid CU ranges.
gdb/testsuite/
* gdb.dwarf2/dw2-minsym-in-cu.S: New file.
* gdb.dwarf2/dw2-minsym-in-cu.exp: New file.
* dwarf2read.c (dwarf2_per_objfile): New members n_type_unit_groups,
all_type_unit_groups, type_unit_groups, tu_stats.
(dwarf2_per_cu_data): Move "imported_symtabs" into new union "s".
All uses updated. Add type_unit_group to union "s".
(type_unit_group): New struct.
(IS_TYPE_UNIT_GROUP): New macro.
(abbrev_table): Delete unused member "section".
(dw2_do_instantiate_symtab): Early exit if type_unit_group.
(dw2_get_cu): Assert not used with type_unit_group.
(dw2_get_primary_cu): New function.
(dw2_build_type_unit_groups_reader): New function.
(dw2_build_type_unit_groups): New function.
(dw2_get_file_names): Assert not called on type units.
(dw2_map_symtabs_matching_filename): Call dw2_build_type_unit_groups.
Redo loop to iterate over type unit groups instead of type units.
(dw2_expand_symtabs_matching, dw2_map_symbol_filenames): Ditto.
(read_abbrev_offset): New function.
(init_cutu_and_read_dies): New arg "abbrev_table". All callers
updated.
(create_partial_symtab): New function.
(process_psymtab_comp_unit_reader): Assert not used with type units.
Call create_partial_symtab.
(process_psymtab_type_unit): Delete.
(hash_type_unit_group, eq_type_unit_group): New functions.
(allocate_type_unit_groups_table): New function.
(NO_STMT_LIST_TYPE_UNIT_PSYMTAB): New macro.
(NO_STMT_LIST_TYPE_UNIT_PSYMTAB_SIZE): New macro.
(create_type_unit_group, get_type_unit_group): New functions.
(tu_abbrev_offset): New struct.
(sort_tu_by_abbrev_offset): New function.
(add_type_unit_group_to_table): New function.
(build_type_unit_groups): New function.
(build_type_psymtabs_reader): New function.
(build_type_psymtab_dependencies): New function.
(build_type_psymtabs): Rewrite.
(scan_partial_symbols): Flag an error if a DW_TAG_imported_unit
is seen in a type unit.
(process_queue): Move symtab expansion debugging printfs here.
Call process_full_type_unit for type units.
(compute_symtab_includes): Assert not called for type units.
(process_cu_includes): Don't call compute_symtab_includes for
type units.
(process_full_type_unit): New function.
(process_imported_unit_die): Flag an error if called for type units.
(handle_DW_AT_stmt_list): Delete arg "want_line_info". All callers
updated. Assert not called for type units.
(read_file_scope): Call dwarf2_start_symtab.
(setup_type_unit_groups): New function.
(read_type_unit_scope): Rewrite.
(abbrev_table_read_table): Initialize abbrev_table->offset.
(abbrev_table_free_cleanup): New function.
(dwarf2_start_symtab): New function.
(load_full_type_unit): Assert not called for type unit groups.
(init_cutu_and_read_dies): Handle rereading a DWO CU while it's
currently being read. Propagate DW_AT_comp_dir to DWO DIE.
testsuite/
* gdb.dwarf2/fission-reread.S: New file.
* gdb.dwarf2/fission-reread.exp: New file.
(struct abbrev_table): Define.
(dwarf2_cu): Replace members dwarf2_abbrevs, abbrev_obstack with
abbrev_table.
(init_cutu_and_read_dies): Update.
(abbrev_table_alloc_abbrev): New function. Replaces
dwarf_alloc_abbrev. All callers updated.
(abbrev_table_add_abbrev): New function.
(abbrev_table_lookup_abbrev): New function. Replaces
dwarf2_lookup_abbrev. All callers updated.
(abbrev_table_read_table): New function. Contents moved here from
dwarf2_read_abbrevs.
(dwarf2_read_abbrevs): Call it.
(abbrev_table_free): New function.
(dwarf2_free_abbrev_table): Call it.
* NEWS: Document additions to .gdb_index.
* dwarf2read.c: #include "gdb/gdb-index.h".
(DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE): New macro.
(DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE): New macro.
(DW2_GDB_INDEX_CU_SET_VALUE): New macro.
(dwarf2_read_index): Recognize version 7.
(dw2_do_expand_symtabs_matching): New args want_specific_block,
block_kind, domain): All callers updated.
(dw2_find_symbol_file): Handle new index CU values.
(dw2_expand_symtabs_matching): Match symbol kind if requested.
(add_index_entry): New args is_static, kind. All callers updated.
(offset_type_compare, uniquify_cu_indices): New functions
(symbol_kind): New function.
(write_psymtabs_to_index): Remove duplicate CU values.
(write_psymtabs_to_index): Write .gdb_index version 7.
doc/
* gdb.texinfo (Index Section Format): Document version 7 format.
include/gdb/
* gdb-index.h: New file.
Adjust address for DW_OP_GNU_addr_index.
* dwarf2expr.h (dwarf_expr_context): Update comment.
* dwarf2loc.c (locexpr_describe_location_piece): New arg per_cu,
all callers updated. Handle TLS vars described with
DW_OP_GNU_const_index.
(disassemble_dwarf_expression): Handle DW_OP_GNU_addr_index
and DW_OP_GNU_const_index.
* dwarf2read.c (decode_locdesc): Handle DW_OP_GNU_addr_index.
* dwarf2expr.c (execute_stack_op): Support DW_OP_GNU_parameter_ref.
* dwarf2loc.c (call_site_parameter_matches): Support
CALL_SITE_PARAMETER_PARAM_OFFSET.
(needs_dwarf_reg_entry_value): Push stub value.
* dwarf2read.c (read_call_site_scope): New variable origin. Support
CALL_SITE_PARAMETER_PARAM_OFFSET and its DW_AT_abstract_origin.
* gdbtypes.h (enum call_site_parameter_kind): New item
CALL_SITE_PARAMETER_PARAM_OFFSET.
(struct call_site.parameter.u): New field param_offset.
gdb/testsuite/
* gdb.arch/amd64-entry-value-param.S: New file.
* gdb.arch/amd64-entry-value-param.c: New file.
* gdb.arch/amd64-entry-value-param.exp: New file.
Code cleanup: Generalize call_site.parameter key.
* dwarf2expr.c (execute_stack_op) <DW_OP_GNU_entry_value>: Remove
variable dwarf_reg. New variable kind_u. Update parameters to
push_dwarf_reg_entry_value.
(ctx_no_push_dwarf_reg_entry_value): Update parameters.
* dwarf2expr.h (enum call_site_parameter_kind)
(union call_site_parameter_u): Forward declarations.
(struct dwarf_expr_context_funcs): Update parameters and their
description for push_dwarf_reg_entry_value.
(ctx_no_push_dwarf_reg_entry_value): Update parameters.
* dwarf2loc.c (call_site_parameter_matches): New function.
(dwarf_expr_reg_to_entry_parameter): Update parameters and their
description. Use call_site_parameter_matches.
(dwarf_expr_push_dwarf_reg_entry_value, value_of_dwarf_reg_entry):
Update parameters and their description.
(value_of_dwarf_block_entry): Remove variables dwarf_reg and fb_offset.
New variable kind_u. Adjust the caller for updated parameters.
(needs_dwarf_reg_entry_value): Update parameters.
* dwarf2read.c (read_call_site_scope): New variable loc. Use it
instead of attr. Update for the changed fields of struct
call_site_parameter.
* gdbtypes.h: Include dwarf2expr.h.
(enum call_site_parameter_kind): New.
(struct call_site.parameter): New field kind. Wrap dwarf_reg and
fb_offset into new union u.
* opncls.c (bfd_fopen): Always close fd on failure.
(bfd_fdopenr): Likewise.
gdb/
* symfile.c (symfile_bfd_open): Don't close desc if bfd_fopen
fails.
* solib.c (solib_bfd_fopen): Don't close fd if bfd_fopen fails.
* exec.c (exec_file_attach): Don't close scratch_chan if bfd_fopen
fails.
* dwarf2read.c (try_open_dwo_file): Don't close fd if bfd_fopen
fails.
PR symtab/13277: Resolving opaque structures in ICC generated binaries.
* dwarf2read.c (struct dwarf2_cu) <producer_is_icc>: New field.
(producer_is_gxx_lt_4_6): Move the checking and caching to...
(check_producer): ... this new function, which also checks for ICC
and caches the result.
(producer_is_icc): New function.
(read_structure_type): Don't set TYPE_STUB_SUPPORTED if the
producer was ICC.
gdb/testsuite/
PR symtab/13277: Resolving opaque structures in ICC generated binaries.
* gdb.dwarf2/dw2-icc-opaque.S: New file.
* gdb.dwarf2/dw2-icc-opaque.exp: New file.
"const gdb_byte *".
(struct dwarf2_fde): Make instructions, end "const gdb_byte *".
(execute_cfa_program): Update to match API of leb128 functions.
(read_1_byte, read_4_bytes, read_8_bytes): Make buf parameter
"const gdb_byte *".
(read_unsigned_leb128, read_signed_leb128): Delete.
(read_initial_length): Change type of buf argument to
"const gdb_byte *".
(read_encoded_value): Update to match API of leb128 functions.
(decode_frame_entry): Change result to "const gdb_byte *", and
similarly for "start" parameter.
(decode_frame_entry_1): Ditto. Use new leb128 reader functions.
(dwarf2_build_frame_info): Change local frame_ptr to
"const gdb_byte *".
* dwarf2expr.c (safe_read_uleb128, safe_read_sleb128): Replaces
read_uleb128, read_sleb128. All callers updated.
(safe_skip_leb128): New function.
(dwarf_block_to_dwarf_reg): Update to match API of leb128 functions.
Call gdb_read_uleb128, gdb_skip_leb128 instead of read_uleb128.
(dwarf_block_to_dwarf_reg_deref): Update to match API of leb128
functions. Call gdb_read_uleb128, gdb_read_sleb128 instead of
read_uleb128, read_sleb128.
(dwarf_block_to_fb_offset, dwarf_block_to_sp_offset): Ditto.
(execute_stack_op): Update to match API of leb128 functions.
* dwarf2expr.h: #include "leb128.h".
(read_uleb128, read_sleb128): Delete.
(gdb_read_uleb128, gdb_read_sleb128, gdb_skip_leb128): New functions.
(safe_read_uleb128, safe_read_sleb128, safe_skip_leb128): Declare.
* dwarf2loc.c (debug_loc_kind): New enum.
(decode_debug_loc_addresses): New function.
(decode_debug_loc_dwo_addresses): New function.
(dwarf2_find_location_expression): Rewrite.
(dwarf2_compile_expr_to_ax): Update to match API of leb128 functions.
(locexpr_describe_location_piece): Ditto.
(disassemble_dwarf_expression): Ditto.
(locexpr_describe_location_1): Ditto.
(loclist_describe_location): Rewrite.
* dwarf2loc.h (dwarf2_loclist_baton): New member "from_dwo".
* dwarf2read.c (die_reader_specs): New member "buffer_end".
(dwarf2_section_buffer_overflow_complaint): Renamed from
dwarf2_macros_too_long_complaint. All callers updated.
(skip_leb128): Delete.
(init_cu_die_reader): Initialize reader->buffer_end.
(skip_one_die): Replace call to skip_leb128 with safe_skip_leb128.
(skip_form_bytes): New arg buffer_end. All callers updated.
Replace call to skip_leb128 with gdb_skip_leb128.
(skip_unknown_opcode): New arg mac_end. All callers updated.
(fill_in_loclist_baton): Initialize baton->from_dwo.