binutils-gdb/gdb/demangle.c

206 lines
7.0 KiB
C
Raw Normal View History

/* Basic C++ demangling support for GDB.
Copyright (C) 1991-2014 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
This file is part of GDB.
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
(at your option) any later version.
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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This file contains support code for C++ demangling that is common
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
to a styles of demangling, and GDB specific. */
#include "defs.h"
#include "command.h"
#include "gdbcmd.h"
#include "demangle.h"
#include "gdb-demangle.h"
remove gdb_string.h This removes gdb_string.h. This patch is purely mechanical. I created it by running the two commands: git rm common/gdb_string.h perl -pi -e's/"gdb_string.h"/<string.h>/;' *.[chyl] */*.[chyl] 2013-11-18 Tom Tromey <tromey@redhat.com> * common/gdb_string.h: Remove. * aarch64-tdep.c: Use string.h, not gdb_string.h. * ada-exp.y: Use string.h, not gdb_string.h. * ada-lang.c: Use string.h, not gdb_string.h. * ada-lex.l: Use string.h, not gdb_string.h. * ada-typeprint.c: Use string.h, not gdb_string.h. * ada-valprint.c: Use string.h, not gdb_string.h. * aix-thread.c: Use string.h, not gdb_string.h. * alpha-linux-tdep.c: Use string.h, not gdb_string.h. * alpha-mdebug-tdep.c: Use string.h, not gdb_string.h. * alpha-nat.c: Use string.h, not gdb_string.h. * alpha-osf1-tdep.c: Use string.h, not gdb_string.h. * alpha-tdep.c: Use string.h, not gdb_string.h. * alphanbsd-tdep.c: Use string.h, not gdb_string.h. * amd64-dicos-tdep.c: Use string.h, not gdb_string.h. * amd64-linux-nat.c: Use string.h, not gdb_string.h. * amd64-linux-tdep.c: Use string.h, not gdb_string.h. * amd64-nat.c: Use string.h, not gdb_string.h. * amd64-sol2-tdep.c: Use string.h, not gdb_string.h. * amd64fbsd-tdep.c: Use string.h, not gdb_string.h. * amd64obsd-tdep.c: Use string.h, not gdb_string.h. * arch-utils.c: Use string.h, not gdb_string.h. * arm-linux-nat.c: Use string.h, not gdb_string.h. * arm-linux-tdep.c: Use string.h, not gdb_string.h. * arm-tdep.c: Use string.h, not gdb_string.h. * arm-wince-tdep.c: Use string.h, not gdb_string.h. * armbsd-tdep.c: Use string.h, not gdb_string.h. * armnbsd-nat.c: Use string.h, not gdb_string.h. * armnbsd-tdep.c: Use string.h, not gdb_string.h. * armobsd-tdep.c: Use string.h, not gdb_string.h. * avr-tdep.c: Use string.h, not gdb_string.h. * ax-gdb.c: Use string.h, not gdb_string.h. * ax-general.c: Use string.h, not gdb_string.h. * bcache.c: Use string.h, not gdb_string.h. * bfin-tdep.c: Use string.h, not gdb_string.h. * breakpoint.c: Use string.h, not gdb_string.h. * build-id.c: Use string.h, not gdb_string.h. * buildsym.c: Use string.h, not gdb_string.h. * c-exp.y: Use string.h, not gdb_string.h. * c-lang.c: Use string.h, not gdb_string.h. * c-typeprint.c: Use string.h, not gdb_string.h. * c-valprint.c: Use string.h, not gdb_string.h. * charset.c: Use string.h, not gdb_string.h. * cli-out.c: Use string.h, not gdb_string.h. * cli/cli-cmds.c: Use string.h, not gdb_string.h. * cli/cli-decode.c: Use string.h, not gdb_string.h. * cli/cli-dump.c: Use string.h, not gdb_string.h. * cli/cli-interp.c: Use string.h, not gdb_string.h. * cli/cli-logging.c: Use string.h, not gdb_string.h. * cli/cli-script.c: Use string.h, not gdb_string.h. * cli/cli-setshow.c: Use string.h, not gdb_string.h. * cli/cli-utils.c: Use string.h, not gdb_string.h. * coffread.c: Use string.h, not gdb_string.h. * common/common-utils.c: Use string.h, not gdb_string.h. * common/filestuff.c: Use string.h, not gdb_string.h. * common/linux-procfs.c: Use string.h, not gdb_string.h. * common/linux-ptrace.c: Use string.h, not gdb_string.h. * common/signals.c: Use string.h, not gdb_string.h. * common/vec.h: Use string.h, not gdb_string.h. * core-regset.c: Use string.h, not gdb_string.h. * corefile.c: Use string.h, not gdb_string.h. * corelow.c: Use string.h, not gdb_string.h. * cp-abi.c: Use string.h, not gdb_string.h. * cp-support.c: Use string.h, not gdb_string.h. * cp-valprint.c: Use string.h, not gdb_string.h. * cris-tdep.c: Use string.h, not gdb_string.h. * d-lang.c: Use string.h, not gdb_string.h. * dbxread.c: Use string.h, not gdb_string.h. * dcache.c: Use string.h, not gdb_string.h. * demangle.c: Use string.h, not gdb_string.h. * dicos-tdep.c: Use string.h, not gdb_string.h. * disasm.c: Use string.h, not gdb_string.h. * doublest.c: Use string.h, not gdb_string.h. * dsrec.c: Use string.h, not gdb_string.h. * dummy-frame.c: Use string.h, not gdb_string.h. * dwarf2-frame.c: Use string.h, not gdb_string.h. * dwarf2loc.c: Use string.h, not gdb_string.h. * dwarf2read.c: Use string.h, not gdb_string.h. * elfread.c: Use string.h, not gdb_string.h. * environ.c: Use string.h, not gdb_string.h. * eval.c: Use string.h, not gdb_string.h. * event-loop.c: Use string.h, not gdb_string.h. * exceptions.c: Use string.h, not gdb_string.h. * exec.c: Use string.h, not gdb_string.h. * expprint.c: Use string.h, not gdb_string.h. * f-exp.y: Use string.h, not gdb_string.h. * f-lang.c: Use string.h, not gdb_string.h. * f-typeprint.c: Use string.h, not gdb_string.h. * f-valprint.c: Use string.h, not gdb_string.h. * fbsd-nat.c: Use string.h, not gdb_string.h. * findcmd.c: Use string.h, not gdb_string.h. * findvar.c: Use string.h, not gdb_string.h. * fork-child.c: Use string.h, not gdb_string.h. * frame.c: Use string.h, not gdb_string.h. * frv-linux-tdep.c: Use string.h, not gdb_string.h. * frv-tdep.c: Use string.h, not gdb_string.h. * gdb.c: Use string.h, not gdb_string.h. * gdb_bfd.c: Use string.h, not gdb_string.h. * gdbarch.c: Use string.h, not gdb_string.h. * gdbtypes.c: Use string.h, not gdb_string.h. * gnu-nat.c: Use string.h, not gdb_string.h. * gnu-v2-abi.c: Use string.h, not gdb_string.h. * gnu-v3-abi.c: Use string.h, not gdb_string.h. * go-exp.y: Use string.h, not gdb_string.h. * go-lang.c: Use string.h, not gdb_string.h. * go32-nat.c: Use string.h, not gdb_string.h. * hppa-hpux-tdep.c: Use string.h, not gdb_string.h. * hppa-linux-nat.c: Use string.h, not gdb_string.h. * hppanbsd-tdep.c: Use string.h, not gdb_string.h. * hppaobsd-tdep.c: Use string.h, not gdb_string.h. * i386-cygwin-tdep.c: Use string.h, not gdb_string.h. * i386-dicos-tdep.c: Use string.h, not gdb_string.h. * i386-linux-nat.c: Use string.h, not gdb_string.h. * i386-linux-tdep.c: Use string.h, not gdb_string.h. * i386-nto-tdep.c: Use string.h, not gdb_string.h. * i386-sol2-tdep.c: Use string.h, not gdb_string.h. * i386-tdep.c: Use string.h, not gdb_string.h. * i386bsd-tdep.c: Use string.h, not gdb_string.h. * i386gnu-nat.c: Use string.h, not gdb_string.h. * i386nbsd-tdep.c: Use string.h, not gdb_string.h. * i386obsd-tdep.c: Use string.h, not gdb_string.h. * i387-tdep.c: Use string.h, not gdb_string.h. * ia64-libunwind-tdep.c: Use string.h, not gdb_string.h. * ia64-linux-nat.c: Use string.h, not gdb_string.h. * inf-child.c: Use string.h, not gdb_string.h. * inf-ptrace.c: Use string.h, not gdb_string.h. * inf-ttrace.c: Use string.h, not gdb_string.h. * infcall.c: Use string.h, not gdb_string.h. * infcmd.c: Use string.h, not gdb_string.h. * inflow.c: Use string.h, not gdb_string.h. * infrun.c: Use string.h, not gdb_string.h. * interps.c: Use string.h, not gdb_string.h. * iq2000-tdep.c: Use string.h, not gdb_string.h. * irix5-nat.c: Use string.h, not gdb_string.h. * jv-exp.y: Use string.h, not gdb_string.h. * jv-lang.c: Use string.h, not gdb_string.h. * jv-typeprint.c: Use string.h, not gdb_string.h. * jv-valprint.c: Use string.h, not gdb_string.h. * language.c: Use string.h, not gdb_string.h. * linux-fork.c: Use string.h, not gdb_string.h. * linux-nat.c: Use string.h, not gdb_string.h. * lm32-tdep.c: Use string.h, not gdb_string.h. * m2-exp.y: Use string.h, not gdb_string.h. * m2-typeprint.c: Use string.h, not gdb_string.h. * m32c-tdep.c: Use string.h, not gdb_string.h. * m32r-linux-nat.c: Use string.h, not gdb_string.h. * m32r-linux-tdep.c: Use string.h, not gdb_string.h. * m32r-rom.c: Use string.h, not gdb_string.h. * m32r-tdep.c: Use string.h, not gdb_string.h. * m68hc11-tdep.c: Use string.h, not gdb_string.h. * m68k-tdep.c: Use string.h, not gdb_string.h. * m68kbsd-tdep.c: Use string.h, not gdb_string.h. * m68klinux-nat.c: Use string.h, not gdb_string.h. * m68klinux-tdep.c: Use string.h, not gdb_string.h. * m88k-tdep.c: Use string.h, not gdb_string.h. * macrocmd.c: Use string.h, not gdb_string.h. * main.c: Use string.h, not gdb_string.h. * mdebugread.c: Use string.h, not gdb_string.h. * mem-break.c: Use string.h, not gdb_string.h. * memattr.c: Use string.h, not gdb_string.h. * memory-map.c: Use string.h, not gdb_string.h. * mep-tdep.c: Use string.h, not gdb_string.h. * mi/mi-cmd-break.c: Use string.h, not gdb_string.h. * mi/mi-cmd-disas.c: Use string.h, not gdb_string.h. * mi/mi-cmd-env.c: Use string.h, not gdb_string.h. * mi/mi-cmd-stack.c: Use string.h, not gdb_string.h. * mi/mi-cmd-var.c: Use string.h, not gdb_string.h. * mi/mi-cmds.c: Use string.h, not gdb_string.h. * mi/mi-console.c: Use string.h, not gdb_string.h. * mi/mi-getopt.c: Use string.h, not gdb_string.h. * mi/mi-interp.c: Use string.h, not gdb_string.h. * mi/mi-main.c: Use string.h, not gdb_string.h. * mi/mi-parse.c: Use string.h, not gdb_string.h. * microblaze-rom.c: Use string.h, not gdb_string.h. * microblaze-tdep.c: Use string.h, not gdb_string.h. * mingw-hdep.c: Use string.h, not gdb_string.h. * minidebug.c: Use string.h, not gdb_string.h. * minsyms.c: Use string.h, not gdb_string.h. * mips-irix-tdep.c: Use string.h, not gdb_string.h. * mips-linux-tdep.c: Use string.h, not gdb_string.h. * mips-tdep.c: Use string.h, not gdb_string.h. * mips64obsd-tdep.c: Use string.h, not gdb_string.h. * mipsnbsd-tdep.c: Use string.h, not gdb_string.h. * mipsread.c: Use string.h, not gdb_string.h. * mn10300-linux-tdep.c: Use string.h, not gdb_string.h. * mn10300-tdep.c: Use string.h, not gdb_string.h. * monitor.c: Use string.h, not gdb_string.h. * moxie-tdep.c: Use string.h, not gdb_string.h. * mt-tdep.c: Use string.h, not gdb_string.h. * nbsd-tdep.c: Use string.h, not gdb_string.h. * nios2-linux-tdep.c: Use string.h, not gdb_string.h. * nto-procfs.c: Use string.h, not gdb_string.h. * nto-tdep.c: Use string.h, not gdb_string.h. * objc-lang.c: Use string.h, not gdb_string.h. * objfiles.c: Use string.h, not gdb_string.h. * opencl-lang.c: Use string.h, not gdb_string.h. * osabi.c: Use string.h, not gdb_string.h. * osdata.c: Use string.h, not gdb_string.h. * p-exp.y: Use string.h, not gdb_string.h. * p-lang.c: Use string.h, not gdb_string.h. * p-typeprint.c: Use string.h, not gdb_string.h. * parse.c: Use string.h, not gdb_string.h. * posix-hdep.c: Use string.h, not gdb_string.h. * ppc-linux-nat.c: Use string.h, not gdb_string.h. * ppc-sysv-tdep.c: Use string.h, not gdb_string.h. * ppcfbsd-tdep.c: Use string.h, not gdb_string.h. * ppcnbsd-tdep.c: Use string.h, not gdb_string.h. * ppcobsd-tdep.c: Use string.h, not gdb_string.h. * printcmd.c: Use string.h, not gdb_string.h. * procfs.c: Use string.h, not gdb_string.h. * prologue-value.c: Use string.h, not gdb_string.h. * python/py-auto-load.c: Use string.h, not gdb_string.h. * python/py-gdb-readline.c: Use string.h, not gdb_string.h. * ravenscar-thread.c: Use string.h, not gdb_string.h. * regcache.c: Use string.h, not gdb_string.h. * registry.c: Use string.h, not gdb_string.h. * remote-fileio.c: Use string.h, not gdb_string.h. * remote-m32r-sdi.c: Use string.h, not gdb_string.h. * remote-mips.c: Use string.h, not gdb_string.h. * remote-sim.c: Use string.h, not gdb_string.h. * remote.c: Use string.h, not gdb_string.h. * reverse.c: Use string.h, not gdb_string.h. * rs6000-aix-tdep.c: Use string.h, not gdb_string.h. * ser-base.c: Use string.h, not gdb_string.h. * ser-go32.c: Use string.h, not gdb_string.h. * ser-mingw.c: Use string.h, not gdb_string.h. * ser-pipe.c: Use string.h, not gdb_string.h. * ser-tcp.c: Use string.h, not gdb_string.h. * ser-unix.c: Use string.h, not gdb_string.h. * serial.c: Use string.h, not gdb_string.h. * sh-tdep.c: Use string.h, not gdb_string.h. * sh64-tdep.c: Use string.h, not gdb_string.h. * shnbsd-tdep.c: Use string.h, not gdb_string.h. * skip.c: Use string.h, not gdb_string.h. * sol-thread.c: Use string.h, not gdb_string.h. * solib-dsbt.c: Use string.h, not gdb_string.h. * solib-frv.c: Use string.h, not gdb_string.h. * solib-osf.c: Use string.h, not gdb_string.h. * solib-spu.c: Use string.h, not gdb_string.h. * solib-target.c: Use string.h, not gdb_string.h. * solib.c: Use string.h, not gdb_string.h. * somread.c: Use string.h, not gdb_string.h. * source.c: Use string.h, not gdb_string.h. * sparc-nat.c: Use string.h, not gdb_string.h. * sparc-sol2-tdep.c: Use string.h, not gdb_string.h. * sparc-tdep.c: Use string.h, not gdb_string.h. * sparc64-tdep.c: Use string.h, not gdb_string.h. * sparc64fbsd-tdep.c: Use string.h, not gdb_string.h. * sparc64nbsd-tdep.c: Use string.h, not gdb_string.h. * sparcnbsd-tdep.c: Use string.h, not gdb_string.h. * spu-linux-nat.c: Use string.h, not gdb_string.h. * spu-multiarch.c: Use string.h, not gdb_string.h. * spu-tdep.c: Use string.h, not gdb_string.h. * stabsread.c: Use string.h, not gdb_string.h. * stack.c: Use string.h, not gdb_string.h. * std-regs.c: Use string.h, not gdb_string.h. * symfile.c: Use string.h, not gdb_string.h. * symmisc.c: Use string.h, not gdb_string.h. * symtab.c: Use string.h, not gdb_string.h. * target.c: Use string.h, not gdb_string.h. * thread.c: Use string.h, not gdb_string.h. * tilegx-linux-nat.c: Use string.h, not gdb_string.h. * tilegx-tdep.c: Use string.h, not gdb_string.h. * top.c: Use string.h, not gdb_string.h. * tracepoint.c: Use string.h, not gdb_string.h. * tui/tui-command.c: Use string.h, not gdb_string.h. * tui/tui-data.c: Use string.h, not gdb_string.h. * tui/tui-disasm.c: Use string.h, not gdb_string.h. * tui/tui-file.c: Use string.h, not gdb_string.h. * tui/tui-layout.c: Use string.h, not gdb_string.h. * tui/tui-out.c: Use string.h, not gdb_string.h. * tui/tui-regs.c: Use string.h, not gdb_string.h. * tui/tui-source.c: Use string.h, not gdb_string.h. * tui/tui-stack.c: Use string.h, not gdb_string.h. * tui/tui-win.c: Use string.h, not gdb_string.h. * tui/tui-windata.c: Use string.h, not gdb_string.h. * tui/tui-winsource.c: Use string.h, not gdb_string.h. * typeprint.c: Use string.h, not gdb_string.h. * ui-file.c: Use string.h, not gdb_string.h. * ui-out.c: Use string.h, not gdb_string.h. * user-regs.c: Use string.h, not gdb_string.h. * utils.c: Use string.h, not gdb_string.h. * v850-tdep.c: Use string.h, not gdb_string.h. * valarith.c: Use string.h, not gdb_string.h. * valops.c: Use string.h, not gdb_string.h. * valprint.c: Use string.h, not gdb_string.h. * value.c: Use string.h, not gdb_string.h. * varobj.c: Use string.h, not gdb_string.h. * vax-tdep.c: Use string.h, not gdb_string.h. * vaxnbsd-tdep.c: Use string.h, not gdb_string.h. * vaxobsd-tdep.c: Use string.h, not gdb_string.h. * windows-nat.c: Use string.h, not gdb_string.h. * xcoffread.c: Use string.h, not gdb_string.h. * xml-support.c: Use string.h, not gdb_string.h. * xstormy16-tdep.c: Use string.h, not gdb_string.h. * xtensa-linux-nat.c: Use string.h, not gdb_string.h.
2013-11-06 15:14:23 +01:00
#include <string.h>
/* Select the default C++ demangling style to use. The default is "auto",
which allows gdb to attempt to pick an appropriate demangling style for
the executable it has loaded. It can be set to a specific style ("gnu",
"lucid", "arm", "hp", etc.) in which case gdb will never attempt to do auto
selection of the style unless you do an explicit "set demangle auto".
To select one of these as the default, set DEFAULT_DEMANGLING_STYLE in
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
the appropriate target configuration file. */
#ifndef DEFAULT_DEMANGLING_STYLE
#define DEFAULT_DEMANGLING_STYLE AUTO_DEMANGLING_STYLE_STRING
#endif
/* See documentation in gdb-demangle.h. */
int demangle = 1;
static void
show_demangle (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file,
_("Demangling of encoded C++/ObjC names "
"when displaying symbols is %s.\n"),
value);
}
/* See documentation in gdb-demangle.h. */
int asm_demangle = 0;
static void
show_asm_demangle (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file,
_("Demangling of C++/ObjC names in "
"disassembly listings is %s.\n"),
value);
}
1999-05-25 20:09:09 +02:00
/* String name for the current demangling style. Set by the
"set demangle-style" command, printed as part of the output by the
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
"show demangle-style" command. */
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
static const char *current_demangling_style_string;
/* The array of names of the known demanglyng styles. Generated by
_initialize_demangler from libiberty_demanglers[] array. */
static const char **demangling_style_names;
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
static void
show_demangling_style_names(struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("The current C++ demangling style is \"%s\".\n"),
value);
}
/* Set current demangling style. Called by the "set demangle-style"
command after it has updated the current_demangling_style_string to
match what the user has entered.
If the user has entered a string that matches a known demangling style
name in the demanglers[] array then just leave the string alone and update
the current_demangling_style enum value to match.
If the user has entered a string that doesn't match, including an empty
string, then print a list of the currently known styles and restore
the current_demangling_style_string to match the current_demangling_style
enum value.
Note: Assumes that current_demangling_style_string always points to
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
a malloc'd string, even if it is a null-string. */
static void
2000-07-30 03:48:28 +02:00
set_demangling_command (char *ignore, int from_tty, struct cmd_list_element *c)
{
const struct demangler_engine *dem;
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
int i;
/* First just try to match whatever style name the user supplied with
one of the known ones. Don't bother special casing for an empty
name, we just treat it as any other style name that doesn't match.
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 we match, update the current demangling style enum. */
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
for (dem = libiberty_demanglers, i = 0;
dem->demangling_style != unknown_demangling;
dem++)
{
if (strcmp (current_demangling_style_string,
dem->demangling_style_name) == 0)
{
current_demangling_style = dem->demangling_style;
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
current_demangling_style_string = demangling_style_names[i];
break;
}
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
i++;
}
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
/* We should have found a match, given we only add known styles to
the enumeration list. */
gdb_assert (dem->demangling_style != unknown_demangling);
}
* c-exp.y (THIS): Delete token and grammar rule. (yylex): Don't return THIS. * cp-valprint.c (vtbl_ptr_name_old): Delete. (cp_is_vtbl_ptr_type): Don't check vtbl_ptr_name_old. * demangle.c (cplus_markers): Update comment. Put '$' first. Remove CPLUS_MARKER. (_initialize_demangler): Don't call set_cplus_marker_for_demangling. * jv-exp.y (THIS): Delete token and grammar rule. (yylex): Don't return THIS. * mips-tdep.c (mips_dump_tdep): Don't dump CPLUS_MARKER. * objc-exp.y (THIS): Delete token and grammar rule. (yylex): Don't return THIS. * p-exp.y (yylex): Remove reference to CPLUS_MARKER. * stabsread.c (vptr_name, vb_name): Replace CPLUS_MARKER with '$'. (read_member_functions): Likewise for opname. (read_tilde_fields): Use is_cplus_marker. * defs.h (CPLUS_MARKER): Don't define. * config/tm-sysv4.h (CPLUS_MARKER): Likewise. * config/i386/xm-i386sco.h (CPLUS_MARKER): Likewise. * config/mips/tm-irix3.h (CPLUS_MARKER): Likewise. * config/mips/tm-irix6.h (CPLUS_MARKER): Likewise. * config/rs6000/tm-rs6000.h (CPLUS_MARKER): Likewise. * config/i386/tm-i386v4.h: Delete file. * config/djgpp/fnchange.lst: Delete tm-i386v4.h. * config/i386/tm-i386sol2.h: Include "i386/tm-i386.h" instead. * config/i386/tm-i386v42mp.h: Include "i386/tm-i386.h" instead. * config/i386/tm-ptx.h: Include "i386/tm-i386.h" instead. * config/i386/i386gnu.mt (TM_FILE): Use tm-i386.h. * config/i386/i386sco5.mt (TM_FILE): Likewise. * config/i386/i386v4.mt (TM_FILE): Likewise. * config/i386/ncr3000.mt (TM_FILE): Likewise.
2002-10-11 16:02:39 +02:00
/* G++ uses a special character to indicate certain internal names. Which
character it is depends on the platform:
- Usually '$' on systems where the assembler will accept that
- Usually '.' otherwise (this includes most sysv4-like systems and most
ELF targets)
- Occasionally '_' if neither of the above is usable
We check '$' first because it is the safest, and '.' often has another
meaning. We don't currently try to handle '_' because the precise forms
of the names are different on those targets. */
static char cplus_markers[] = {'$', '.', '\0'};
/* See documentation in gdb-demangle.h. */
int
2000-07-30 03:48:28 +02:00
is_cplus_marker (int c)
{
return c && strchr (cplus_markers, c) != NULL;
}
extern initialize_file_ftype _initialize_demangler; /* -Wmissing-prototypes */
void
2000-07-30 03:48:28 +02:00
_initialize_demangler (void)
{
int i, ndems;
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
/* Fill the demangling_style_names[] array, and set the default
demangling style chosen at compilation time. */
for (ndems = 0;
libiberty_demanglers[ndems].demangling_style != unknown_demangling;
ndems++)
;
demangling_style_names = xcalloc (ndems + 1, sizeof (char *));
for (i = 0;
libiberty_demanglers[i].demangling_style != unknown_demangling;
i++)
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
{
demangling_style_names[i]
= xstrdup (libiberty_demanglers[i].demangling_style_name);
if (current_demangling_style_string == NULL
&& strcmp (DEFAULT_DEMANGLING_STYLE, demangling_style_names[i]) == 0)
current_demangling_style_string = demangling_style_names[i];
}
add_setshow_boolean_cmd ("demangle", class_support, &demangle, _("\
Set demangling of encoded C++/ObjC names when displaying symbols."), _("\
Show demangling of encoded C++/ObjC names when displaying symbols."), NULL,
NULL,
show_demangle,
&setprintlist, &showprintlist);
add_setshow_boolean_cmd ("asm-demangle", class_support, &asm_demangle, _("\
Set demangling of C++/ObjC names in disassembly listings."), _("\
Show demangling of C++/ObjC names in disassembly listings."), NULL,
NULL,
show_asm_demangle,
&setprintlist, &showprintlist);
add_setshow_enum_cmd ("demangle-style", class_support,
demangling_style_names,
Fix completer.c FIXME, and invalid pointer to pointer conversion. As mentioned in the previous patch, I grepped for "\*\*) &" and found one hit in completer.c. I was about to post a patch that simply made current_demangling_style_string const, and cast away constness at the xfree site. However, looking deeper, it seem to be there's a lot of dead code in the file. First, all external callers of set_demangling_style are found in the stabs reader, commented out for over 12 years: http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html I don't think it's likely we'll ever make the older mangling schemes work for stabs. If we do, we can rediscuss the approach then. Then, set_demangling_command has special handling for unknown demangling styles, but "set demangle-style" is an enum command, and with those, the user can only specify a known enumeration value, by design: (gdb) set demangle-style gangnam-style Undefined item: "gangnam-style". This patch removes all that dead code, then makes current_demangling_style_string point to an element of demangling_style_names, as the FIXME suggests, and then makes current_demangling_style_string, removing the need for the 'const char **' cast. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * dbxread.c (read_ofile_symtab, process_one_symbol): Remove commented out code. * demangle.c (current_demangling_style_string): Make it const. (set_demangling_command): Assert the demangling style is known. Remove all handling of unknown styles. Set 'current_demangling_style_string' to an element of the demangling_style_names array. (set_demangling_style): Delete. (_initialize_demangler): Set current_demangling_style_string to the element of the demangling_style_names array that corresponds to the default demangling style. Remove FIXME note. Don't call set_demangling_style. * gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 19:38:12 +01:00
&current_demangling_style_string, _("\
Set the current C++ demangling style."), _("\
Show the current C++ demangling style."), _("\
Use `set demangle-style' without arguments for a list of demangling styles."),
set_demangling_command,
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
show_demangling_style_names,
&setlist, &showlist);
}