binutils-gdb/gdb/f-typeprint.c

469 lines
14 KiB
C
Raw Normal View History

/* Support for printing Fortran types for GDB, the GNU debugger.
Copyright (C) 1986-2020 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C version by Farooq Butt
(fmbutt@engage.sps.mot.com).
1999-07-07 22:19:36 +02:00
This file is part of GDB.
1999-07-07 22:19:36 +02:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
1999-07-07 22:19:36 +02:00
(at your option) any later version.
1999-07-07 22:19:36 +02:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
1999-07-07 22:19:36 +02:00
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "gdb_obstack.h"
#include "bfd.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "value.h"
#include "gdbcore.h"
#include "target.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "f-lang.h"
fort_dyn_array: add basic fortran dyn array support Fortran provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is: * to read allocated/associated DWARF tags and store them in the dynamic property list of main_type. * enable GDB to print the value of a dynamic array in Fortran in case the type is allocated or associated (pointer to dynamic array). Examples: (gdb) p vla_not_allocated $1 = <not allocated> (gdb) p vla_allocated $1 = (1, 2, 3) (gdb) p vla_ptr_not_associated $1 = <not associated> (gdb) p vla_ptr_associated $1 = (1, 2, 3) Add basic test coverage for most dynamic array use-cases in Fortran. The commit contains the following tests: * Ensure that values of Fortran dynamic arrays can be evaluated correctly in various ways and states. * Ensure that Fortran primitives can be evaluated correctly when used as a dynamic array. * Dynamic arrays passed to subroutines and handled in different ways inside the routine. * Ensure that the ptype of dynamic arrays in Fortran can be printed in GDB correctly. * Ensure that dynamic arrays in different states (allocated/associated) can be evaluated. * Dynamic arrays passed to functions and returned from functions. * History values of dynamic arrays can be accessed and printed again with the correct values. * Dynamic array evaluations using MI protocol. * Sizeof output of dynamic arrays in various states. The patch was tested using the test suite on Ubuntu 12.04 64bit. gdb/ChangeLog: * dwarf2read.c (set_die_type): Add read of DW_AT_allocated and DW_AT_associated. * f-typeprint.c: New include of typeprint.h (f_print_type): Add check for allocated/associated status of type. (f_type_print_varspec_suffix): Add check for allocated/associated status of type. * gdbtypes.c (create_array_type_with_stride): Add check for valid data location of type in case allocated or associated attributes are set. Length of an array should be only calculated if allocated or associated is resolved as true. (is_dynamic_type_internal): Add check for allocated/ associated. (resolve_dynamic_array): Evaluate allocated/associated properties. * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED> <DYN_PROP_ASSOCIATED>: New enums. (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros. (type_not_allocated): New function. (type_not_associated): New function. * valarith.c (value_subscripted_rvalue): Add check for allocated/associated. * valprint.c: New include of typeprint.h. (valprint_check_validity): Add check for allocated/associated. (value_check_printable): Add check for allocated/ associated. * typeprint.h (val_print_not_allocated): New function. (val_print_not_associated): New function. * typeprint.c (val_print_not_allocated): New function. (val_print_not_associated): New function. gdb/testsuite/ChangeLog: * gdb.fortran/vla-alloc-assoc.exp: New file. * gdb.fortran/vla-datatypes.exp: New file. * gdb.fortran/vla-datatypes.f90: New file. * gdb.fortran/vla-history.exp: New file. * gdb.fortran/vla-ptype-sub.exp: New file. * gdb.fortran/vla-ptype.exp: New file. * gdb.fortran/vla-sizeof.exp: New file. * gdb.fortran/vla-sub.f90: New file. * gdb.fortran/vla-value-sub-arbitrary.exp: New file. * gdb.fortran/vla-value-sub-finish.exp: New file. * gdb.fortran/vla-value-sub.exp: New file. * gdb.fortran/vla-value.exp: New file. * gdb.fortran/vla-ptr-info.exp: New file. * gdb.mi/mi-vla-fortran.exp: New file. * gdb.mi/vla.f90: New file.
2015-10-21 21:32:30 +02:00
#include "typeprint.h"
Introduce metadata style This introduces a new "metadata" style and changes many places in gdb to use it. The idea here is to let the user distinguish gdb output from output that (conceptually at least) comes directly from the inferior. The newly-styled category includes text that gdb traditionally surrounds in "<...>", like "<unavailable>". I only added a single test for this. In many cases this output is difficult to test. Also, while developing this errors in the implementation of the new printf formats showed up as regressions. gdb/ChangeLog 2019-10-01 Tom Tromey <tom@tromey.com> * p-lang.c (pascal_printstr): Use metadata style. * value.c (show_convenience): Use metadata style. * valprint.c (valprint_check_validity, val_print_optimized_out) (val_print_not_saved, val_print_unavailable) (val_print_invalid_address, generic_val_print, val_print) (value_check_printable, val_print_array_elements): Use metadata style. * ui-out.h (class ui_out) <field_fmt>: New overload. <do_field_fmt>: Add style parameter. * ui-out.c (ui_out::field_fmt): New overload. * typeprint.c (type_print_unknown_return_type) (val_print_not_allocated, val_print_not_associated): Use metadata style. * tui/tui-out.h (class tui_ui_out) <do_field_fmt>: Add style parameter. * tui/tui-out.c (tui_ui_out::do_field_fmt): Update. * tracepoint.c (tvariables_info_1): Use metadata style. * stack.c (print_frame_arg, print_frame_info, print_frame) (info_frame_command_core): Use metadata style. * skip.c (info_skip_command): Use metadata style. * rust-lang.c (rust_print_enum): Use metadata style. * python/py-prettyprint.c (print_stack_unless_memory_error): Use metadata style. * python/py-framefilter.c (py_print_single_arg): Use metadata style. * printcmd.c (do_one_display, print_variable_and_value): Use metadata style. * p-valprint.c (pascal_val_print) (pascal_object_print_value_fields): Use metadata style. * p-typeprint.c (pascal_type_print_base): Use metadata style. * mi/mi-out.h (class mi_ui_out) <do_field_fmt>: Add style parameter. * mi/mi-out.c (mi_ui_out::do_field_fmt): Update. * m2-valprint.c (m2_print_long_set): Use metadata style. * m2-typeprint.c (m2_print_type): Use metadata style. * infcmd.c (print_return_value_1): Use metadata style. * gnu-v3-abi.c (print_one_vtable): Use metadata style. * f-valprint.c (info_common_command_for_block): Use metadata style. * f-typeprint.c (f_type_print_base): Use metadata style. * expprint.c (print_subexp_standard): Use metadata style. * cp-valprint.c (cp_print_value_fields): Use metadata style. * cli/cli-style.h (class cli_style_option): Add constructor. (metadata_style): Declare. * cli/cli-style.c (metadata_style): New global. (_initialize_cli_style): Register metadata style. * cli-out.h (class cli_ui_out) <do_field_fmt>: Add style parameter. * cli-out.c (cli_ui_out::do_field_fmt): Update. * c-typeprint.c (c_type_print_base_struct_union) (c_type_print_base_1): Use metadata style. * breakpoint.c (watchpoint_value_print) (print_one_breakpoint_location): Use metadata style. * break-catch-syscall.c (print_one_catch_syscall): Use metadata style. * break-catch-sig.c (signal_catchpoint_print_one): Use metadata style. * ada-valprint.c (val_print_packed_array_elements, printstr) (print_field_values, ada_val_print_ref, ada_val_print): Use metadata style. * ada-typeprint.c (print_array_type, ada_print_type): Use metadata style. * ada-tasks.c (print_ada_task_info, info_task): Use metadata style. * ada-lang.c (user_select_syms): Use metadata style. gdb/testsuite/ChangeLog 2019-10-01 Tom Tromey <tom@tromey.com> * lib/gdb-utils.exp (style): Handle "metadata" argument. * gdb.base/style.exp: Add metadata style test.
2019-04-03 04:00:18 +02:00
#include "cli/cli-style.h"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
#if 0 /* Currently unused. */
2000-02-02 01:21:19 +01:00
static void f_type_print_args (struct type *, struct ui_file *);
#endif
static void f_type_print_varspec_suffix (struct type *, struct ui_file *, int,
2019-03-01 12:12:33 +01:00
int, int, int, bool);
2000-02-02 01:21:19 +01:00
void f_type_print_varspec_prefix (struct type *, struct ui_file *,
int, int);
2000-02-02 01:21:19 +01:00
void f_type_print_base (struct type *, struct ui_file *, int, int);
1999-07-07 22:19:36 +02:00
/* See documentation in f-lang.h. */
void
f_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream)
{
type = check_typedef (type);
f_print_type (type, "", stream, 0, 0, &type_print_raw_options);
}
/* LEVEL is the depth to indent lines by. */
void
f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
* ada-lang.c (user_select_syms, ada_print_subexp): Pass flags to type-printing functions. * ada-lang.h (ada_print_type): Add argument. * ada-typeprint.c (print_array_type, print_variant_clauses, print_variant_part, print_selected_record_field_types, print_record_field_types, print_unchecked_union_type, print_func_type, ada_print_type): Add flags argument. (ada_print_typedef): Update. * c-exp.y (OPERATOR conversion_type_id): Update. * c-lang.h (c_print_type, c_type_print_base): Update. * c-typeprint.c (c_print_type, c_type_print_varspec_prefix, c_type_print_modifier, c_type_print_args, c_type_print_varspec_suffix, c_type_print_base): Add flags argument. * cp-valprint.c (cp_print_class_member): Update. * dwarf2read.c (dwarf2_compute_name): Update. * f-lang.h (f_print_type): Add argument. * f-typeprint.c (f_print_type): Add flags argument. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update. * go-lang.h (go_print_type): Add argument. * go-typeprint.c (go_print_type): Add flags argument. * jv-lang.h (java_print_type): Add argument. * jv-typeprint.c (java_type_print_base, java_print_type): Add flags argument. * language.c (unk_lang_print_type): Add flags argument. * language.h (struct language_defn) <la_print_type>: Add flags argument. (LA_PRINT_TYPE): Likewise. * m2-lang.h (m2_print_type): Add argument. * m2-typeprint.c (m2_print_type, m2_range, m2_typedef, m2_array, m2_pointer, m2_ref, m2_procedure, m2_long_set, m2_unbounded_array, m2_record_fields): Add flags argument. * p-lang.h (pascal_print_type, pascal_type_print_base, pascal_type_print_varspec_prefix): Add argument. * p-typeprint.c (pascal_print_type, pascal_type_print_varspec_prefix, pascal_print_func_args, pascal_type_print_varspec_suffix, pascal_type_print_base): Add flags argument. * symmisc.c (print_symbol): Update. * typeprint.c (type_print_raw_options, default_ptype_flags): New globals. (type_print): Update. * typeprint.h (struct type_print_options): New. (type_print_raw_options): Declare. (c_type_print_varspec_suffix, c_type_print_args): Add argument.
2012-11-12 18:14:55 +01:00
int show, int level, const struct type_print_options *flags)
{
enum type_code code;
f_type_print_base (type, stream, show, level);
code = type->code ();
if ((varstring != NULL && *varstring != '\0')
/* Need a space if going to print stars or brackets; but not if we
will print just a type name. */
|| ((show > 0
|| TYPE_NAME (type) == 0)
&& (code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD
|| code == TYPE_CODE_ARRAY
|| ((code == TYPE_CODE_PTR
|| code == TYPE_CODE_REF)
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
|| (TYPE_TARGET_TYPE (type)->code ()
== TYPE_CODE_METHOD)
|| (TYPE_TARGET_TYPE (type)->code ()
== TYPE_CODE_ARRAY))))))
fputs_filtered (" ", stream);
f_type_print_varspec_prefix (type, stream, show, 0);
if (varstring != NULL)
{
Fix array out of bound access ASAN reports the following error, (gdb) PASS: gdb.fortran/vla-ptr-info.exp: continue to breakpoint: pvla-associated print &pvla^M =================================================================^M ^[[1m^[[31m==14331==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000ea569f at pc 0x0000008eb546 bp 0x7ffde0c1dc70 sp 0x7ffde0c1dc60^M ^[[1m^[[0m^[[1m^[[34mREAD of size 1 at 0x000000ea569f thread T0^[[1m^[[0m^M #0 0x8eb545 in f_print_type(type*, char const*, ui_file*, int, int, type_print_options const*) ../../binutils-gdb/gdb/f-typeprint.c:89^M #1 0xb611e2 in type_print(type*, char const*, ui_file*, int) ../../binutils-gdb/gdb/typeprint.c:365^M #2 0x7b3471 in c_value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/c-valprint.c:650^M #3 0xb99517 in value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/valprint.c:1233^M #4 0xa42be8 in print_formatted ../../binutils-gdb/gdb/printcmd.c:321^M #5 0xa46ac9 in print_value(value*, format_data const*) ../../binutils-gdb/gdb/printcmd.c:1233^M #6 0xa46d82 in print_command_1 ../../binutils-gdb/gdb/printcmd.c:1261^M #7 0xa46e3e in print_command ../../binutils-gdb/gdb/printcmd.c:1267 on this line of code demangled_args = varstring[strlen (varstring) - 1] == ')'; because varstring is an empty string and strlen () is 0, so "strlen () - 1" is definitely out of the bound of "varstring", (gdb) bt 10 at /home/yao/SourceCode/gnu/gdb/git/gdb/f-typeprint.c:56 at /home/yao/SourceCode/gnu/gdb/git/gdb/typeprint.c:365 at /home/yao/SourceCode/gnu/gdb/git/gdb/c-valprint.c:650 at /home/yao/SourceCode/gnu/gdb/git/gdb/valprint.c:1236 This patch adds a pre-check that varstring is empty or not. gdb: 2017-02-27 Yao Qi <yao.qi@linaro.org> * f-typeprint.c (f_print_type): Check "varstring" is empty first.
2017-02-27 18:27:17 +01:00
int demangled_args;
fputs_filtered (varstring, stream);
/* For demangled function names, we have the arglist as part of the name,
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
so don't print an additional pair of ()'s. */
Fix array out of bound access ASAN reports the following error, (gdb) PASS: gdb.fortran/vla-ptr-info.exp: continue to breakpoint: pvla-associated print &pvla^M =================================================================^M ^[[1m^[[31m==14331==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000ea569f at pc 0x0000008eb546 bp 0x7ffde0c1dc70 sp 0x7ffde0c1dc60^M ^[[1m^[[0m^[[1m^[[34mREAD of size 1 at 0x000000ea569f thread T0^[[1m^[[0m^M #0 0x8eb545 in f_print_type(type*, char const*, ui_file*, int, int, type_print_options const*) ../../binutils-gdb/gdb/f-typeprint.c:89^M #1 0xb611e2 in type_print(type*, char const*, ui_file*, int) ../../binutils-gdb/gdb/typeprint.c:365^M #2 0x7b3471 in c_value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/c-valprint.c:650^M #3 0xb99517 in value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/valprint.c:1233^M #4 0xa42be8 in print_formatted ../../binutils-gdb/gdb/printcmd.c:321^M #5 0xa46ac9 in print_value(value*, format_data const*) ../../binutils-gdb/gdb/printcmd.c:1233^M #6 0xa46d82 in print_command_1 ../../binutils-gdb/gdb/printcmd.c:1261^M #7 0xa46e3e in print_command ../../binutils-gdb/gdb/printcmd.c:1267 on this line of code demangled_args = varstring[strlen (varstring) - 1] == ')'; because varstring is an empty string and strlen () is 0, so "strlen () - 1" is definitely out of the bound of "varstring", (gdb) bt 10 at /home/yao/SourceCode/gnu/gdb/git/gdb/f-typeprint.c:56 at /home/yao/SourceCode/gnu/gdb/git/gdb/typeprint.c:365 at /home/yao/SourceCode/gnu/gdb/git/gdb/c-valprint.c:650 at /home/yao/SourceCode/gnu/gdb/git/gdb/valprint.c:1236 This patch adds a pre-check that varstring is empty or not. gdb: 2017-02-27 Yao Qi <yao.qi@linaro.org> * f-typeprint.c (f_print_type): Check "varstring" is empty first.
2017-02-27 18:27:17 +01:00
demangled_args = (*varstring != '\0'
&& varstring[strlen (varstring) - 1] == ')');
2019-03-01 12:12:33 +01:00
f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0, false);
}
}
/* Print any asterisks or open-parentheses needed before the
variable name (to describe its type).
On outermost call, pass 0 for PASSED_A_PTR.
On outermost call, SHOW > 0 means should ignore
any typename for TYPE and show its details.
SHOW is always zero on recursive calls. */
void
2000-07-30 03:48:28 +02:00
f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
int show, int passed_a_ptr)
{
if (type == 0)
return;
if (TYPE_NAME (type) && show <= 0)
return;
QUIT;
switch (type->code ())
{
case TYPE_CODE_PTR:
f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
break;
case TYPE_CODE_FUNC:
f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
if (passed_a_ptr)
fprintf_filtered (stream, "(");
break;
case TYPE_CODE_ARRAY:
f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
break;
case TYPE_CODE_UNDEF:
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_ENUM:
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
case TYPE_CODE_VOID:
case TYPE_CODE_ERROR:
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
case TYPE_CODE_METHOD:
case TYPE_CODE_REF:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types need no prefix. They are listed here so that
1999-07-07 22:19:36 +02:00
gcc -Wall will reveal any types that haven't been handled. */
break;
}
}
/* Print any array sizes, function arguments or close parentheses
needed after the variable name (to describe its type).
2019-03-01 12:12:33 +01:00
Args work like c_type_print_varspec_prefix.
PRINT_RANK_ONLY is true when TYPE is an array which should be printed
without the upper and lower bounds being specified, this will occur
when the array is not allocated or not associated and so there are no
known upper or lower bounds. */
static void
2000-07-30 03:48:28 +02:00
f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
int show, int passed_a_ptr, int demangled_args,
2019-03-01 12:12:33 +01:00
int arrayprint_recurse_level, bool print_rank_only)
{
/* No static variables are permitted as an error call may occur during
execution of this function. */
if (type == 0)
return;
if (TYPE_NAME (type) && show <= 0)
return;
QUIT;
switch (type->code ())
{
case TYPE_CODE_ARRAY:
arrayprint_recurse_level++;
if (arrayprint_recurse_level == 1)
1999-07-07 22:19:36 +02:00
fprintf_filtered (stream, "(");
fort_dyn_array: add basic fortran dyn array support Fortran provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is: * to read allocated/associated DWARF tags and store them in the dynamic property list of main_type. * enable GDB to print the value of a dynamic array in Fortran in case the type is allocated or associated (pointer to dynamic array). Examples: (gdb) p vla_not_allocated $1 = <not allocated> (gdb) p vla_allocated $1 = (1, 2, 3) (gdb) p vla_ptr_not_associated $1 = <not associated> (gdb) p vla_ptr_associated $1 = (1, 2, 3) Add basic test coverage for most dynamic array use-cases in Fortran. The commit contains the following tests: * Ensure that values of Fortran dynamic arrays can be evaluated correctly in various ways and states. * Ensure that Fortran primitives can be evaluated correctly when used as a dynamic array. * Dynamic arrays passed to subroutines and handled in different ways inside the routine. * Ensure that the ptype of dynamic arrays in Fortran can be printed in GDB correctly. * Ensure that dynamic arrays in different states (allocated/associated) can be evaluated. * Dynamic arrays passed to functions and returned from functions. * History values of dynamic arrays can be accessed and printed again with the correct values. * Dynamic array evaluations using MI protocol. * Sizeof output of dynamic arrays in various states. The patch was tested using the test suite on Ubuntu 12.04 64bit. gdb/ChangeLog: * dwarf2read.c (set_die_type): Add read of DW_AT_allocated and DW_AT_associated. * f-typeprint.c: New include of typeprint.h (f_print_type): Add check for allocated/associated status of type. (f_type_print_varspec_suffix): Add check for allocated/associated status of type. * gdbtypes.c (create_array_type_with_stride): Add check for valid data location of type in case allocated or associated attributes are set. Length of an array should be only calculated if allocated or associated is resolved as true. (is_dynamic_type_internal): Add check for allocated/ associated. (resolve_dynamic_array): Evaluate allocated/associated properties. * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED> <DYN_PROP_ASSOCIATED>: New enums. (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros. (type_not_allocated): New function. (type_not_associated): New function. * valarith.c (value_subscripted_rvalue): Add check for allocated/associated. * valprint.c: New include of typeprint.h. (valprint_check_validity): Add check for allocated/associated. (value_check_printable): Add check for allocated/ associated. * typeprint.h (val_print_not_allocated): New function. (val_print_not_associated): New function. * typeprint.c (val_print_not_allocated): New function. (val_print_not_associated): New function. gdb/testsuite/ChangeLog: * gdb.fortran/vla-alloc-assoc.exp: New file. * gdb.fortran/vla-datatypes.exp: New file. * gdb.fortran/vla-datatypes.f90: New file. * gdb.fortran/vla-history.exp: New file. * gdb.fortran/vla-ptype-sub.exp: New file. * gdb.fortran/vla-ptype.exp: New file. * gdb.fortran/vla-sizeof.exp: New file. * gdb.fortran/vla-sub.f90: New file. * gdb.fortran/vla-value-sub-arbitrary.exp: New file. * gdb.fortran/vla-value-sub-finish.exp: New file. * gdb.fortran/vla-value-sub.exp: New file. * gdb.fortran/vla-value.exp: New file. * gdb.fortran/vla-ptr-info.exp: New file. * gdb.mi/mi-vla-fortran.exp: New file. * gdb.mi/vla.f90: New file.
2015-10-21 21:32:30 +02:00
if (type_not_associated (type))
2019-03-01 12:12:33 +01:00
print_rank_only = true;
fort_dyn_array: add basic fortran dyn array support Fortran provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is: * to read allocated/associated DWARF tags and store them in the dynamic property list of main_type. * enable GDB to print the value of a dynamic array in Fortran in case the type is allocated or associated (pointer to dynamic array). Examples: (gdb) p vla_not_allocated $1 = <not allocated> (gdb) p vla_allocated $1 = (1, 2, 3) (gdb) p vla_ptr_not_associated $1 = <not associated> (gdb) p vla_ptr_associated $1 = (1, 2, 3) Add basic test coverage for most dynamic array use-cases in Fortran. The commit contains the following tests: * Ensure that values of Fortran dynamic arrays can be evaluated correctly in various ways and states. * Ensure that Fortran primitives can be evaluated correctly when used as a dynamic array. * Dynamic arrays passed to subroutines and handled in different ways inside the routine. * Ensure that the ptype of dynamic arrays in Fortran can be printed in GDB correctly. * Ensure that dynamic arrays in different states (allocated/associated) can be evaluated. * Dynamic arrays passed to functions and returned from functions. * History values of dynamic arrays can be accessed and printed again with the correct values. * Dynamic array evaluations using MI protocol. * Sizeof output of dynamic arrays in various states. The patch was tested using the test suite on Ubuntu 12.04 64bit. gdb/ChangeLog: * dwarf2read.c (set_die_type): Add read of DW_AT_allocated and DW_AT_associated. * f-typeprint.c: New include of typeprint.h (f_print_type): Add check for allocated/associated status of type. (f_type_print_varspec_suffix): Add check for allocated/associated status of type. * gdbtypes.c (create_array_type_with_stride): Add check for valid data location of type in case allocated or associated attributes are set. Length of an array should be only calculated if allocated or associated is resolved as true. (is_dynamic_type_internal): Add check for allocated/ associated. (resolve_dynamic_array): Evaluate allocated/associated properties. * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED> <DYN_PROP_ASSOCIATED>: New enums. (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros. (type_not_allocated): New function. (type_not_associated): New function. * valarith.c (value_subscripted_rvalue): Add check for allocated/associated. * valprint.c: New include of typeprint.h. (valprint_check_validity): Add check for allocated/associated. (value_check_printable): Add check for allocated/ associated. * typeprint.h (val_print_not_allocated): New function. (val_print_not_associated): New function. * typeprint.c (val_print_not_allocated): New function. (val_print_not_associated): New function. gdb/testsuite/ChangeLog: * gdb.fortran/vla-alloc-assoc.exp: New file. * gdb.fortran/vla-datatypes.exp: New file. * gdb.fortran/vla-datatypes.f90: New file. * gdb.fortran/vla-history.exp: New file. * gdb.fortran/vla-ptype-sub.exp: New file. * gdb.fortran/vla-ptype.exp: New file. * gdb.fortran/vla-sizeof.exp: New file. * gdb.fortran/vla-sub.f90: New file. * gdb.fortran/vla-value-sub-arbitrary.exp: New file. * gdb.fortran/vla-value-sub-finish.exp: New file. * gdb.fortran/vla-value-sub.exp: New file. * gdb.fortran/vla-value.exp: New file. * gdb.fortran/vla-ptr-info.exp: New file. * gdb.mi/mi-vla-fortran.exp: New file. * gdb.mi/vla.f90: New file.
2015-10-21 21:32:30 +02:00
else if (type_not_allocated (type))
2019-03-01 12:12:33 +01:00
print_rank_only = true;
else if ((TYPE_ASSOCIATED_PROP (type)
&& PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ASSOCIATED_PROP (type)))
|| (TYPE_ALLOCATED_PROP (type)
&& PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type)))
|| (TYPE_DATA_LOCATION (type)
&& PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_DATA_LOCATION (type))))
{
/* This case exist when we ptype a typename which has the dynamic
properties but cannot be resolved as there is no object. */
print_rank_only = true;
}
fort_dyn_array: add basic fortran dyn array support Fortran provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is: * to read allocated/associated DWARF tags and store them in the dynamic property list of main_type. * enable GDB to print the value of a dynamic array in Fortran in case the type is allocated or associated (pointer to dynamic array). Examples: (gdb) p vla_not_allocated $1 = <not allocated> (gdb) p vla_allocated $1 = (1, 2, 3) (gdb) p vla_ptr_not_associated $1 = <not associated> (gdb) p vla_ptr_associated $1 = (1, 2, 3) Add basic test coverage for most dynamic array use-cases in Fortran. The commit contains the following tests: * Ensure that values of Fortran dynamic arrays can be evaluated correctly in various ways and states. * Ensure that Fortran primitives can be evaluated correctly when used as a dynamic array. * Dynamic arrays passed to subroutines and handled in different ways inside the routine. * Ensure that the ptype of dynamic arrays in Fortran can be printed in GDB correctly. * Ensure that dynamic arrays in different states (allocated/associated) can be evaluated. * Dynamic arrays passed to functions and returned from functions. * History values of dynamic arrays can be accessed and printed again with the correct values. * Dynamic array evaluations using MI protocol. * Sizeof output of dynamic arrays in various states. The patch was tested using the test suite on Ubuntu 12.04 64bit. gdb/ChangeLog: * dwarf2read.c (set_die_type): Add read of DW_AT_allocated and DW_AT_associated. * f-typeprint.c: New include of typeprint.h (f_print_type): Add check for allocated/associated status of type. (f_type_print_varspec_suffix): Add check for allocated/associated status of type. * gdbtypes.c (create_array_type_with_stride): Add check for valid data location of type in case allocated or associated attributes are set. Length of an array should be only calculated if allocated or associated is resolved as true. (is_dynamic_type_internal): Add check for allocated/ associated. (resolve_dynamic_array): Evaluate allocated/associated properties. * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED> <DYN_PROP_ASSOCIATED>: New enums. (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros. (type_not_allocated): New function. (type_not_associated): New function. * valarith.c (value_subscripted_rvalue): Add check for allocated/associated. * valprint.c: New include of typeprint.h. (valprint_check_validity): Add check for allocated/associated. (value_check_printable): Add check for allocated/ associated. * typeprint.h (val_print_not_allocated): New function. (val_print_not_associated): New function. * typeprint.c (val_print_not_allocated): New function. (val_print_not_associated): New function. gdb/testsuite/ChangeLog: * gdb.fortran/vla-alloc-assoc.exp: New file. * gdb.fortran/vla-datatypes.exp: New file. * gdb.fortran/vla-datatypes.f90: New file. * gdb.fortran/vla-history.exp: New file. * gdb.fortran/vla-ptype-sub.exp: New file. * gdb.fortran/vla-ptype.exp: New file. * gdb.fortran/vla-sizeof.exp: New file. * gdb.fortran/vla-sub.f90: New file. * gdb.fortran/vla-value-sub-arbitrary.exp: New file. * gdb.fortran/vla-value-sub-finish.exp: New file. * gdb.fortran/vla-value-sub.exp: New file. * gdb.fortran/vla-value.exp: New file. * gdb.fortran/vla-ptr-info.exp: New file. * gdb.mi/mi-vla-fortran.exp: New file. * gdb.mi/vla.f90: New file.
2015-10-21 21:32:30 +02:00
if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY)
2019-03-01 12:12:33 +01:00
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
0, 0, arrayprint_recurse_level,
print_rank_only);
Allow really large fortran array bounds: fortran type/value printers This is the fortran part of the patch, including tests, which are essentially unchanged from Siddhesh's original 2012 submission: https://sourceware.org/ml/gdb-patches/2012-08/msg00562.html There is, however, one large departure. In the above thread, Jan pointed out problems with GCC debuginfo for -m32 builds (filed usptream as gcc/54934). After investigating the issue, I am dropping the hand-tweaked assembler source file to workaround this case. While I would normally do something to accommodate this, in this case, given the ubiquity of 64-bit systems today (where the tests pass) and the apparent lack of urgency on the compiler side (by users), I don't think the additional complexity and maintenance costs are worth it. It will be very routinely tested on 64-bit systems. [For example, at Red Hat, we always test -m64 and -m32 configurations for all GDB releases.] gdb/ChangeLog: From Siddhesh Poyarekar: * f-lang.h (f77_get_upperbound): Return LONGEST. (f77_get_lowerbound): Likewise. * f-typeprint.c (f_type_print_varspec_suffix): Expand UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format print them. (f_type_print_base): Expand UPPER_BOUND to LONGEST. Use plongest to format print it. * f-valprint.c (f77_get_lowerbound): Return LONGEST. (f77_get_upperbound): Likewise. (f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND, LOWER_BOUND to LONGEST. (f77_create_arrayprint_offset_tbl): Likewise. gdb/testsuite/ChangeLog: * gdb.fortran/array-bounds.exp: New file. * gdb.fortran/array-bounds.f90: New file.
2019-03-29 18:15:38 +01:00
2019-03-01 12:12:33 +01:00
if (print_rank_only)
fprintf_filtered (stream, ":");
else
{
LONGEST lower_bound = f77_get_lowerbound (type);
if (lower_bound != 1) /* Not the default. */
Allow really large fortran array bounds: fortran type/value printers This is the fortran part of the patch, including tests, which are essentially unchanged from Siddhesh's original 2012 submission: https://sourceware.org/ml/gdb-patches/2012-08/msg00562.html There is, however, one large departure. In the above thread, Jan pointed out problems with GCC debuginfo for -m32 builds (filed usptream as gcc/54934). After investigating the issue, I am dropping the hand-tweaked assembler source file to workaround this case. While I would normally do something to accommodate this, in this case, given the ubiquity of 64-bit systems today (where the tests pass) and the apparent lack of urgency on the compiler side (by users), I don't think the additional complexity and maintenance costs are worth it. It will be very routinely tested on 64-bit systems. [For example, at Red Hat, we always test -m64 and -m32 configurations for all GDB releases.] gdb/ChangeLog: From Siddhesh Poyarekar: * f-lang.h (f77_get_upperbound): Return LONGEST. (f77_get_lowerbound): Likewise. * f-typeprint.c (f_type_print_varspec_suffix): Expand UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format print them. (f_type_print_base): Expand UPPER_BOUND to LONGEST. Use plongest to format print it. * f-valprint.c (f77_get_lowerbound): Return LONGEST. (f77_get_upperbound): Likewise. (f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND, LOWER_BOUND to LONGEST. (f77_create_arrayprint_offset_tbl): Likewise. gdb/testsuite/ChangeLog: * gdb.fortran/array-bounds.exp: New file. * gdb.fortran/array-bounds.f90: New file.
2019-03-29 18:15:38 +01:00
fprintf_filtered (stream, "%s:", plongest (lower_bound));
fort_dyn_array: add basic fortran dyn array support Fortran provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is: * to read allocated/associated DWARF tags and store them in the dynamic property list of main_type. * enable GDB to print the value of a dynamic array in Fortran in case the type is allocated or associated (pointer to dynamic array). Examples: (gdb) p vla_not_allocated $1 = <not allocated> (gdb) p vla_allocated $1 = (1, 2, 3) (gdb) p vla_ptr_not_associated $1 = <not associated> (gdb) p vla_ptr_associated $1 = (1, 2, 3) Add basic test coverage for most dynamic array use-cases in Fortran. The commit contains the following tests: * Ensure that values of Fortran dynamic arrays can be evaluated correctly in various ways and states. * Ensure that Fortran primitives can be evaluated correctly when used as a dynamic array. * Dynamic arrays passed to subroutines and handled in different ways inside the routine. * Ensure that the ptype of dynamic arrays in Fortran can be printed in GDB correctly. * Ensure that dynamic arrays in different states (allocated/associated) can be evaluated. * Dynamic arrays passed to functions and returned from functions. * History values of dynamic arrays can be accessed and printed again with the correct values. * Dynamic array evaluations using MI protocol. * Sizeof output of dynamic arrays in various states. The patch was tested using the test suite on Ubuntu 12.04 64bit. gdb/ChangeLog: * dwarf2read.c (set_die_type): Add read of DW_AT_allocated and DW_AT_associated. * f-typeprint.c: New include of typeprint.h (f_print_type): Add check for allocated/associated status of type. (f_type_print_varspec_suffix): Add check for allocated/associated status of type. * gdbtypes.c (create_array_type_with_stride): Add check for valid data location of type in case allocated or associated attributes are set. Length of an array should be only calculated if allocated or associated is resolved as true. (is_dynamic_type_internal): Add check for allocated/ associated. (resolve_dynamic_array): Evaluate allocated/associated properties. * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED> <DYN_PROP_ASSOCIATED>: New enums. (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros. (type_not_allocated): New function. (type_not_associated): New function. * valarith.c (value_subscripted_rvalue): Add check for allocated/associated. * valprint.c: New include of typeprint.h. (valprint_check_validity): Add check for allocated/associated. (value_check_printable): Add check for allocated/ associated. * typeprint.h (val_print_not_allocated): New function. (val_print_not_associated): New function. * typeprint.c (val_print_not_allocated): New function. (val_print_not_associated): New function. gdb/testsuite/ChangeLog: * gdb.fortran/vla-alloc-assoc.exp: New file. * gdb.fortran/vla-datatypes.exp: New file. * gdb.fortran/vla-datatypes.f90: New file. * gdb.fortran/vla-history.exp: New file. * gdb.fortran/vla-ptype-sub.exp: New file. * gdb.fortran/vla-ptype.exp: New file. * gdb.fortran/vla-sizeof.exp: New file. * gdb.fortran/vla-sub.f90: New file. * gdb.fortran/vla-value-sub-arbitrary.exp: New file. * gdb.fortran/vla-value-sub-finish.exp: New file. * gdb.fortran/vla-value-sub.exp: New file. * gdb.fortran/vla-value.exp: New file. * gdb.fortran/vla-ptr-info.exp: New file. * gdb.mi/mi-vla-fortran.exp: New file. * gdb.mi/vla.f90: New file.
2015-10-21 21:32:30 +02:00
2019-03-01 12:12:33 +01:00
/* Make sure that, if we have an assumed size array, we
print out a warning and print the upperbound as '*'. */
fort_dyn_array: add basic fortran dyn array support Fortran provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is: * to read allocated/associated DWARF tags and store them in the dynamic property list of main_type. * enable GDB to print the value of a dynamic array in Fortran in case the type is allocated or associated (pointer to dynamic array). Examples: (gdb) p vla_not_allocated $1 = <not allocated> (gdb) p vla_allocated $1 = (1, 2, 3) (gdb) p vla_ptr_not_associated $1 = <not associated> (gdb) p vla_ptr_associated $1 = (1, 2, 3) Add basic test coverage for most dynamic array use-cases in Fortran. The commit contains the following tests: * Ensure that values of Fortran dynamic arrays can be evaluated correctly in various ways and states. * Ensure that Fortran primitives can be evaluated correctly when used as a dynamic array. * Dynamic arrays passed to subroutines and handled in different ways inside the routine. * Ensure that the ptype of dynamic arrays in Fortran can be printed in GDB correctly. * Ensure that dynamic arrays in different states (allocated/associated) can be evaluated. * Dynamic arrays passed to functions and returned from functions. * History values of dynamic arrays can be accessed and printed again with the correct values. * Dynamic array evaluations using MI protocol. * Sizeof output of dynamic arrays in various states. The patch was tested using the test suite on Ubuntu 12.04 64bit. gdb/ChangeLog: * dwarf2read.c (set_die_type): Add read of DW_AT_allocated and DW_AT_associated. * f-typeprint.c: New include of typeprint.h (f_print_type): Add check for allocated/associated status of type. (f_type_print_varspec_suffix): Add check for allocated/associated status of type. * gdbtypes.c (create_array_type_with_stride): Add check for valid data location of type in case allocated or associated attributes are set. Length of an array should be only calculated if allocated or associated is resolved as true. (is_dynamic_type_internal): Add check for allocated/ associated. (resolve_dynamic_array): Evaluate allocated/associated properties. * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED> <DYN_PROP_ASSOCIATED>: New enums. (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros. (type_not_allocated): New function. (type_not_associated): New function. * valarith.c (value_subscripted_rvalue): Add check for allocated/associated. * valprint.c: New include of typeprint.h. (valprint_check_validity): Add check for allocated/associated. (value_check_printable): Add check for allocated/ associated. * typeprint.h (val_print_not_allocated): New function. (val_print_not_associated): New function. * typeprint.c (val_print_not_allocated): New function. (val_print_not_associated): New function. gdb/testsuite/ChangeLog: * gdb.fortran/vla-alloc-assoc.exp: New file. * gdb.fortran/vla-datatypes.exp: New file. * gdb.fortran/vla-datatypes.f90: New file. * gdb.fortran/vla-history.exp: New file. * gdb.fortran/vla-ptype-sub.exp: New file. * gdb.fortran/vla-ptype.exp: New file. * gdb.fortran/vla-sizeof.exp: New file. * gdb.fortran/vla-sub.f90: New file. * gdb.fortran/vla-value-sub-arbitrary.exp: New file. * gdb.fortran/vla-value-sub-finish.exp: New file. * gdb.fortran/vla-value-sub.exp: New file. * gdb.fortran/vla-value.exp: New file. * gdb.fortran/vla-ptr-info.exp: New file. * gdb.mi/mi-vla-fortran.exp: New file. * gdb.mi/vla.f90: New file.
2015-10-21 21:32:30 +02:00
2019-03-01 12:12:33 +01:00
if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
fprintf_filtered (stream, "*");
else
{
LONGEST upper_bound = f77_get_upperbound (type);
Allow really large fortran array bounds: fortran type/value printers This is the fortran part of the patch, including tests, which are essentially unchanged from Siddhesh's original 2012 submission: https://sourceware.org/ml/gdb-patches/2012-08/msg00562.html There is, however, one large departure. In the above thread, Jan pointed out problems with GCC debuginfo for -m32 builds (filed usptream as gcc/54934). After investigating the issue, I am dropping the hand-tweaked assembler source file to workaround this case. While I would normally do something to accommodate this, in this case, given the ubiquity of 64-bit systems today (where the tests pass) and the apparent lack of urgency on the compiler side (by users), I don't think the additional complexity and maintenance costs are worth it. It will be very routinely tested on 64-bit systems. [For example, at Red Hat, we always test -m64 and -m32 configurations for all GDB releases.] gdb/ChangeLog: From Siddhesh Poyarekar: * f-lang.h (f77_get_upperbound): Return LONGEST. (f77_get_lowerbound): Likewise. * f-typeprint.c (f_type_print_varspec_suffix): Expand UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format print them. (f_type_print_base): Expand UPPER_BOUND to LONGEST. Use plongest to format print it. * f-valprint.c (f77_get_lowerbound): Return LONGEST. (f77_get_upperbound): Likewise. (f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND, LOWER_BOUND to LONGEST. (f77_create_arrayprint_offset_tbl): Likewise. gdb/testsuite/ChangeLog: * gdb.fortran/array-bounds.exp: New file. * gdb.fortran/array-bounds.f90: New file.
2019-03-29 18:15:38 +01:00
fputs_filtered (plongest (upper_bound), stream);
2019-03-01 12:12:33 +01:00
}
}
if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_ARRAY)
2019-03-01 12:12:33 +01:00
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
0, 0, arrayprint_recurse_level,
print_rank_only);
fort_dyn_array: add basic fortran dyn array support Fortran provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is: * to read allocated/associated DWARF tags and store them in the dynamic property list of main_type. * enable GDB to print the value of a dynamic array in Fortran in case the type is allocated or associated (pointer to dynamic array). Examples: (gdb) p vla_not_allocated $1 = <not allocated> (gdb) p vla_allocated $1 = (1, 2, 3) (gdb) p vla_ptr_not_associated $1 = <not associated> (gdb) p vla_ptr_associated $1 = (1, 2, 3) Add basic test coverage for most dynamic array use-cases in Fortran. The commit contains the following tests: * Ensure that values of Fortran dynamic arrays can be evaluated correctly in various ways and states. * Ensure that Fortran primitives can be evaluated correctly when used as a dynamic array. * Dynamic arrays passed to subroutines and handled in different ways inside the routine. * Ensure that the ptype of dynamic arrays in Fortran can be printed in GDB correctly. * Ensure that dynamic arrays in different states (allocated/associated) can be evaluated. * Dynamic arrays passed to functions and returned from functions. * History values of dynamic arrays can be accessed and printed again with the correct values. * Dynamic array evaluations using MI protocol. * Sizeof output of dynamic arrays in various states. The patch was tested using the test suite on Ubuntu 12.04 64bit. gdb/ChangeLog: * dwarf2read.c (set_die_type): Add read of DW_AT_allocated and DW_AT_associated. * f-typeprint.c: New include of typeprint.h (f_print_type): Add check for allocated/associated status of type. (f_type_print_varspec_suffix): Add check for allocated/associated status of type. * gdbtypes.c (create_array_type_with_stride): Add check for valid data location of type in case allocated or associated attributes are set. Length of an array should be only calculated if allocated or associated is resolved as true. (is_dynamic_type_internal): Add check for allocated/ associated. (resolve_dynamic_array): Evaluate allocated/associated properties. * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED> <DYN_PROP_ASSOCIATED>: New enums. (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros. (type_not_allocated): New function. (type_not_associated): New function. * valarith.c (value_subscripted_rvalue): Add check for allocated/associated. * valprint.c: New include of typeprint.h. (valprint_check_validity): Add check for allocated/associated. (value_check_printable): Add check for allocated/ associated. * typeprint.h (val_print_not_allocated): New function. (val_print_not_associated): New function. * typeprint.c (val_print_not_allocated): New function. (val_print_not_associated): New function. gdb/testsuite/ChangeLog: * gdb.fortran/vla-alloc-assoc.exp: New file. * gdb.fortran/vla-datatypes.exp: New file. * gdb.fortran/vla-datatypes.f90: New file. * gdb.fortran/vla-history.exp: New file. * gdb.fortran/vla-ptype-sub.exp: New file. * gdb.fortran/vla-ptype.exp: New file. * gdb.fortran/vla-sizeof.exp: New file. * gdb.fortran/vla-sub.f90: New file. * gdb.fortran/vla-value-sub-arbitrary.exp: New file. * gdb.fortran/vla-value-sub-finish.exp: New file. * gdb.fortran/vla-value-sub.exp: New file. * gdb.fortran/vla-value.exp: New file. * gdb.fortran/vla-ptr-info.exp: New file. * gdb.mi/mi-vla-fortran.exp: New file. * gdb.mi/vla.f90: New file.
2015-10-21 21:32:30 +02:00
if (arrayprint_recurse_level == 1)
fprintf_filtered (stream, ")");
else
1999-07-07 22:19:36 +02:00
fprintf_filtered (stream, ",");
arrayprint_recurse_level--;
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0,
2019-03-01 12:12:33 +01:00
arrayprint_recurse_level, false);
fprintf_filtered (stream, " )");
break;
case TYPE_CODE_FUNC:
{
int i, nfields = TYPE_NFIELDS (type);
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
2019-03-01 12:12:33 +01:00
passed_a_ptr, 0,
arrayprint_recurse_level, false);
if (passed_a_ptr)
fprintf_filtered (stream, ") ");
fprintf_filtered (stream, "(");
if (nfields == 0 && TYPE_PROTOTYPED (type))
f_print_type (builtin_f_type (get_type_arch (type))->builtin_void,
"", stream, -1, 0, 0);
else
for (i = 0; i < nfields; i++)
{
if (i > 0)
{
fputs_filtered (", ", stream);
wrap_here (" ");
}
f_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0, 0);
}
fprintf_filtered (stream, ")");
}
break;
case TYPE_CODE_UNDEF:
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_ENUM:
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
case TYPE_CODE_VOID:
case TYPE_CODE_ERROR:
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
case TYPE_CODE_METHOD:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types do not need a suffix. They are listed so that
1999-07-07 22:19:36 +02:00
gcc -Wall will report types that may not have been considered. */
break;
}
}
/* Print the name of the type (or the ultimate pointer target,
function value or array element), or the description of a
structure or union.
SHOW nonzero means don't print this type as just its name;
show its real definition even if it has a name.
SHOW zero means print just typename or struct tag if there is one
SHOW negative means abbreviate structure elements.
SHOW is decremented for printing of structure elements.
LEVEL is the depth to indent by.
We increase it for some recursive calls. */
void
2000-07-30 03:48:28 +02:00
f_type_print_base (struct type *type, struct ui_file *stream, int show,
int level)
{
int index;
QUIT;
wrap_here (" ");
if (type == NULL)
{
Introduce metadata style This introduces a new "metadata" style and changes many places in gdb to use it. The idea here is to let the user distinguish gdb output from output that (conceptually at least) comes directly from the inferior. The newly-styled category includes text that gdb traditionally surrounds in "<...>", like "<unavailable>". I only added a single test for this. In many cases this output is difficult to test. Also, while developing this errors in the implementation of the new printf formats showed up as regressions. gdb/ChangeLog 2019-10-01 Tom Tromey <tom@tromey.com> * p-lang.c (pascal_printstr): Use metadata style. * value.c (show_convenience): Use metadata style. * valprint.c (valprint_check_validity, val_print_optimized_out) (val_print_not_saved, val_print_unavailable) (val_print_invalid_address, generic_val_print, val_print) (value_check_printable, val_print_array_elements): Use metadata style. * ui-out.h (class ui_out) <field_fmt>: New overload. <do_field_fmt>: Add style parameter. * ui-out.c (ui_out::field_fmt): New overload. * typeprint.c (type_print_unknown_return_type) (val_print_not_allocated, val_print_not_associated): Use metadata style. * tui/tui-out.h (class tui_ui_out) <do_field_fmt>: Add style parameter. * tui/tui-out.c (tui_ui_out::do_field_fmt): Update. * tracepoint.c (tvariables_info_1): Use metadata style. * stack.c (print_frame_arg, print_frame_info, print_frame) (info_frame_command_core): Use metadata style. * skip.c (info_skip_command): Use metadata style. * rust-lang.c (rust_print_enum): Use metadata style. * python/py-prettyprint.c (print_stack_unless_memory_error): Use metadata style. * python/py-framefilter.c (py_print_single_arg): Use metadata style. * printcmd.c (do_one_display, print_variable_and_value): Use metadata style. * p-valprint.c (pascal_val_print) (pascal_object_print_value_fields): Use metadata style. * p-typeprint.c (pascal_type_print_base): Use metadata style. * mi/mi-out.h (class mi_ui_out) <do_field_fmt>: Add style parameter. * mi/mi-out.c (mi_ui_out::do_field_fmt): Update. * m2-valprint.c (m2_print_long_set): Use metadata style. * m2-typeprint.c (m2_print_type): Use metadata style. * infcmd.c (print_return_value_1): Use metadata style. * gnu-v3-abi.c (print_one_vtable): Use metadata style. * f-valprint.c (info_common_command_for_block): Use metadata style. * f-typeprint.c (f_type_print_base): Use metadata style. * expprint.c (print_subexp_standard): Use metadata style. * cp-valprint.c (cp_print_value_fields): Use metadata style. * cli/cli-style.h (class cli_style_option): Add constructor. (metadata_style): Declare. * cli/cli-style.c (metadata_style): New global. (_initialize_cli_style): Register metadata style. * cli-out.h (class cli_ui_out) <do_field_fmt>: Add style parameter. * cli-out.c (cli_ui_out::do_field_fmt): Update. * c-typeprint.c (c_type_print_base_struct_union) (c_type_print_base_1): Use metadata style. * breakpoint.c (watchpoint_value_print) (print_one_breakpoint_location): Use metadata style. * break-catch-syscall.c (print_one_catch_syscall): Use metadata style. * break-catch-sig.c (signal_catchpoint_print_one): Use metadata style. * ada-valprint.c (val_print_packed_array_elements, printstr) (print_field_values, ada_val_print_ref, ada_val_print): Use metadata style. * ada-typeprint.c (print_array_type, ada_print_type): Use metadata style. * ada-tasks.c (print_ada_task_info, info_task): Use metadata style. * ada-lang.c (user_select_syms): Use metadata style. gdb/testsuite/ChangeLog 2019-10-01 Tom Tromey <tom@tromey.com> * lib/gdb-utils.exp (style): Handle "metadata" argument. * gdb.base/style.exp: Add metadata style test.
2019-04-03 04:00:18 +02:00
fputs_styled ("<type unknown>", metadata_style.style (), stream);
return;
}
/* When SHOW is zero or less, and there is a valid type name, then always
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
just print the type name directly from the type. */
if ((show <= 0) && (TYPE_NAME (type) != NULL))
{
Remove TYPE_TAG_NAME TYPE_TAG_NAME has been an occasional source of confusion and bugs. It seems to me that it is only useful for C and C++ -- but even there, not so much, because at least with DWARF there doesn't seem to be any way to wind up with a type where the name and the tag name are both non-NULL and different. So, this patch removes TYPE_TAG_NAME entirely. This should save a little memory, but more importantly, it simplifies this part of gdb. A few minor test suite adjustments were needed. In some situations the new code does not yield identical output to the old code. gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * valops.c (enum_constant_from_type, value_namespace_elt) (value_maybe_namespace_elt): Update. * valarith.c (find_size_for_pointer_math): Update. * target-descriptions.c (make_gdb_type): Update. * symmisc.c (print_symbol): Update. * stabsread.c (define_symbol, read_type) (complain_about_struct_wipeout, add_undefined_type) (cleanup_undefined_types_1): Update. * rust-lang.c (rust_tuple_type_p, rust_slice_type_p) (rust_range_type_p, val_print_struct, rust_print_struct_def) (rust_internal_print_type, rust_composite_type) (rust_evaluate_funcall, rust_evaluate_subexp) (rust_inclusive_range_type_p): Update. * python/py-type.c (typy_get_tag): Update. * p-typeprint.c (pascal_type_print_base): Update. * mdebugread.c (parse_symbol, parse_type): Update. * m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum): Update. * guile/scm-type.c (gdbscm_type_tag): Update. * go-lang.c (sixg_string_p): Update. * gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type): Update. * gdbtypes.h (struct main_type) <tag_name>: Remove. (TYPE_TAG_NAME): Remove. * gdbtypes.c (type_name_no_tag): Simplify. (check_typedef, check_types_equal, recursive_dump_type) (copy_type_recursive, arch_composite_type): Update. * f-typeprint.c (f_type_print_base): Update. Print "Type" prefix in summary mode when needed. * eval.c (evaluate_funcall): Update. * dwarf2read.c (fixup_go_packaging, read_structure_type) (process_structure_scope, read_enumeration_type) (read_namespace_type, read_module_type, determine_prefix): Update. * cp-support.c (inspect_type): Update. * coffread.c (process_coff_symbol, decode_base_type): Update. * c-varobj.c (c_is_path_expr_parent): Update. * c-typeprint.c (c_type_print_base_struct_union): Update. (c_type_print_base_1): Update. Print struct/class/union/enum in summary when using C language. * ax-gdb.c (gen_struct_ref, gen_namespace_elt) (gen_maybe_namespace_elt): Update. * ada-lang.c (ada_type_name): Simplify. (empty_record, ada_template_to_fixed_record_type_1) (template_to_static_fixed_type) (to_record_with_fixed_variant_part, ada_check_typedef): Update. gdb/testsuite/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * gdb.xml/tdesc-regs.exp (load_description): Update expected results. * gdb.dwarf2/method-ptr.exp: Set language to C++. * gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++. * gdb.cp/typeid.exp (do_typeid_tests): Update type_re. * gdb.base/maint.exp (maint_pass_if): Update.
2018-04-17 21:51:24 +02:00
const char *prefix = "";
if (type->code () == TYPE_CODE_UNION)
Remove TYPE_TAG_NAME TYPE_TAG_NAME has been an occasional source of confusion and bugs. It seems to me that it is only useful for C and C++ -- but even there, not so much, because at least with DWARF there doesn't seem to be any way to wind up with a type where the name and the tag name are both non-NULL and different. So, this patch removes TYPE_TAG_NAME entirely. This should save a little memory, but more importantly, it simplifies this part of gdb. A few minor test suite adjustments were needed. In some situations the new code does not yield identical output to the old code. gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * valops.c (enum_constant_from_type, value_namespace_elt) (value_maybe_namespace_elt): Update. * valarith.c (find_size_for_pointer_math): Update. * target-descriptions.c (make_gdb_type): Update. * symmisc.c (print_symbol): Update. * stabsread.c (define_symbol, read_type) (complain_about_struct_wipeout, add_undefined_type) (cleanup_undefined_types_1): Update. * rust-lang.c (rust_tuple_type_p, rust_slice_type_p) (rust_range_type_p, val_print_struct, rust_print_struct_def) (rust_internal_print_type, rust_composite_type) (rust_evaluate_funcall, rust_evaluate_subexp) (rust_inclusive_range_type_p): Update. * python/py-type.c (typy_get_tag): Update. * p-typeprint.c (pascal_type_print_base): Update. * mdebugread.c (parse_symbol, parse_type): Update. * m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum): Update. * guile/scm-type.c (gdbscm_type_tag): Update. * go-lang.c (sixg_string_p): Update. * gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type): Update. * gdbtypes.h (struct main_type) <tag_name>: Remove. (TYPE_TAG_NAME): Remove. * gdbtypes.c (type_name_no_tag): Simplify. (check_typedef, check_types_equal, recursive_dump_type) (copy_type_recursive, arch_composite_type): Update. * f-typeprint.c (f_type_print_base): Update. Print "Type" prefix in summary mode when needed. * eval.c (evaluate_funcall): Update. * dwarf2read.c (fixup_go_packaging, read_structure_type) (process_structure_scope, read_enumeration_type) (read_namespace_type, read_module_type, determine_prefix): Update. * cp-support.c (inspect_type): Update. * coffread.c (process_coff_symbol, decode_base_type): Update. * c-varobj.c (c_is_path_expr_parent): Update. * c-typeprint.c (c_type_print_base_struct_union): Update. (c_type_print_base_1): Update. Print struct/class/union/enum in summary when using C language. * ax-gdb.c (gen_struct_ref, gen_namespace_elt) (gen_maybe_namespace_elt): Update. * ada-lang.c (ada_type_name): Simplify. (empty_record, ada_template_to_fixed_record_type_1) (template_to_static_fixed_type) (to_record_with_fixed_variant_part, ada_check_typedef): Update. gdb/testsuite/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * gdb.xml/tdesc-regs.exp (load_description): Update expected results. * gdb.dwarf2/method-ptr.exp: Set language to C++. * gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++. * gdb.cp/typeid.exp (do_typeid_tests): Update type_re. * gdb.base/maint.exp (maint_pass_if): Update.
2018-04-17 21:51:24 +02:00
prefix = "Type, C_Union :: ";
else if (type->code () == TYPE_CODE_STRUCT)
Remove TYPE_TAG_NAME TYPE_TAG_NAME has been an occasional source of confusion and bugs. It seems to me that it is only useful for C and C++ -- but even there, not so much, because at least with DWARF there doesn't seem to be any way to wind up with a type where the name and the tag name are both non-NULL and different. So, this patch removes TYPE_TAG_NAME entirely. This should save a little memory, but more importantly, it simplifies this part of gdb. A few minor test suite adjustments were needed. In some situations the new code does not yield identical output to the old code. gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * valops.c (enum_constant_from_type, value_namespace_elt) (value_maybe_namespace_elt): Update. * valarith.c (find_size_for_pointer_math): Update. * target-descriptions.c (make_gdb_type): Update. * symmisc.c (print_symbol): Update. * stabsread.c (define_symbol, read_type) (complain_about_struct_wipeout, add_undefined_type) (cleanup_undefined_types_1): Update. * rust-lang.c (rust_tuple_type_p, rust_slice_type_p) (rust_range_type_p, val_print_struct, rust_print_struct_def) (rust_internal_print_type, rust_composite_type) (rust_evaluate_funcall, rust_evaluate_subexp) (rust_inclusive_range_type_p): Update. * python/py-type.c (typy_get_tag): Update. * p-typeprint.c (pascal_type_print_base): Update. * mdebugread.c (parse_symbol, parse_type): Update. * m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum): Update. * guile/scm-type.c (gdbscm_type_tag): Update. * go-lang.c (sixg_string_p): Update. * gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type): Update. * gdbtypes.h (struct main_type) <tag_name>: Remove. (TYPE_TAG_NAME): Remove. * gdbtypes.c (type_name_no_tag): Simplify. (check_typedef, check_types_equal, recursive_dump_type) (copy_type_recursive, arch_composite_type): Update. * f-typeprint.c (f_type_print_base): Update. Print "Type" prefix in summary mode when needed. * eval.c (evaluate_funcall): Update. * dwarf2read.c (fixup_go_packaging, read_structure_type) (process_structure_scope, read_enumeration_type) (read_namespace_type, read_module_type, determine_prefix): Update. * cp-support.c (inspect_type): Update. * coffread.c (process_coff_symbol, decode_base_type): Update. * c-varobj.c (c_is_path_expr_parent): Update. * c-typeprint.c (c_type_print_base_struct_union): Update. (c_type_print_base_1): Update. Print struct/class/union/enum in summary when using C language. * ax-gdb.c (gen_struct_ref, gen_namespace_elt) (gen_maybe_namespace_elt): Update. * ada-lang.c (ada_type_name): Simplify. (empty_record, ada_template_to_fixed_record_type_1) (template_to_static_fixed_type) (to_record_with_fixed_variant_part, ada_check_typedef): Update. gdb/testsuite/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * gdb.xml/tdesc-regs.exp (load_description): Update expected results. * gdb.dwarf2/method-ptr.exp: Set language to C++. * gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++. * gdb.cp/typeid.exp (do_typeid_tests): Update type_re. * gdb.base/maint.exp (maint_pass_if): Update.
2018-04-17 21:51:24 +02:00
prefix = "Type ";
fprintfi_filtered (level, stream, "%s%s", prefix, TYPE_NAME (type));
return;
}
if (type->code () != TYPE_CODE_TYPEDEF)
Remove CHECK_TYPEDEF, use check_typedef instead I think that the CHECK_TYPEDEF macro is not necessary, and even a bit annoying. It makes unclear the fact that the "type" variables gets overwritten. It has actually bitten me a few times. I think the following, explicit form, is better. type = check_typedef (type); This patches changes all instances of CHECK_TYPEDEF for an equivalent call to check_typedef. The bulk of the change was done with this sed: sed -i 's/CHECK_TYPEDEF (\([^)]*\));/\1 = check_typedef (\1);/' <file>.c The ChangeLog was generated using David Malcom's generate_changelog.py. I manually fixed those places where it gets the wrong function name, hopefully all of them. The patch was built-tested, and I ran a few smoke tests. gdb/ChangeLog: * gdbtypes.h (CHECK_TYPEDEF): Remove. * aarch64-tdep.c (aarch64_return_in_memory): Replace CHECK_TYPEDEF with check_typedef. * ada-lang.c (decode_constrained_packed_array_type): Likewise. (ada_array_length): Likewise. (find_parallel_type_by_descriptive_type): Likewise. (ada_check_typedef): Likewise. * arm-tdep.c (arm_return_in_memory): Likewise. * ax-gdb.c (gen_trace_static_fields): Likewise. (gen_struct_ref_recursive): Likewise. * c-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. (variable: block COLONCOLON name): Likewise. (qualified_name: TYPENAME COLONCOLON name): Likewise. * c-lang.c (classify_type): Likewise. * c-typeprint.c (c_print_type): Likewise. (c_print_typedef): Likewise. (c_type_print_base): Likewise. * c-valprint.c (c_val_print): Likewise. * compile/compile-c-types.c (convert_type): Likewise. * compile/compile-object-load.c (get_out_value_type): Likewise. * completer.c (add_struct_fields): Likewise. (expression_completer): Likewise. * cp-namespace.c (cp_find_type_baseclass_by_name): Likewise. (cp_lookup_nested_symbol_1): Likewise. (cp_lookup_nested_symbol): Likewise. * cp-valprint.c (cp_print_value_fields): Likewise. (cp_print_static_field): Likewise. * d-valprint.c (d_val_print): Likewise. * eval.c (evaluate_subexp_standard): Likewise. (evaluate_subexp_for_sizeof): Likewise. * f-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. * f-typeprint.c (f_type_print_base): Likewise. * f-valprint.c (f_val_print): Likewise. * gdbtypes.c (get_discrete_bounds): Likewise. (create_array_type_with_stride): Likewise. (type_name_no_tag_or_error): Likewise. (lookup_struct_elt_type): Likewise. (get_unsigned_type_max): Likewise. (internal_type_vptr_fieldno): Likewise. (set_type_vptr_fieldno): Likewise. (internal_type_vptr_basetype): Likewise. (set_type_vptr_basetype): Likewise. (get_vptr_fieldno): Likewise. (is_integral_type): Likewise. (is_scalar_type): Likewise. (is_scalar_type_recursive): Likewise. (distance_to_ancestor): Likewise. (is_unique_ancestor_worker): Likewise. (check_types_equal): Likewise. * gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise. * gnu-v3-abi.c (gnuv3_dynamic_class): Likewise. (gnuv3_get_vtable): Likewise. (gnuv3_pass_by_reference): Likewise. * go-exp.y (exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY): Likewise. * go-lang.c (gccgo_string_p): Likewise. (go_classify_struct_type): Likewise. * go-typeprint.c (go_print_type): Likewise. * go-valprint.c (go_val_print): Likewise. * guile/scm-math.c (vlscm_binop): Likewise. * guile/scm-value.c (gdbscm_value_dynamic_type): Likewise. (gdbscm_value_to_bytevector): Likewise. (gdbscm_value_to_bool): Likewise. (gdbscm_value_to_integer): Likewise. (gdbscm_value_to_real): Likewise. * infcall.c (call_function_by_hand_dummy): Likewise. * infcmd.c (get_return_value): Likewise. * jv-lang.c (is_object_type): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_print_value_fields): Likewise. (java_val_print): Likewise. * linespec.c (find_methods): Likewise. (collect_one_symbol): Likewise. * m2-typeprint.c (m2_print_type): Likewise. (m2_print_typedef): Likewise. (m2_get_discrete_bounds): Likewise. * m2-valprint.c (m2_print_long_set): Likewise. (m2_print_unbounded_array): Likewise. (m2_print_array_contents): Likewise. (m2_val_print): Likewise. * opencl-lang.c (opencl_print_type): Likewise. * p-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. * p-typeprint.c (pascal_print_type): Likewise. (pascal_print_typedef): Likewise. (pascal_type_print_base): Likewise. * p-valprint.c (pascal_val_print): Likewise. (pascal_object_print_value_fields): Likewise. (pascal_object_print_static_field): Likewise. * python/py-type.c (typy_fields_items): Likewise. (typy_get_composite): Likewise. * python/py-value.c (valpy_get_dynamic_type): Likewise. (valpy_binop): Likewise. (valpy_long): Likewise. (valpy_float): Likewise. * stack.c (return_command): Likewise. * symtab.c (check_field): Likewise. (lookup_symbol_aux): Likewise. * tic6x-tdep.c (tic6x_return_value): Likewise. * typeprint.c (print_type_scalar): Likewise. * valarith.c (value_vector_widen): Likewise. * valops.c (value_cast): Likewise. (value_assign): Likewise. (do_search_struct_field): Likewise. (search_struct_method): Likewise. (find_method_list): Likewise. * valprint.c (val_print_scalar_type_p): Likewise. (valprint_check_validity): Likewise. (generic_val_print): Likewise. * value.c (unpack_double): Likewise. (value_primitive_field): Likewise. (unpack_bits_as_long): Likewise.
2015-07-06 22:05:06 +02:00
type = check_typedef (type);
switch (type->code ())
{
case TYPE_CODE_TYPEDEF:
f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
break;
case TYPE_CODE_ARRAY:
f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
Stop assuming no-debug-info functions return int The fact that GDB defaults to assuming that functions return int, when it has no debug info for the function has been a recurring source of user confusion. Recently this came up on the errno pretty printer discussions. Shortly after, it came up again on IRC, with someone wondering why does getenv() in GDB return a negative int: (gdb) p getenv("PATH") $1 = -6185 This question (with s/getenv/random-other-C-runtime-function) is a FAQ on IRC. The reason for the above is: (gdb) p getenv $2 = {<text variable, no debug info>} 0x7ffff7751d80 <getenv> (gdb) ptype getenv type = int () ... which means that GDB truncated the 64-bit pointer that is actually returned from getent to 32-bit, and then sign-extended it: (gdb) p /x -6185 $6 = 0xffffe7d7 The workaround is to cast the function to the right type, like: (gdb) p ((char *(*) (const char *)) getenv) ("PATH") $3 = 0x7fffffffe7d7 "/usr/local/bin:/"... IMO, we should do better than this. I see the "assume-int" issue the same way I see printing bogus values for optimized-out variables instead of "<optimized out>" -- I'd much rather that the debugger tells me "I don't know" and tells me how to fix it than showing me bogus misleading results, making me go around tilting at windmills. If GDB prints a signed integer when you're expecting a pointer or aggregate, you at least have some sense that something is off, but consider the case of the function actually returning a 64-bit integer. For example, compile this without debug info: unsigned long long function () { return 0x7fffffffffffffff; } Currently, with pristine GDB, you get: (gdb) p function () $1 = -1 # incorrect (gdb) p /x function () $2 = 0xffffffff # incorrect maybe after spending a few hours debugging you suspect something is wrong with that -1, and do: (gdb) ptype function type = int () and maybe, just maybe, you realize that the function actually returns unsigned long long. And you try to fix it with: (gdb) p /x (unsigned long long) function () $3 = 0xffffffffffffffff # incorrect ... which still produces the wrong result, because GDB simply applied int to unsigned long long conversion. Meaning, it sign-extended the integer that it extracted from the return of the function, to 64-bits. and then maybe, after asking around on IRC, you realize you have to cast the function to a pointer of the right type, and call that. It won't be easy, but after a few missteps, you'll get to it: ..... (gdb) p /x ((unsigned long long(*) ()) function) () $666 = 0x7fffffffffffffff # finally! :-) So to improve on the user experience, this patch does the following (interrelated) things: - makes no-debug-info functions no longer default to "int" as return type. Instead, they're left with NULL/"<unknown return type>" return type. (gdb) ptype getenv type = <unknown return type> () - makes calling a function with unknown return type an error. (gdb) p getenv ("PATH") 'getenv' has unknown return type; cast the call to its declared return type - and then to make it easier to call the function, makes it possible to _only_ cast the return of the function to the right type, instead of having to cast the function to a function pointer: (gdb) p (char *) getenv ("PATH") # now Just Works $3 = 0x7fffffffe7d7 "/usr/local/bin:/"... (gdb) p ((char *(*) (const char *)) getenv) ("PATH") # continues working $4 = 0x7fffffffe7d7 "/usr/local/bin:/"... I.e., it makes GDB default the function's return type to the type of the cast, and the function's parameters to the type of the arguments passed down. After this patch, here's what you'll get for the "unsigned long long" example above: (gdb) p function () 'function' has unknown return type; cast the call to its declared return type (gdb) p /x (unsigned long long) function () $4 = 0x7fffffffffffffff # correct! Note that while with "print" GDB shows the name of the function that has the problem: (gdb) p getenv ("PATH") 'getenv' has unknown return type; cast the call to its declared return type which can by handy in more complicated expressions, "ptype" does not: (gdb) ptype getenv ("PATH") function has unknown return type; cast the call to its declared return type This will be fixed in the next patch. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ada-lang.c (ada_evaluate_subexp) <TYPE_CODE_FUNC>: Don't handle TYPE_GNU_IFUNC specially here. Throw error if return type is unknown. * ada-typeprint.c (print_func_type): Handle functions with unknown return type. * c-typeprint.c (c_type_print_base): Handle functions and methods with unknown return type. * compile/compile-c-symbols.c (convert_symbol_bmsym) <mst_text_gnu_ifunc>: Use nodebug_text_gnu_ifunc_symbol. * compile/compile-c-types.c: Include "objfiles.h". (convert_func): For functions with unknown return type, warn and default to int. * compile/compile-object-run.c (compile_object_run): Adjust call to call_function_by_hand_dummy. * elfread.c (elf_gnu_ifunc_resolve_addr): Adjust call to call_function_by_hand. * eval.c (evaluate_subexp_standard): Adjust calls to call_function_by_hand. Handle functions and methods with unknown return type. Pass expect_type to call_function_by_hand. * f-typeprint.c (f_type_print_base): Handle functions with unknown return type. * gcore.c (call_target_sbrk): Adjust call to call_function_by_hand. * gdbtypes.c (objfile_type): Leave nodebug text symbol with NULL return type instead of int. Make nodebug_text_gnu_ifunc_symbol be an integer address type instead of nodebug. * guile/scm-value.c (gdbscm_value_call): Adjust call to call_function_by_hand. * infcall.c (error_call_unknown_return_type): New function. (call_function_by_hand): New "default_return_type" parameter. Pass it down. (call_function_by_hand_dummy): New "default_return_type" parameter. Use it instead of defaulting to int. If there's no default and the return type is unknown, throw an error. If there's a default return type, and the called function has no debug info, then assume the function is prototyped. * infcall.h (call_function_by_hand, call_function_by_hand_dummy): New "default_return_type" parameter. (error_call_unknown_return_type): New declaration. * linux-fork.c (call_lseek): Cast return type of lseek. (inferior_call_waitpid, checkpoint_command): Adjust calls to call_function_by_hand. * linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap): Adjust calls to call_function_by_hand. * m2-typeprint.c (m2_procedure): Handle functions with unknown return type. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, print_object_command): Adjust calls to call_function_by_hand. * p-typeprint.c (pascal_type_print_varspec_prefix): Handle functions with unknown return type. (pascal_type_print_func_varspec_suffix): New function. (pascal_type_print_varspec_suffix) <TYPE_CODE_FUNC, TYPE_CODE_METHOD>: Use it. * python/py-value.c (valpy_call): Adjust call to call_function_by_hand. * rust-lang.c (rust_evaluate_funcall): Adjust call to call_function_by_hand. * valarith.c (value_x_binop, value_x_unop): Adjust calls to call_function_by_hand. * valops.c (value_allocate_space_in_inferior): Adjust call to call_function_by_hand. * typeprint.c (type_print_unknown_return_type): New function. * typeprint.h (type_print_unknown_return_type): New declaration. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/break-main-file-remove-fail.exp (test_remove_bp): Cast return type of munmap in infcall. * gdb.base/break-probes.exp: Cast return type of foo in infcall. * gdb.base/checkpoint.exp: Simplify using for loop. Cast return type of ftell in infcall. * gdb.base/dprintf-detach.exp (dprintf_detach_test): Cast return type of getpid in infcall. * gdb.base/infcall-exec.exp: Cast return type of execlp in infcall. * gdb.base/info-os.exp: Cast return type of getpid in infcall. Bail on failure to extract the pid. * gdb.base/nodebug.c: #include <stdint.h>. (multf, multf_noproto, mult, mult_noproto, add8, add8_noproto): New functions. * gdb.base/nodebug.exp (test_call_promotion): New procedure. Change expected output of print/whatis/ptype with functions with no debug info. Test all supported languages. Call test_call_promotion. * gdb.compile/compile.exp: Adjust expected output to expect warning. * gdb.threads/siginfo-threads.exp: Likewise.
2017-09-04 21:21:13 +02:00
break;
case TYPE_CODE_FUNC:
if (TYPE_TARGET_TYPE (type) == NULL)
type_print_unknown_return_type (stream);
else
f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
1999-07-07 22:19:36 +02:00
case TYPE_CODE_PTR:
fprintfi_filtered (level, stream, "PTR TO -> ( ");
f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0);
break;
case TYPE_CODE_REF:
fprintfi_filtered (level, stream, "REF TO -> ( ");
f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0);
break;
case TYPE_CODE_VOID:
{
gdbarch *gdbarch = get_type_arch (type);
struct type *void_type = builtin_f_type (gdbarch)->builtin_void;
fprintfi_filtered (level, stream, "%s", TYPE_NAME (void_type));
}
break;
case TYPE_CODE_UNDEF:
fprintfi_filtered (level, stream, "struct <unknown>");
break;
case TYPE_CODE_ERROR:
fprintfi_filtered (level, stream, "%s", TYPE_ERROR_NAME (type));
break;
case TYPE_CODE_RANGE:
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* This should not occur. */
fprintfi_filtered (level, stream, "<range type>");
break;
case TYPE_CODE_CHAR:
case TYPE_CODE_INT:
/* There may be some character types that attempt to come
through as TYPE_CODE_INT since dbxstclass.h is so
C-oriented, we must change these to "character" from "char". */
if (strcmp (TYPE_NAME (type), "char") == 0)
fprintfi_filtered (level, stream, "character");
else
goto default_case;
break;
case TYPE_CODE_STRING:
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Strings may have dynamic upperbounds (lengths) like arrays. */
gdb/ Replace TYPE_ARRAY_{UPPER,LOWER}_BOUND_TYPE by a bit if {un,}defined. * c-typeprint.c (c_type_print_varspec_suffix), m2-typeprint.c (m2_array), p-typeprint.c (pascal_type_print_varspec_prefix), valops.c (value_cast), varobj.c (c_number_of_children): Replace TYPE_ARRAY_UPPER_BOUND_TYPE compared to BOUND_CANNOT_BE_DETERMINED by TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED. * parse.c (follow_types): Use TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED. * f-valprint.c (f77_get_dynamic_upperbound): Replace with ... (f77_get_upperbound): ... this function handling now only TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED. (f77_get_dynamic_lowerbound): Replace with ... (f77_get_lowerbound): ... this function handling now only TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED. (f77_get_dynamic_length_of_aggregate, f77_create_arrayprint_offset_tbl): Update their callers. * eval.c (evaluate_subexp_standard): Update their callers. * f-lang.h (f77_get_dynamic_upperbound, f77_get_upperbound) (f77_get_dynamic_lowerbound, f77_get_lowerbound): Update their prototypes. (BOUND_FETCH_OK, BOUND_FETCH_ERROR): Remove. * f-typeprint.c (f_type_print_varspec_suffix, f_type_print_base): Remove the lower_bound_was_default variable. Update the f77_get_dynamic_upperbound, f77_get_upperbound and TYPE_ARRAY_UPPER_BOUND_TYPE calls. * gdbtypes.c (print_bound_type): Remove the function. (recursive_dump_type): Remove its calls printing UPPER_BOUND_TYPE and LOWER_BOUND_TYPE. * gdbtypes.h (enum array_bound_type): Remove. (struct main_type): Remove the fields upper_bound_type and lower_bound_type. Comment the new overload of the field artificial. (TYPE_ARRAY_UPPER_BOUND_TYPE): Replace by ... (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED): ... this macro. (TYPE_ARRAY_LOWER_BOUND_TYPE): Replace by ... (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED): ... this macro. gdb/testsuite/ * gdb.base/maint.exp (maint print type): Remove printing UPPER_BOUND_TYPE and LOWER_BOUND_TYPE.
2008-10-03 00:06:08 +02:00
if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
fprintfi_filtered (level, stream, "character*(*)");
else
{
Allow really large fortran array bounds: fortran type/value printers This is the fortran part of the patch, including tests, which are essentially unchanged from Siddhesh's original 2012 submission: https://sourceware.org/ml/gdb-patches/2012-08/msg00562.html There is, however, one large departure. In the above thread, Jan pointed out problems with GCC debuginfo for -m32 builds (filed usptream as gcc/54934). After investigating the issue, I am dropping the hand-tweaked assembler source file to workaround this case. While I would normally do something to accommodate this, in this case, given the ubiquity of 64-bit systems today (where the tests pass) and the apparent lack of urgency on the compiler side (by users), I don't think the additional complexity and maintenance costs are worth it. It will be very routinely tested on 64-bit systems. [For example, at Red Hat, we always test -m64 and -m32 configurations for all GDB releases.] gdb/ChangeLog: From Siddhesh Poyarekar: * f-lang.h (f77_get_upperbound): Return LONGEST. (f77_get_lowerbound): Likewise. * f-typeprint.c (f_type_print_varspec_suffix): Expand UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format print them. (f_type_print_base): Expand UPPER_BOUND to LONGEST. Use plongest to format print it. * f-valprint.c (f77_get_lowerbound): Return LONGEST. (f77_get_upperbound): Likewise. (f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND, LOWER_BOUND to LONGEST. (f77_create_arrayprint_offset_tbl): Likewise. gdb/testsuite/ChangeLog: * gdb.fortran/array-bounds.exp: New file. * gdb.fortran/array-bounds.f90: New file.
2019-03-29 18:15:38 +01:00
LONGEST upper_bound = f77_get_upperbound (type);
fprintf_filtered (stream, "character*%s", pulongest (upper_bound));
}
break;
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
if (type->code () == TYPE_CODE_UNION)
fprintfi_filtered (level, stream, "Type, C_Union :: ");
else
fprintfi_filtered (level, stream, "Type ");
Remove TYPE_TAG_NAME TYPE_TAG_NAME has been an occasional source of confusion and bugs. It seems to me that it is only useful for C and C++ -- but even there, not so much, because at least with DWARF there doesn't seem to be any way to wind up with a type where the name and the tag name are both non-NULL and different. So, this patch removes TYPE_TAG_NAME entirely. This should save a little memory, but more importantly, it simplifies this part of gdb. A few minor test suite adjustments were needed. In some situations the new code does not yield identical output to the old code. gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * valops.c (enum_constant_from_type, value_namespace_elt) (value_maybe_namespace_elt): Update. * valarith.c (find_size_for_pointer_math): Update. * target-descriptions.c (make_gdb_type): Update. * symmisc.c (print_symbol): Update. * stabsread.c (define_symbol, read_type) (complain_about_struct_wipeout, add_undefined_type) (cleanup_undefined_types_1): Update. * rust-lang.c (rust_tuple_type_p, rust_slice_type_p) (rust_range_type_p, val_print_struct, rust_print_struct_def) (rust_internal_print_type, rust_composite_type) (rust_evaluate_funcall, rust_evaluate_subexp) (rust_inclusive_range_type_p): Update. * python/py-type.c (typy_get_tag): Update. * p-typeprint.c (pascal_type_print_base): Update. * mdebugread.c (parse_symbol, parse_type): Update. * m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum): Update. * guile/scm-type.c (gdbscm_type_tag): Update. * go-lang.c (sixg_string_p): Update. * gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type): Update. * gdbtypes.h (struct main_type) <tag_name>: Remove. (TYPE_TAG_NAME): Remove. * gdbtypes.c (type_name_no_tag): Simplify. (check_typedef, check_types_equal, recursive_dump_type) (copy_type_recursive, arch_composite_type): Update. * f-typeprint.c (f_type_print_base): Update. Print "Type" prefix in summary mode when needed. * eval.c (evaluate_funcall): Update. * dwarf2read.c (fixup_go_packaging, read_structure_type) (process_structure_scope, read_enumeration_type) (read_namespace_type, read_module_type, determine_prefix): Update. * cp-support.c (inspect_type): Update. * coffread.c (process_coff_symbol, decode_base_type): Update. * c-varobj.c (c_is_path_expr_parent): Update. * c-typeprint.c (c_type_print_base_struct_union): Update. (c_type_print_base_1): Update. Print struct/class/union/enum in summary when using C language. * ax-gdb.c (gen_struct_ref, gen_namespace_elt) (gen_maybe_namespace_elt): Update. * ada-lang.c (ada_type_name): Simplify. (empty_record, ada_template_to_fixed_record_type_1) (template_to_static_fixed_type) (to_record_with_fixed_variant_part, ada_check_typedef): Update. gdb/testsuite/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * gdb.xml/tdesc-regs.exp (load_description): Update expected results. * gdb.dwarf2/method-ptr.exp: Set language to C++. * gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++. * gdb.cp/typeid.exp (do_typeid_tests): Update type_re. * gdb.base/maint.exp (maint_pass_if): Update.
2018-04-17 21:51:24 +02:00
fputs_filtered (TYPE_NAME (type), stream);
/* According to the definition,
we only print structure elements in case show > 0. */
if (show > 0)
{
fputs_filtered ("\n", stream);
for (index = 0; index < TYPE_NFIELDS (type); index++)
{
f_type_print_base (TYPE_FIELD_TYPE (type, index), stream,
show - 1, level + 4);
fputs_filtered (" :: ", stream);
Style field names in "print" This changes gdb to use the "variable" style when printing field names. I've added new tests for C and Rust, but not other languages. I chose "variable" because that seemed most straightforward. However, another option would be to introduce a new "field" style. Similarly, this patch uses the variable style for enumerator constants -- but again, a new style could be used if that's preferred. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * valprint.c (generic_val_print_enum_1) (val_print_type_code_flags): Style member names. * rust-lang.c (val_print_struct, rust_print_enum) (rust_print_struct_def, rust_internal_print_type): Style member names. * p-valprint.c (pascal_object_print_value_fields): Style member names. Only call fprintf_symbol_filtered for static members. * m2-typeprint.c (m2_record_fields, m2_enum): Style member names. * f-valprint.c (f_val_print): Style member names. * f-typeprint.c (f_type_print_base): Style member names. * cp-valprint.c (cp_print_value_fields): Style member names. Only call fprintf_symbol_filtered for static members. (cp_print_class_member): Style member names. * c-typeprint.c (c_print_type_1, c_type_print_base_1): Style member names. * ada-valprint.c (ada_print_scalar): Style enum names. (ada_val_print_enum): Likewise. * ada-typeprint.c (print_enum_type): Style enum names. gdb/testsuite/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * gdb.rust/rust-style.rs: New file. * gdb.rust/rust-style.exp: New file. * gdb.base/style.exp: Test structure printing. * gdb.base/style.c (struct some_struct): New type. (enum etype): New type. (struct_value): New global. Change-Id: I070e1293c6cc830c9ea916af8243410aa384e944
2020-02-22 18:02:42 +01:00
fputs_styled (TYPE_FIELD_NAME (type, index),
variable_name_style.style (), stream);
f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index),
2019-03-01 12:12:33 +01:00
stream, show - 1, 0, 0, 0, false);
fputs_filtered ("\n", stream);
}
fprintfi_filtered (level, stream, "End Type ");
Remove TYPE_TAG_NAME TYPE_TAG_NAME has been an occasional source of confusion and bugs. It seems to me that it is only useful for C and C++ -- but even there, not so much, because at least with DWARF there doesn't seem to be any way to wind up with a type where the name and the tag name are both non-NULL and different. So, this patch removes TYPE_TAG_NAME entirely. This should save a little memory, but more importantly, it simplifies this part of gdb. A few minor test suite adjustments were needed. In some situations the new code does not yield identical output to the old code. gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * valops.c (enum_constant_from_type, value_namespace_elt) (value_maybe_namespace_elt): Update. * valarith.c (find_size_for_pointer_math): Update. * target-descriptions.c (make_gdb_type): Update. * symmisc.c (print_symbol): Update. * stabsread.c (define_symbol, read_type) (complain_about_struct_wipeout, add_undefined_type) (cleanup_undefined_types_1): Update. * rust-lang.c (rust_tuple_type_p, rust_slice_type_p) (rust_range_type_p, val_print_struct, rust_print_struct_def) (rust_internal_print_type, rust_composite_type) (rust_evaluate_funcall, rust_evaluate_subexp) (rust_inclusive_range_type_p): Update. * python/py-type.c (typy_get_tag): Update. * p-typeprint.c (pascal_type_print_base): Update. * mdebugread.c (parse_symbol, parse_type): Update. * m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum): Update. * guile/scm-type.c (gdbscm_type_tag): Update. * go-lang.c (sixg_string_p): Update. * gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type): Update. * gdbtypes.h (struct main_type) <tag_name>: Remove. (TYPE_TAG_NAME): Remove. * gdbtypes.c (type_name_no_tag): Simplify. (check_typedef, check_types_equal, recursive_dump_type) (copy_type_recursive, arch_composite_type): Update. * f-typeprint.c (f_type_print_base): Update. Print "Type" prefix in summary mode when needed. * eval.c (evaluate_funcall): Update. * dwarf2read.c (fixup_go_packaging, read_structure_type) (process_structure_scope, read_enumeration_type) (read_namespace_type, read_module_type, determine_prefix): Update. * cp-support.c (inspect_type): Update. * coffread.c (process_coff_symbol, decode_base_type): Update. * c-varobj.c (c_is_path_expr_parent): Update. * c-typeprint.c (c_type_print_base_struct_union): Update. (c_type_print_base_1): Update. Print struct/class/union/enum in summary when using C language. * ax-gdb.c (gen_struct_ref, gen_namespace_elt) (gen_maybe_namespace_elt): Update. * ada-lang.c (ada_type_name): Simplify. (empty_record, ada_template_to_fixed_record_type_1) (template_to_static_fixed_type) (to_record_with_fixed_variant_part, ada_check_typedef): Update. gdb/testsuite/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * gdb.xml/tdesc-regs.exp (load_description): Update expected results. * gdb.dwarf2/method-ptr.exp: Set language to C++. * gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++. * gdb.cp/typeid.exp (do_typeid_tests): Update type_re. * gdb.base/maint.exp (maint_pass_if): Update.
2018-04-17 21:51:24 +02:00
fputs_filtered (TYPE_NAME (type), stream);
}
break;
gdb/ Support DW_TAG_module as separate namespaces. * dwarf2read.c (typename_concat): New parameter physname. (read_module_type): New function and declaration. (scan_partial_symbols): Scan also DW_TAG_module children. (partial_die_parent_scope): Accept scope even from DW_TAG_module. Pass to typename_concat backward compatible physname value 0. (partial_die_full_name, read_namespace_type): Pass to typename_concat backward compatible physname value 0. (add_partial_module, read_module): Remove FIXME comment. (process_die) <DW_TAG_module>: Set PROCESSING_HAS_NAMESPACE_INFO. (die_needs_namespace) <DW_TAG_variable>: Allow returning true even for DIEs under DW_TAG_module. (dwarf2_compute_name): Move the ada block for DW_AT_linkage_name and DW_AT_MIPS_linkage_name first, extend it for language_fortran && physname and return there instead of just setting NAME. Extend the main block for language_fortran. Pass physname parameter to the typename_concat call. (read_import_statement, read_func_scope, get_scope_pc_bounds) (load_partial_dies, determine_prefix): Support also DW_TAG_module. (new_symbol): Fill in cplus_specific.demangled_name if it is still missing from SYMBOL_SET_NAMES in the language_fortran case. (new_symbol) <DW_TAG_variable>: Force LOC_UNRESOLVED for gfortran module variables. (read_type_die) <DW_TAG_module>: New. (MAX_SEP_LEN): Increase to 7. (typename_concat): New parameter physname. New variable lead. Support also language_fortran. * f-exp.y (yylex): Consider : also as a symbol name character class. * f-lang.c: Include cp-support.h. (f_word_break_characters, f_make_symbol_completion_list): New functions. (f_language_defn): Use cp_lookup_symbol_nonlocal, f_word_break_characters and f_make_symbol_completion_list. * f-typeprint.c (f_type_print_base) <TYPE_CODE_MODULE>: New. * gdbtypes.h (enum type_code) <TYPE_CODE_MODULE>: New. * symtab.c (symbol_init_language_specific): Support language_fortran. (symbol_find_demangled_name): New comment on language_fortran. (symbol_natural_name, symbol_demangled_name): Use demangled_name even for language_fortran. (lookup_symbol_aux_local): Check imports also for language_fortran. (default_make_symbol_completion_list): Rename to ... (default_make_symbol_completion_list_break_on): ... this name. New parameter break_on, use it. (default_make_symbol_completion_list): New stub. * symtab.h (default_make_symbol_completion_list_break_on): New prototype. gdb/testsuite/ Support DW_TAG_module as separate namespaces. * gdb.fortran/library-module.exp, gdb.fortran/library-module-main.f90, gdb.fortran/library-module-lib.f90: New. * gdb.fortran/module.exp: Replace startup by a prepare_for_testing call. (print i): Remove. (continue to breakpoint: i-is-1, print var_i value 1) (continue to breakpoint: i-is-2, print var_i value 2) (continue to breakpoint: a-b-c-d, print var_a, print var_b, print var_c) (print var_d, print var_i value 14, ptype modmany, complete `modm) (complete `modmany, complete `modmany`, complete `modmany`var) (show language, setting breakpoint at module): New tests. * gdb.fortran/module.f90 (module mod): Remove. (module mod1, module mod2, module modmany, subroutine sub1) (subroutine sub2, program module): New.
2010-06-03 00:41:56 +02:00
case TYPE_CODE_MODULE:
Remove TYPE_TAG_NAME TYPE_TAG_NAME has been an occasional source of confusion and bugs. It seems to me that it is only useful for C and C++ -- but even there, not so much, because at least with DWARF there doesn't seem to be any way to wind up with a type where the name and the tag name are both non-NULL and different. So, this patch removes TYPE_TAG_NAME entirely. This should save a little memory, but more importantly, it simplifies this part of gdb. A few minor test suite adjustments were needed. In some situations the new code does not yield identical output to the old code. gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * valops.c (enum_constant_from_type, value_namespace_elt) (value_maybe_namespace_elt): Update. * valarith.c (find_size_for_pointer_math): Update. * target-descriptions.c (make_gdb_type): Update. * symmisc.c (print_symbol): Update. * stabsread.c (define_symbol, read_type) (complain_about_struct_wipeout, add_undefined_type) (cleanup_undefined_types_1): Update. * rust-lang.c (rust_tuple_type_p, rust_slice_type_p) (rust_range_type_p, val_print_struct, rust_print_struct_def) (rust_internal_print_type, rust_composite_type) (rust_evaluate_funcall, rust_evaluate_subexp) (rust_inclusive_range_type_p): Update. * python/py-type.c (typy_get_tag): Update. * p-typeprint.c (pascal_type_print_base): Update. * mdebugread.c (parse_symbol, parse_type): Update. * m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum): Update. * guile/scm-type.c (gdbscm_type_tag): Update. * go-lang.c (sixg_string_p): Update. * gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type): Update. * gdbtypes.h (struct main_type) <tag_name>: Remove. (TYPE_TAG_NAME): Remove. * gdbtypes.c (type_name_no_tag): Simplify. (check_typedef, check_types_equal, recursive_dump_type) (copy_type_recursive, arch_composite_type): Update. * f-typeprint.c (f_type_print_base): Update. Print "Type" prefix in summary mode when needed. * eval.c (evaluate_funcall): Update. * dwarf2read.c (fixup_go_packaging, read_structure_type) (process_structure_scope, read_enumeration_type) (read_namespace_type, read_module_type, determine_prefix): Update. * cp-support.c (inspect_type): Update. * coffread.c (process_coff_symbol, decode_base_type): Update. * c-varobj.c (c_is_path_expr_parent): Update. * c-typeprint.c (c_type_print_base_struct_union): Update. (c_type_print_base_1): Update. Print struct/class/union/enum in summary when using C language. * ax-gdb.c (gen_struct_ref, gen_namespace_elt) (gen_maybe_namespace_elt): Update. * ada-lang.c (ada_type_name): Simplify. (empty_record, ada_template_to_fixed_record_type_1) (template_to_static_fixed_type) (to_record_with_fixed_variant_part, ada_check_typedef): Update. gdb/testsuite/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * gdb.xml/tdesc-regs.exp (load_description): Update expected results. * gdb.dwarf2/method-ptr.exp: Set language to C++. * gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++. * gdb.cp/typeid.exp (do_typeid_tests): Update type_re. * gdb.base/maint.exp (maint_pass_if): Update.
2018-04-17 21:51:24 +02:00
fprintfi_filtered (level, stream, "module %s", TYPE_NAME (type));
gdb/ Support DW_TAG_module as separate namespaces. * dwarf2read.c (typename_concat): New parameter physname. (read_module_type): New function and declaration. (scan_partial_symbols): Scan also DW_TAG_module children. (partial_die_parent_scope): Accept scope even from DW_TAG_module. Pass to typename_concat backward compatible physname value 0. (partial_die_full_name, read_namespace_type): Pass to typename_concat backward compatible physname value 0. (add_partial_module, read_module): Remove FIXME comment. (process_die) <DW_TAG_module>: Set PROCESSING_HAS_NAMESPACE_INFO. (die_needs_namespace) <DW_TAG_variable>: Allow returning true even for DIEs under DW_TAG_module. (dwarf2_compute_name): Move the ada block for DW_AT_linkage_name and DW_AT_MIPS_linkage_name first, extend it for language_fortran && physname and return there instead of just setting NAME. Extend the main block for language_fortran. Pass physname parameter to the typename_concat call. (read_import_statement, read_func_scope, get_scope_pc_bounds) (load_partial_dies, determine_prefix): Support also DW_TAG_module. (new_symbol): Fill in cplus_specific.demangled_name if it is still missing from SYMBOL_SET_NAMES in the language_fortran case. (new_symbol) <DW_TAG_variable>: Force LOC_UNRESOLVED for gfortran module variables. (read_type_die) <DW_TAG_module>: New. (MAX_SEP_LEN): Increase to 7. (typename_concat): New parameter physname. New variable lead. Support also language_fortran. * f-exp.y (yylex): Consider : also as a symbol name character class. * f-lang.c: Include cp-support.h. (f_word_break_characters, f_make_symbol_completion_list): New functions. (f_language_defn): Use cp_lookup_symbol_nonlocal, f_word_break_characters and f_make_symbol_completion_list. * f-typeprint.c (f_type_print_base) <TYPE_CODE_MODULE>: New. * gdbtypes.h (enum type_code) <TYPE_CODE_MODULE>: New. * symtab.c (symbol_init_language_specific): Support language_fortran. (symbol_find_demangled_name): New comment on language_fortran. (symbol_natural_name, symbol_demangled_name): Use demangled_name even for language_fortran. (lookup_symbol_aux_local): Check imports also for language_fortran. (default_make_symbol_completion_list): Rename to ... (default_make_symbol_completion_list_break_on): ... this name. New parameter break_on, use it. (default_make_symbol_completion_list): New stub. * symtab.h (default_make_symbol_completion_list_break_on): New prototype. gdb/testsuite/ Support DW_TAG_module as separate namespaces. * gdb.fortran/library-module.exp, gdb.fortran/library-module-main.f90, gdb.fortran/library-module-lib.f90: New. * gdb.fortran/module.exp: Replace startup by a prepare_for_testing call. (print i): Remove. (continue to breakpoint: i-is-1, print var_i value 1) (continue to breakpoint: i-is-2, print var_i value 2) (continue to breakpoint: a-b-c-d, print var_a, print var_b, print var_c) (print var_d, print var_i value 14, ptype modmany, complete `modm) (complete `modmany, complete `modmany`, complete `modmany`var) (show language, setting breakpoint at module): New tests. * gdb.fortran/module.f90 (module mod): Remove. (module mod1, module mod2, module modmany, subroutine sub1) (subroutine sub2, program module): New.
2010-06-03 00:41:56 +02:00
break;
default_case:
default:
/* Handle types not explicitly handled by the other cases,
1999-07-07 22:19:36 +02:00
such as fundamental types. For these, just print whatever
the type name is, as recorded in the type itself. If there
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
is no type name, then complain. */
if (TYPE_NAME (type) != NULL)
fprintfi_filtered (level, stream, "%s", TYPE_NAME (type));
else
error (_("Invalid type code (%d) in symbol table."), type->code ());
break;
}
if (TYPE_IS_ALLOCATABLE (type))
fprintf_filtered (stream, ", allocatable");
}