2002-05-16 21:15:53 +00:00
|
|
|
|
/* C preprocessor macro expansion commands for GDB.
|
2014-01-01 03:54:24 +00:00
|
|
|
|
Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
2002-05-16 21:15:53 +00:00
|
|
|
|
Contributed by Red Hat, Inc.
|
|
|
|
|
|
|
|
|
|
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
|
2007-08-23 18:08:50 +00:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-05-16 21:15:53 +00:00
|
|
|
|
(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
|
2007-08-23 18:08:50 +00:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "macrotab.h"
|
|
|
|
|
#include "macroexp.h"
|
|
|
|
|
#include "macroscope.h"
|
2011-11-12 17:01:12 +00:00
|
|
|
|
#include "cli/cli-utils.h"
|
2002-05-16 21:15:53 +00:00
|
|
|
|
#include "command.h"
|
|
|
|
|
#include "gdbcmd.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 14:14:23 +00:00
|
|
|
|
#include <string.h>
|
2012-06-29 22:46:46 +00:00
|
|
|
|
#include "linespec.h"
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* The `macro' prefix command. */
|
|
|
|
|
|
|
|
|
|
static struct cmd_list_element *macrolist;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
macro_command (char *arg, int from_tty)
|
|
|
|
|
{
|
|
|
|
|
printf_unfiltered
|
|
|
|
|
("\"macro\" must be followed by the name of a macro command.\n");
|
|
|
|
|
help_list (macrolist, "macro ", -1, gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Macro expansion commands. */
|
|
|
|
|
|
|
|
|
|
|
2011-11-12 17:01:12 +00:00
|
|
|
|
/* Prints an informational message regarding the lack of macro information. */
|
2013-07-01 19:52:32 +00:00
|
|
|
|
static void
|
|
|
|
|
macro_inform_no_debuginfo (void)
|
2011-11-12 17:01:12 +00:00
|
|
|
|
{
|
2013-01-11 21:34:29 +00:00
|
|
|
|
puts_filtered ("GDB has no preprocessor macro information for that code.\n");
|
2011-11-12 17:01:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-05-16 21:15:53 +00:00
|
|
|
|
static void
|
|
|
|
|
macro_expand_command (char *exp, int from_tty)
|
|
|
|
|
{
|
|
|
|
|
struct macro_scope *ms = NULL;
|
|
|
|
|
char *expanded = NULL;
|
|
|
|
|
struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms);
|
2010-05-16 00:18:02 +00:00
|
|
|
|
|
2002-05-16 21:15:53 +00:00
|
|
|
|
make_cleanup (free_current_contents, &expanded);
|
|
|
|
|
|
|
|
|
|
/* You know, when the user doesn't specify any expression, it would be
|
|
|
|
|
really cool if this defaulted to the last expression evaluated.
|
|
|
|
|
Then it would be easy to ask, "Hey, what did I just evaluate?" But
|
|
|
|
|
at the moment, the `print' commands don't save the last expression
|
|
|
|
|
evaluated, just its value. */
|
|
|
|
|
if (! exp || ! *exp)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
|
error (_("You must follow the `macro expand' command with the"
|
2002-05-16 21:15:53 +00:00
|
|
|
|
" expression you\n"
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
|
"want to expand."));
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
ms = default_macro_scope ();
|
|
|
|
|
if (ms)
|
|
|
|
|
{
|
|
|
|
|
expanded = macro_expand (exp, standard_macro_lookup, ms);
|
|
|
|
|
fputs_filtered ("expands to: ", gdb_stdout);
|
|
|
|
|
fputs_filtered (expanded, gdb_stdout);
|
|
|
|
|
fputs_filtered ("\n", gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
else
|
2011-11-12 17:01:12 +00:00
|
|
|
|
macro_inform_no_debuginfo ();
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
do_cleanups (cleanup_chain);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
macro_expand_once_command (char *exp, int from_tty)
|
|
|
|
|
{
|
|
|
|
|
struct macro_scope *ms = NULL;
|
|
|
|
|
char *expanded = NULL;
|
|
|
|
|
struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms);
|
|
|
|
|
make_cleanup (free_current_contents, &expanded);
|
|
|
|
|
|
|
|
|
|
/* You know, when the user doesn't specify any expression, it would be
|
|
|
|
|
really cool if this defaulted to the last expression evaluated.
|
|
|
|
|
And it should set the once-expanded text as the new `last
|
|
|
|
|
expression'. That way, you could just hit return over and over and
|
|
|
|
|
see the expression expanded one level at a time. */
|
|
|
|
|
if (! exp || ! *exp)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
|
error (_("You must follow the `macro expand-once' command with"
|
2002-05-16 21:15:53 +00:00
|
|
|
|
" the expression\n"
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
|
"you want to expand."));
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
ms = default_macro_scope ();
|
|
|
|
|
if (ms)
|
|
|
|
|
{
|
|
|
|
|
expanded = macro_expand_once (exp, standard_macro_lookup, ms);
|
|
|
|
|
fputs_filtered ("expands to: ", gdb_stdout);
|
|
|
|
|
fputs_filtered (expanded, gdb_stdout);
|
|
|
|
|
fputs_filtered ("\n", gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
else
|
2011-11-12 17:01:12 +00:00
|
|
|
|
macro_inform_no_debuginfo ();
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
do_cleanups (cleanup_chain);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-21 15:13:30 +00:00
|
|
|
|
/* Outputs the include path of a macro starting at FILE and LINE to STREAM.
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
2011-07-21 15:13:30 +00:00
|
|
|
|
Care should be taken that this function does not cause any lookups into
|
|
|
|
|
the splay tree so that it can be safely used while iterating. */
|
2002-05-16 21:15:53 +00:00
|
|
|
|
static void
|
|
|
|
|
show_pp_source_pos (struct ui_file *stream,
|
|
|
|
|
struct macro_source_file *file,
|
|
|
|
|
int line)
|
|
|
|
|
{
|
2013-02-03 16:25:56 +00:00
|
|
|
|
char *fullname;
|
|
|
|
|
|
|
|
|
|
fullname = macro_source_fullname (file);
|
|
|
|
|
fprintf_filtered (stream, "%s:%d\n", fullname, line);
|
|
|
|
|
xfree (fullname);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
while (file->included_by)
|
|
|
|
|
{
|
2013-02-03 16:25:56 +00:00
|
|
|
|
fullname = macro_source_fullname (file->included_by);
|
|
|
|
|
fprintf_filtered (gdb_stdout, " included at %s:%d\n", fullname,
|
2002-05-16 21:15:53 +00:00
|
|
|
|
file->included_at_line);
|
2013-02-03 16:25:56 +00:00
|
|
|
|
xfree (fullname);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
file = file->included_by;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-21 15:13:30 +00:00
|
|
|
|
/* Outputs a macro for human consumption, detailing the include path
|
|
|
|
|
and macro definition. NAME is the name of the macro.
|
|
|
|
|
D the definition. FILE the start of the include path, and LINE the
|
|
|
|
|
line number in FILE.
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
2011-07-21 15:13:30 +00:00
|
|
|
|
Care should be taken that this function does not cause any lookups into
|
|
|
|
|
the splay tree so that it can be safely used while iterating. */
|
2002-05-16 21:15:53 +00:00
|
|
|
|
static void
|
2011-07-21 15:13:30 +00:00
|
|
|
|
print_macro_definition (const char *name,
|
|
|
|
|
const struct macro_definition *d,
|
|
|
|
|
struct macro_source_file *file,
|
|
|
|
|
int line)
|
2002-05-16 21:15:53 +00:00
|
|
|
|
{
|
2014-05-14 19:31:10 +00:00
|
|
|
|
fprintf_filtered (gdb_stdout, "Defined at ");
|
|
|
|
|
show_pp_source_pos (gdb_stdout, file, line);
|
|
|
|
|
|
|
|
|
|
if (line != 0)
|
|
|
|
|
fprintf_filtered (gdb_stdout, "#define %s", name);
|
|
|
|
|
else
|
|
|
|
|
fprintf_filtered (gdb_stdout, "-D%s", name);
|
|
|
|
|
|
|
|
|
|
if (d->kind == macro_function_like)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
fputs_filtered ("(", gdb_stdout);
|
|
|
|
|
for (i = 0; i < d->argc; i++)
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered (d->argv[i], gdb_stdout);
|
|
|
|
|
if (i + 1 < d->argc)
|
|
|
|
|
fputs_filtered (", ", gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
fputs_filtered (")", gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (line != 0)
|
|
|
|
|
fprintf_filtered (gdb_stdout, " %s\n", d->replacement);
|
|
|
|
|
else
|
|
|
|
|
fprintf_filtered (gdb_stdout, "=%s\n", d->replacement);
|
2011-07-21 15:13:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A callback function for usage with macro_for_each and friends.
|
|
|
|
|
If USER_DATA is null all macros will be printed.
|
|
|
|
|
Otherwise USER_DATA is considered to be a string, printing
|
|
|
|
|
only macros who's NAME matches USER_DATA. Other arguments are
|
|
|
|
|
routed to print_macro_definition. */
|
|
|
|
|
static void
|
|
|
|
|
print_macro_callback (const char *name, const struct macro_definition *macro,
|
|
|
|
|
struct macro_source_file *source, int line,
|
|
|
|
|
void *user_data)
|
|
|
|
|
{
|
|
|
|
|
if (! user_data || strcmp (user_data, name) == 0)
|
|
|
|
|
print_macro_definition (name, macro, source, line);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-12 17:01:12 +00:00
|
|
|
|
/* The implementation of the `info macro' command. */
|
2011-07-21 15:13:30 +00:00
|
|
|
|
static void
|
2011-11-12 17:01:12 +00:00
|
|
|
|
info_macro_command (char *args, int from_tty)
|
2011-07-21 15:13:30 +00:00
|
|
|
|
{
|
|
|
|
|
struct macro_scope *ms = NULL;
|
2011-11-12 17:01:12 +00:00
|
|
|
|
struct cleanup *cleanup_chain;
|
|
|
|
|
char *name;
|
|
|
|
|
int show_all_macros_named = 0;
|
|
|
|
|
char *arg_start = args;
|
|
|
|
|
int processing_args = 1;
|
|
|
|
|
|
|
|
|
|
while (processing_args
|
|
|
|
|
&& arg_start && *arg_start == '-' && *arg_start != '\0')
|
|
|
|
|
{
|
|
|
|
|
char *p = skip_to_space (arg_start);
|
|
|
|
|
|
|
|
|
|
if (strncmp (arg_start, "-a", p - arg_start) == 0
|
|
|
|
|
|| strncmp (arg_start, "-all", p - arg_start) == 0)
|
|
|
|
|
show_all_macros_named = 1;
|
|
|
|
|
else if (strncmp (arg_start, "--", p - arg_start) == 0)
|
|
|
|
|
/* Our macro support seems rather C specific but this would
|
|
|
|
|
seem necessary for languages allowing - in macro names.
|
|
|
|
|
e.g. Scheme's (defmacro ->foo () "bar\n") */
|
|
|
|
|
processing_args = 0;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Relies on modified 'args' not making it in to history */
|
|
|
|
|
*p = '\0';
|
|
|
|
|
error (_("Unrecognized option '%s' to info macro command. "
|
|
|
|
|
"Try \"help info macro\"."), arg_start);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
arg_start = skip_spaces (p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name = arg_start;
|
2011-07-21 15:13:30 +00:00
|
|
|
|
|
|
|
|
|
if (! name || ! *name)
|
2011-11-12 17:01:12 +00:00
|
|
|
|
error (_("You must follow the `info macro' command with the name"
|
|
|
|
|
" of the macro\n"
|
|
|
|
|
"whose definition you want to see."));
|
2011-07-21 15:13:30 +00:00
|
|
|
|
|
|
|
|
|
ms = default_macro_scope ();
|
2011-11-12 17:01:12 +00:00
|
|
|
|
cleanup_chain = make_cleanup (free_current_contents, &ms);
|
2011-07-21 15:13:30 +00:00
|
|
|
|
|
2011-11-12 17:01:12 +00:00
|
|
|
|
if (! ms)
|
|
|
|
|
macro_inform_no_debuginfo ();
|
|
|
|
|
else if (show_all_macros_named)
|
|
|
|
|
macro_for_each (ms->file->table, print_macro_callback, name);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
struct macro_definition *d;
|
|
|
|
|
|
|
|
|
|
d = macro_lookup_definition (ms->file, ms->line, name);
|
|
|
|
|
if (d)
|
|
|
|
|
{
|
|
|
|
|
int line;
|
|
|
|
|
struct macro_source_file *file
|
|
|
|
|
= macro_definition_location (ms->file, ms->line, name, &line);
|
|
|
|
|
|
|
|
|
|
print_macro_definition (name, d, file, line);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (gdb_stdout,
|
|
|
|
|
"The symbol `%s' has no definition as a C/C++"
|
|
|
|
|
" preprocessor macro\n"
|
|
|
|
|
"at ", name);
|
|
|
|
|
show_pp_source_pos (gdb_stdout, ms->file, ms->line);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-07-21 15:13:30 +00:00
|
|
|
|
|
|
|
|
|
do_cleanups (cleanup_chain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Implementation of the "info macros" command. */
|
|
|
|
|
static void
|
|
|
|
|
info_macros_command (char *args, int from_tty)
|
|
|
|
|
{
|
|
|
|
|
struct macro_scope *ms = NULL;
|
|
|
|
|
struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms);
|
|
|
|
|
|
|
|
|
|
if (args == NULL)
|
|
|
|
|
ms = default_macro_scope ();
|
|
|
|
|
else
|
|
|
|
|
{
|
2012-06-29 22:46:46 +00:00
|
|
|
|
struct symtabs_and_lines sals =
|
|
|
|
|
decode_line_with_current_source (args, 0);
|
2011-07-21 15:13:30 +00:00
|
|
|
|
|
|
|
|
|
if (sals.nelts)
|
|
|
|
|
ms = sal_macro_scope (sals.sals[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! ms || ! ms->file || ! ms->file->table)
|
2011-11-12 17:01:12 +00:00
|
|
|
|
macro_inform_no_debuginfo ();
|
|
|
|
|
else
|
|
|
|
|
macro_for_each_in_scope (ms->file, ms->line, print_macro_callback, NULL);
|
2011-07-21 15:13:30 +00:00
|
|
|
|
|
|
|
|
|
do_cleanups (cleanup_chain);
|
|
|
|
|
}
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* User-defined macros. */
|
|
|
|
|
|
2008-07-18 20:55:33 +00:00
|
|
|
|
static void
|
|
|
|
|
skip_ws (char **expp)
|
|
|
|
|
{
|
|
|
|
|
while (macro_is_whitespace (**expp))
|
|
|
|
|
++*expp;
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-27 21:40:49 +00:00
|
|
|
|
/* Try to find the bounds of an identifier. If an identifier is
|
|
|
|
|
found, returns a newly allocated string; otherwise returns NULL.
|
|
|
|
|
EXPP is a pointer to an input string; it is updated to point to the
|
|
|
|
|
text following the identifier. If IS_PARAMETER is true, this
|
|
|
|
|
function will also allow "..." forms as used in varargs macro
|
|
|
|
|
parameters. */
|
|
|
|
|
|
2008-07-18 20:55:33 +00:00
|
|
|
|
static char *
|
2008-09-27 21:40:49 +00:00
|
|
|
|
extract_identifier (char **expp, int is_parameter)
|
2008-07-18 20:55:33 +00:00
|
|
|
|
{
|
|
|
|
|
char *result;
|
|
|
|
|
char *p = *expp;
|
|
|
|
|
unsigned int len;
|
2008-09-27 21:40:49 +00:00
|
|
|
|
|
|
|
|
|
if (is_parameter && !strncmp (p, "...", 3))
|
|
|
|
|
{
|
|
|
|
|
/* Ok. */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (! *p || ! macro_is_identifier_nondigit (*p))
|
|
|
|
|
return NULL;
|
|
|
|
|
for (++p;
|
|
|
|
|
*p && (macro_is_identifier_nondigit (*p) || macro_is_digit (*p));
|
|
|
|
|
++p)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_parameter && !strncmp (p, "...", 3))
|
|
|
|
|
p += 3;
|
|
|
|
|
|
2008-07-18 20:55:33 +00:00
|
|
|
|
len = p - *expp;
|
|
|
|
|
result = (char *) xmalloc (len + 1);
|
|
|
|
|
memcpy (result, *expp, len);
|
|
|
|
|
result[len] = '\0';
|
|
|
|
|
*expp += len;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Helper function to clean up a temporarily-constructed macro object.
|
|
|
|
|
This assumes that the contents were all allocated with xmalloc. */
|
|
|
|
|
static void
|
|
|
|
|
free_macro_definition_ptr (void *ptr)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
struct macro_definition *loc = (struct macro_definition *) ptr;
|
2010-05-16 00:18:02 +00:00
|
|
|
|
|
2008-07-18 20:55:33 +00:00
|
|
|
|
for (i = 0; i < loc->argc; ++i)
|
|
|
|
|
xfree ((char *) loc->argv[i]);
|
|
|
|
|
xfree ((char *) loc->argv);
|
|
|
|
|
/* Note that the 'replacement' field is not allocated. */
|
|
|
|
|
}
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
macro_define_command (char *exp, int from_tty)
|
|
|
|
|
{
|
2008-07-18 20:55:33 +00:00
|
|
|
|
struct macro_definition new_macro;
|
|
|
|
|
char *name = NULL;
|
2008-08-14 18:03:22 +00:00
|
|
|
|
struct cleanup *cleanup_chain;
|
|
|
|
|
|
|
|
|
|
if (!exp)
|
|
|
|
|
error (_("usage: macro define NAME[(ARGUMENT-LIST)] [REPLACEMENT-LIST]"));
|
|
|
|
|
|
|
|
|
|
cleanup_chain = make_cleanup (free_macro_definition_ptr, &new_macro);
|
2008-07-18 20:55:33 +00:00
|
|
|
|
make_cleanup (free_current_contents, &name);
|
|
|
|
|
|
|
|
|
|
memset (&new_macro, 0, sizeof (struct macro_definition));
|
|
|
|
|
|
|
|
|
|
skip_ws (&exp);
|
2008-09-27 21:40:49 +00:00
|
|
|
|
name = extract_identifier (&exp, 0);
|
2008-07-18 20:55:33 +00:00
|
|
|
|
if (! name)
|
|
|
|
|
error (_("Invalid macro name."));
|
|
|
|
|
if (*exp == '(')
|
|
|
|
|
{
|
|
|
|
|
/* Function-like macro. */
|
|
|
|
|
int alloced = 5;
|
|
|
|
|
char **argv = (char **) xmalloc (alloced * sizeof (char *));
|
|
|
|
|
|
|
|
|
|
new_macro.kind = macro_function_like;
|
|
|
|
|
new_macro.argc = 0;
|
|
|
|
|
new_macro.argv = (const char * const *) argv;
|
|
|
|
|
|
|
|
|
|
/* Skip the '(' and whitespace. */
|
|
|
|
|
++exp;
|
|
|
|
|
skip_ws (&exp);
|
|
|
|
|
|
|
|
|
|
while (*exp != ')')
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (new_macro.argc == alloced)
|
|
|
|
|
{
|
|
|
|
|
alloced *= 2;
|
|
|
|
|
argv = (char **) xrealloc (argv, alloced * sizeof (char *));
|
2011-01-09 03:20:33 +00:00
|
|
|
|
/* Must update new_macro as well... */
|
2008-07-18 20:55:33 +00:00
|
|
|
|
new_macro.argv = (const char * const *) argv;
|
|
|
|
|
}
|
2008-09-27 21:40:49 +00:00
|
|
|
|
argv[new_macro.argc] = extract_identifier (&exp, 1);
|
2008-07-18 20:55:33 +00:00
|
|
|
|
if (! argv[new_macro.argc])
|
|
|
|
|
error (_("Macro is missing an argument."));
|
|
|
|
|
++new_macro.argc;
|
|
|
|
|
|
|
|
|
|
for (i = new_macro.argc - 2; i >= 0; --i)
|
|
|
|
|
{
|
|
|
|
|
if (! strcmp (argv[i], argv[new_macro.argc - 1]))
|
|
|
|
|
error (_("Two macro arguments with identical names."));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
skip_ws (&exp);
|
|
|
|
|
if (*exp == ',')
|
|
|
|
|
{
|
|
|
|
|
++exp;
|
|
|
|
|
skip_ws (&exp);
|
|
|
|
|
}
|
|
|
|
|
else if (*exp != ')')
|
|
|
|
|
error (_("',' or ')' expected at end of macro arguments."));
|
|
|
|
|
}
|
|
|
|
|
/* Skip the closing paren. */
|
|
|
|
|
++exp;
|
2008-12-12 16:58:46 +00:00
|
|
|
|
skip_ws (&exp);
|
2008-07-18 20:55:33 +00:00
|
|
|
|
|
|
|
|
|
macro_define_function (macro_main (macro_user_macros), -1, name,
|
|
|
|
|
new_macro.argc, (const char **) new_macro.argv,
|
|
|
|
|
exp);
|
|
|
|
|
}
|
|
|
|
|
else
|
2008-12-12 16:58:46 +00:00
|
|
|
|
{
|
|
|
|
|
skip_ws (&exp);
|
|
|
|
|
macro_define_object (macro_main (macro_user_macros), -1, name, exp);
|
|
|
|
|
}
|
2008-07-18 20:55:33 +00:00
|
|
|
|
|
|
|
|
|
do_cleanups (cleanup_chain);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
macro_undef_command (char *exp, int from_tty)
|
|
|
|
|
{
|
2008-07-18 20:55:33 +00:00
|
|
|
|
char *name;
|
2008-08-14 18:03:22 +00:00
|
|
|
|
|
|
|
|
|
if (!exp)
|
|
|
|
|
error (_("usage: macro undef NAME"));
|
|
|
|
|
|
2008-07-18 20:55:33 +00:00
|
|
|
|
skip_ws (&exp);
|
2008-09-27 21:40:49 +00:00
|
|
|
|
name = extract_identifier (&exp, 0);
|
2008-07-18 20:55:33 +00:00
|
|
|
|
if (! name)
|
|
|
|
|
error (_("Invalid macro name."));
|
|
|
|
|
macro_undef (macro_main (macro_user_macros), -1, name);
|
|
|
|
|
xfree (name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2008-09-30 17:21:28 +00:00
|
|
|
|
print_one_macro (const char *name, const struct macro_definition *macro,
|
2011-07-21 15:13:30 +00:00
|
|
|
|
struct macro_source_file *source, int line,
|
2008-09-30 17:21:28 +00:00
|
|
|
|
void *ignore)
|
2008-07-18 20:55:33 +00:00
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (gdb_stdout, "macro define %s", name);
|
|
|
|
|
if (macro->kind == macro_function_like)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2010-05-16 00:18:02 +00:00
|
|
|
|
|
2008-07-18 20:55:33 +00:00
|
|
|
|
fprintf_filtered (gdb_stdout, "(");
|
|
|
|
|
for (i = 0; i < macro->argc; ++i)
|
|
|
|
|
fprintf_filtered (gdb_stdout, "%s%s", (i > 0) ? ", " : "",
|
|
|
|
|
macro->argv[i]);
|
|
|
|
|
fprintf_filtered (gdb_stdout, ")");
|
|
|
|
|
}
|
2008-12-12 16:58:46 +00:00
|
|
|
|
fprintf_filtered (gdb_stdout, " %s\n", macro->replacement);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
macro_list_command (char *exp, int from_tty)
|
|
|
|
|
{
|
2008-09-30 17:21:28 +00:00
|
|
|
|
macro_for_each (macro_user_macros, print_one_macro, NULL);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Initializing the `macrocmd' module. */
|
|
|
|
|
|
2003-06-11 13:16:30 +00:00
|
|
|
|
extern initialize_file_ftype _initialize_macrocmd; /* -Wmissing-prototypes */
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
|
|
2002-05-16 21:15:53 +00:00
|
|
|
|
void
|
|
|
|
|
_initialize_macrocmd (void)
|
|
|
|
|
{
|
|
|
|
|
/* We introduce a new command prefix, `macro', under which we'll put
|
|
|
|
|
the various commands for working with preprocessor macros. */
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 15:49:28 +00:00
|
|
|
|
add_prefix_cmd ("macro", class_info, macro_command,
|
|
|
|
|
_("Prefix for commands dealing with C preprocessor macros."),
|
|
|
|
|
¯olist, "macro ", 0, &cmdlist);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 18:10:11 +00:00
|
|
|
|
add_cmd ("expand", no_class, macro_expand_command, _("\
|
|
|
|
|
Fully expand any C/C++ preprocessor macro invocations in EXPRESSION.\n\
|
|
|
|
|
Show the expanded expression."),
|
|
|
|
|
¯olist);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
add_alias_cmd ("exp", "expand", no_class, 1, ¯olist);
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 18:10:11 +00:00
|
|
|
|
add_cmd ("expand-once", no_class, macro_expand_once_command, _("\
|
|
|
|
|
Expand C/C++ preprocessor macro invocations appearing directly in EXPRESSION.\n\
|
|
|
|
|
Show the expanded expression.\n\
|
|
|
|
|
\n\
|
|
|
|
|
This command differs from `macro expand' in that it only expands macro\n\
|
|
|
|
|
invocations that appear directly in EXPRESSION; if expanding a macro\n\
|
|
|
|
|
introduces further macro invocations, those are left unexpanded.\n\
|
|
|
|
|
\n\
|
|
|
|
|
`macro expand-once' helps you see how a particular macro expands,\n\
|
|
|
|
|
whereas `macro expand' shows you how all the macros involved in an\n\
|
|
|
|
|
expression work together to yield a pre-processed expression."),
|
|
|
|
|
¯olist);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
add_alias_cmd ("exp1", "expand-once", no_class, 1, ¯olist);
|
|
|
|
|
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 18:10:11 +00:00
|
|
|
|
add_cmd ("macro", no_class, info_macro_command,
|
2011-11-12 17:01:12 +00:00
|
|
|
|
_("Show the definition of MACRO, and it's source location.\n\
|
|
|
|
|
Usage: info macro [-a|-all] [--] MACRO\n\
|
|
|
|
|
Options: \n\
|
|
|
|
|
-a, --all Output all definitions of MACRO in the current compilation\
|
|
|
|
|
unit.\n\
|
|
|
|
|
-- Specify the end of arguments and the beginning of the MACRO."),
|
|
|
|
|
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 18:10:11 +00:00
|
|
|
|
&infolist);
|
|
|
|
|
|
2011-07-21 15:13:30 +00:00
|
|
|
|
add_cmd ("macros", no_class, info_macros_command,
|
|
|
|
|
_("Show the definitions of all macros at LINESPEC, or the current \
|
|
|
|
|
source location.\n\
|
|
|
|
|
Usage: info macros [LINESPEC]"),
|
|
|
|
|
&infolist);
|
|
|
|
|
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 18:10:11 +00:00
|
|
|
|
add_cmd ("define", no_class, macro_define_command, _("\
|
|
|
|
|
Define a new C/C++ preprocessor macro.\n\
|
|
|
|
|
The GDB command `macro define DEFINITION' is equivalent to placing a\n\
|
|
|
|
|
preprocessor directive of the form `#define DEFINITION' such that the\n\
|
|
|
|
|
definition is visible in all the inferior's source files.\n\
|
|
|
|
|
For example:\n\
|
|
|
|
|
(gdb) macro define PI (3.1415926)\n\
|
|
|
|
|
(gdb) macro define MIN(x,y) ((x) < (y) ? (x) : (y))"),
|
|
|
|
|
¯olist);
|
|
|
|
|
|
|
|
|
|
add_cmd ("undef", no_class, macro_undef_command, _("\
|
|
|
|
|
Remove the definition of the C/C++ preprocessor macro with the given name."),
|
|
|
|
|
¯olist);
|
|
|
|
|
|
|
|
|
|
add_cmd ("list", no_class, macro_list_command,
|
|
|
|
|
_("List all the macros defined using the `macro define' command."),
|
|
|
|
|
¯olist);
|
2002-05-16 21:15:53 +00:00
|
|
|
|
}
|