This changes various flags struct cmd_list_element into bitfields. In
general I think bitfields are cleaner than flag words, at least in a
case like this where there is no need to pass the flags around
independently of the enclosing struct.
2014-01-20 Tom Tromey <tromey@redhat.com>
* cli/cli-decode.c (add_cmd, deprecate_cmd, add_alias_cmd)
(add_setshow_cmd_full, delete_cmd, lookup_cmd_1)
(deprecated_cmd_warning, complete_on_cmdlist): Update.
* cli/cli-decode.h (CMD_DEPRECATED, DEPRECATED_WARN_USER)
(MALLOCED_REPLACEMENT, DOC_ALLOCATED): Remove.
(struct cmd_list_element) <flags>: Remove.
<cmd_deprecated, deprecated_warn_user, malloced_replacement,
doc_allocated>: New fields.
<hook_in, allow_unknown, abbrev_flag, type, var_type>: Now
bitfields.
* maint.c (maintenance_do_deprecate): Update.
* top.c (execute_command): Update.
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.
PR gdb/10462
* cli/cli-decode.c (lookup_command): Show an error if there is no space
before argument.
2013-04-24 Muhammad Bilal <mbilal@codesourcery.com>
PR gdb/10462
* gdb.base/setshow.exp: Add test case.
Currently, several commands take "0" or "-1" to mean "unlimited".
"show" knows when to print "unlimited":
(gdb) show height
Number of lines gdb thinks are in a page is 45.
(gdb) set height 0
(gdb) show height
Number of lines gdb thinks are in a page is unlimited.
However, the user can't herself specify "unlimited" directly:
(gdb) set height unlimited
No symbol table is loaded. Use the "file" command.
(gdb)
This patch addresses that, by adjusting the set handler for all
integer/uinteger/zuinteger_unlimited commands to accept literal
"unlimited". It also installs a completer. Presently, we complete on
symbols by default, and at
<http://sourceware.org/ml/gdb-patches/2013-03/msg00864.html> I've
shown a WIP prototype that tried to keep that half working in these
commands. In the end, it turned out to be more complicated than
justifiable, IMO. It's super rare to want to pass the value of a
variable/symbol in the program to a GDB set/show knob. That'll still
work, it's just that we won't assist with completion anymore. This
patch just sticks with the simple, and completes on "unlimited", and
nothing else. This simplification means that
"set he<tab><tab>"
is all it takes to get to:
"set height unlimited"
The patch then goes through all integer/uinteger/zuinteger_unlimited
commands in the tree, and updates both the online help and the manual
to mention that "unlimited" is accepted in addition to 0/-1. In the
cases where the command had no online help text at all, this adds it.
I've tried to make the texts read in a way that "unlimited" is
suggested before "0" or "-1" is.
Tested on x86_64 Fedora 17.
gdb/
2013-04-10 Pedro Alves <palves@redhat.com>
* cli/cli-decode.c (integer_unlimited_completer): New function.
(add_setshow_integer_cmd, add_setshow_uinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd): Install the "unlimited"
completer.
* cli/cli-setshow.c: Include "cli/cli-utils.h".
(is_unlimited_literal): New function.
(do_set_command): Handle literal "unlimited" arguments.
* frame.c (_initialize_frame) <set backtrace limit>: Document
"unlimited".
* printcmd.c (_initialize_printcmd) <set print
max-symbolic-offset>: Add help text.
* record-full.c (_initialize_record_full) <set record full
insn-number-max>: Likewise.
* record.c (_initialize_record) <set record
instruction-history-size, set record function-call-history-size>:
Add help text.
* ser-tcp.c (_initialize_ser_tcp) <set tcp connect-timeout>: Add
help text.
* tracepoint.c (_initialize_tracepoint) <set trace-buffer-size>:
Likewise.
* source.c (_initialize_source) <set listsize>: Add help text.
* utils.c (initialize_utils) <set height, set width>: Likewise.
<set pagination>: Mention "set height unlimited".
* valprint.c (_initialize_valprint) <set print elements, set print
repeats>: Document "unlimited".
gdb/doc/
2013-04-10 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Process Record and Replay): Document that "set
record full insn-number-max", "set record
instruction-history-size" and "set record
function-call-history-size" accept "unlimited".
(Backtrace): Document that "set backtrace limit" accepts
"unlimited".
(List): Document that "set listsize" accepts "unlimited".
(Print Settings)" Document that "set print max-symbolic-offset",
"set print elements" and "set print repeats" accept "unlimited".
(Starting and Stopping Trace Experiments): Document that "set
trace-buffer-size" accepts "unlimited".
(Remote Configuration): Document that "set tcp connect-timeout"
accepts "unlimited".
(Command History): Document that "set history size" accepts
"unlimited".
(Screen Size): Document that "set height" and "set width" accepts
"unlimited". Adjust "set pagination"'s description to suggest
"set height unlimited" instead of "set height 0".
gdb/testsuite/
2013-04-10 Pedro Alves <palves@redhat.com>
* gdb.base/completion.exp: Test "set height", "set listsize" and
"set trace-buffer-size" completion.
* gdb.base/setshow.exp: Test "set height unlimited".
* gdb.trace/trace-buffer-size.exp: Test "set trace-buffer-size
unlimited".
This is sort of a continuation of Keith's parse_exp_1 constification
patch. It started out by undoing these bits:
@@ -754,9 +754,12 @@ validate_actionline (char **line, struct
tmp_p = p;
for (loc = t->base.loc; loc; loc = loc->next)
{
- p = tmp_p;
- exp = parse_exp_1 (&p, loc->address,
+ const char *q;
+
+ q = tmp_p;
+ exp = parse_exp_1 (&q, loc->address,
block_for_pc (loc->address), 1);
+ p = (char *) q;
and progressively making more things const upwards, fixing fallout,
rinse repeat, until GDB built again (--enable-targets=all).
That ended up constifying lookup_cmd/add_cmd and (lots of) friends,
and the completers.
I didn't try to constify the command hooks themselves, because I know
upfront there are commands that write to the command string argument,
and I think I managed to stop at a nice non-hacky split point already.
I think the only non-really-super-obvious changes are
tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions.
The rest is just mostly about 'char *' => 'const char *', 'char **'=>
'const char **', and the occasional (e.g., deprecated_cmd_warning)
case of 'char **'=> 'const char *', where/when I noticed that nothing
actually cares about the pointer to pointer output.
Tested on x86_64 Fedora 17, native and gdbserver.
gdb/
2013-03-13 Pedro Alves <palves@redhat.com>
* ada-lang.c (struct add_partial_datum) <text, text0, word>: Make
fields const.
(ada_make_symbol_completion_list): Make "text0" parameter const.
* ax-gdb.c (agent_eval_command_one): Make "exp" parameter const.
* breakpoint.c (condition_completer): Make "text" and "word"
parameters const. Adjust.
(check_tracepoint_command): Adjust to validate_actionline
prototype change.
(catch_syscall_completer): Make "text" and "word" parameters
const.
* cli/cli-cmds.c (show_user): Make "comname" local const.
(valid_command_p): Make "command" parameter const.
(alias_command): Make "alias_prefix" and "command_prefix" locals
const.
* cli/cli-decode.c (add_cmd): Make "name" parameter const.
(add_alias_cmd): Make "name" and "oldname" parameters const.
Adjust. No longer make copy of OLDNAME.
(add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd)
(add_setshow_cmd_full, add_setshow_enum_cmd)
(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
(add_setshow_filename_cmd, add_setshow_string_cmd)
(add_setshow_string_noescape_cmd)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd)
(delete_cmd, add_info, add_info_alias, add_com, add_com_alias):
Make "name" parameter const.
(help_cmd): Rename "command" parameter to "arg". New const local
"command".
(find_cmd): Make "command" parameter const.
(lookup_cmd_1): Make "text" parameter pointer to const. Adjust to
deprecated_cmd_warning prototype change.
(undef_cmd_error): Make "cmdtype" parameter const.
(lookup_cmd): Make "line" parameter const.
(deprecated_cmd_warning): Change type of "text" parameter to
pointer to const char, from pointer to pointer to char. Adjust.
(lookup_cmd_composition): Make "text" parameter const.
(complete_on_cmdlist, complete_on_enum): Make "text" and "word"
parameters const.
* cli/cli-decode.h (struct cmd_list_element) <name>: Make field
const.
* cli/cli-script.c (validate_comname): Make "tem" local const.
(define_command): New const local "tem_c". Use it in calls to
lookup_cmd.
(document_command): Make "tem" and "comfull" locals const.
(show_user_1): Make "prefix" and "name" parameters const.
* cli-script.h (show_user_1): Make "prefix" and "name" parameters
const.
* command.h (add_cmd, add_alias_cmd, add_prefix_cmd)
(add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1)
(deprecated_cmd_warning, lookup_cmd_composition, add_com)
(add_com_alias, add_info, add_info_alias, complete_on_cmdlist)
(complete_on_enum, add_setshow_enum_cmd)
(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
(add_setshow_filename_cmd, add_setshow_string_cmd)
(add_setshow_string_noescape_cmd)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
Change prototypes, constifying strings.
* completer.c (noop_completer, filename_completer): Make "text"
and "prefix" parameters const.
(location_completer, expression_completer)
(complete_line_internal): Make "text" and "prefix" parameters
const and adjust.
(command_completer, signal_completer): Make "text" and "prefix"
parameters const.
* completer.h (noop_completer, filename_completer)
(expression_completer, location_completer, command_completer)
(signal_completer): Change prototypes.
* corefile.c (complete_set_gnutarget): Make "text" and "word"
parameters const.
* cp-abi.c (cp_abi_completer): Likewise.
* expression.h (parse_expression_for_completion): Change
prototype.
* f-lang.c (f_make_symbol_completion_list): Make "text" and "word"
parameters const.
* infcmd.c (_initialize_infcmd): Make "cmd_name" local const.
* infrun.c (handle_completer): Make "text" and "word" parameters
const.
* interps.c (interpreter_completer): Make "text" and "word"
parameters const.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Make "text" and "word"
parameters const.
* parse.c (parse_exp_1): Move const hack to parse_exp_in_context.
(parse_exp_in_context): Rename to ...
(parse_exp_in_context_1): ... this.
(parse_exp_in_context): Reimplement, with const hack from
parse_exp_1.
(parse_expression_for_completion): Make "string" parameter const.
* printcmd.c (decode_format): Make "string_ptr" parameter pointer
to pointer to const char. Adjust.
(print_command_1): Make "exp" parameter const.
(output_command): Rename to ...
(output_command_const): ... this. Make "exp" parameter const.
(output_command): Reimplement.
(x_command): Adjust.
(display_command): Rename "exp" parameter to "arg". New "exp"
local, const version of "arg".
* python/py-auto-load.c (gdbpy_initialize_auto_load): Make
"cmd_name" local const.
* python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree
call.
(cmdpy_completer): Make "text" and "word" parameters const.
(gdbpy_parse_command_name): Make "prefix_text2" local const.
* python/py-param.c (add_setshow_generic): Make "tmp_name" local
const.
* remote.c (_initialize_remote): Make "cmd_name" local const.
* symtab.c (language_search_unquoted_string): Make "text" and "p"
parameters const. Adjust.
(completion_list_add_fields): Make "sym_text", "text" and "word"
parameters const.
(struct add_name_data) <sym_text, text, word>: Make fields const.
(default_make_symbol_completion_list_break_on): Make "text" and
"word" parameters const. Adjust locals.
(default_make_symbol_completion_list)
(make_symbol_completion_list, make_symbol_completion_type)
(make_symbol_completion_list_fn): Make "text" and "word"
parameters const.
(make_file_symbol_completion_list): Make "text", "word" and
"srcfile" parameters const. Adjust locals.
(add_filename_to_list): Make "text" and "word" parameters const.
(struct add_partial_filename_data) <text, word>: Make fields
const.
(make_source_files_completion_list): Make "text" and "word"
parameters const.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_type enum type_code)
(make_symbol_completion_list_fn make_file_symbol_completion_list)
(make_source_files_completion_list): Change prototype.
* top.c (execute_command): Adjust to pass pointer to pointer to
const char to lookup_cmd, and to deprecated_cmd_warning prototype
change.
(set_verbose): Make "cmdname" local const.
* tracepoint.c (decode_agent_options): Make "exp" parameter const,
and adjust.
(validate_actionline): Make "line" parameter a pointer to const
char, and adjust.
(encode_actions_1): Make "action_exp" local const, and adjust.
(encode_actions): Adjust.
(replace_comma): Delete.
(trace_dump_actions): Make "action_exp" and "next_comma" locals
const, and adjust. Don't frob the action string while splitting
it at commas. Instead, make a copy of each split substring in
turn.
(trace_dump_command): Adjust to validate_actionline prototype
change.
* tracepoint.h (decode_agent_options, decode_agent_options)
(encode_actions, validate_actionline): Change prototypes.
* valprint.h (output_command): Delete declaration.
(output_command_const): Declare.
* value.c (function_destroyer): Cast const away in xfree call.
* cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): Change
parameter VAR's type from "unsigned int" to "int".
* command.h (var_zuinteger_unlimited): Update its comments.
(add_setshow_zuinteger_unlimited_cmd): Update the declaration.
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
* cli/cli-decode.c (add_alias_cmd): Make a copy of doc field
if flags contains DOC_ALLOCATED.
(add_setshow_cmd_full): Add DOC_ALLOCATED to set and show
flags.
(delete_cmd): Handle DOC_ALLOCATED flag.
* cli/cli-decode.h (DOC_ALLOCATED): New macro for use
in flags filed of struct cmd_list_element.
(struct cmd_list_element): Document new flag item.
There are a bunch of aliases that get used with help, but the current
command completion logic does not include those when doing completions.
Since the framework is already mostly in place, extend complete_on_cmdlist
slightly to pass down the ignore_help_classes flag like is done with the
existing lookup command logic.
Now you can do:
(gdb) help use<tab>
and get back:
(gdb) help user-defined
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): New.
Update comment to add_setshow_integer_cmd.
* cli/cli-setshow.c (do_set_command): Handle case
'var_zuinteger_unlimited'.
(do_show_command): Likewise.
* cli/cli-cmds.c (init_cmds): Call add_setshow_zuinteger_unlimited_cmd
for command 'remotetimeout'.
* command.h (enum var_types): New zuinteger_unlimited. Update comment
to var_integer.
* source.c (_initialize_source): Call add_setshow_zuinteger_unlimited_cmd
for command 'set listsize'.
gdb/doc/
* gdb.texinfo (List): Describe the meaning of 0 and -1 in
'set listsize'.
gdb/testsuite/
* gdb.base/list.exp (set_listsize): Don't set arg to "unlimited"
when it is less than 0.
* breakpoint.h: Include command.h.
(add_catch_command): Use completer_ftype.
* cli/cli-decode.c (set_cmd_completer): Use completer_ftype.
* cli/cli-decode.h (struct cmd_list_element) <completer>:
Use completer_ftype.
* command.h (completer_ftype): New typedef.
(set_cmd_completer): Use it.
* python/py-cmd.c (struct cmdpy_completer) <completer>: Use
completer_ftype.
* cli/cli-decode.h (CMD_LIST_AMBIGUOUS): Define.
* cli/cli-decode.c (lookup_cmd_1): Use CMD_LIST_AMBIGUOUS.
(lookup_cmd): Test for CMD_LIST_AMBIGUOUS.
* completer.c (complete_line_internal): Use CMD_LIST_AMBIGUOUS.
* top.c (set_verbose): Use CMD_LIST_AMBIGUOUS.
* cli/cli-cmds.c: White space.
* cli/cli-decode.c: White space.
* cli/cli-dump.c: White space.
* cli/cli-interp.c: White space.
* cli/cli-logging.c: White space.
* cli/cli-script.c: White space.
* cli/cli-setshow.c: White space.
* cli/cli-decode.c (complete_on_cmdlist): Make two passes over the
command list.
gdb/testsuite
* gdb.base/completion.exp: Add tests for completion and deprecated
commands.
2009-05-12 Pedro Alves <pedro@codesourcery.com>
* cli/cli-decode.c (deprecated_add_set_cmd): Delete.
* command.h (deprecated_add_set_cmd): Delete declaration.
* gnu-nat.c (_initialize_gnu_nat): Replace 'maint gnu-debug' with
'set debug gnu-nat' and 'show debug gnu-nat'.
* i386-nat.c (_initialize_i386_nat): Replace 'maint
show-debug-registers' with 'maint set show-debug-registers' and
'maint show show-debug-registers'.
* mips-linux-nat.c (_initialize_mips_linux_nat): Replace 'maint
show-debug-registers' with 'maint set show-debug-registers' and
'maint show show-debug-registers'.
gdb/doc/
2009-05-12 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo: Document 'set/show debug gnu-nat'. Replace 'maint
show-debug-regs' docs by 'maint set show-debug-regs' and 'maint
show show-debug-regs' docs.
target_has_stack.
* mi/mi-main.c (mi_execute_command): Avoid calling inferior_thread
when there is no thread selected.
(mi_cmd_execute): Don't special case commands that can run without
a valid selected thread.
* top.c (execute_command): Don't special case commands that can
run without a valid selected thread. Use has_stack_frames.
* infcmd.c (ensure_valid_thread): New.
(continue_1, step_1, jump_command, signal_command): Use it.
(detach_command): Error out if there's no selected thread/inferior.
* thread.c (print_thread_info): Allow having no thread selected.
(switch_to_thread): Don't read the PC if there is no current thread.
(do_restore_current_thread_cleanup): Don't record the current
frame if there is no current thread.
(make_cleanup_restore_current_thread): Don't read frame info if
there is no selected thread.
(_initialize_thread): Don't mark commands as
"no_selected_thread_ok".
* frame.c (get_current_frame): Error out if there is no valid
selected thread.
(has_stack_frames): Return false if there is no valid
selected thread.
* cli/cli-cmds.c (init_cli_cmds): Don't mark commands as
"no_selected_thread_ok".
* cli/cli-decode.c (set_cmd_no_selected_thread_ok)
(get_cmd_no_selected_thread_ok): Delete.
* cli/cli-decode.h (CMD_NO_SELECTED_THREAD_OK): Delete.
(set_cmd_no_selected_thread_ok, get_cmd_no_selected_thread_ok):
Delete declaration.
* stack.c (get_selected_block): Use has_stack_frames.
* cli/cli-decode.c (add_setshow_zuinteger_cmd): New.
* cli/cli-setshow.c (do_setshow_command): Handle it.
* command.h (enum var_types): Add var_zuinteger.
(add_setshow_zuinteger_cmd): Declare.
* valprint.c (_initialize_valprint): Change the set input-radix
and set output-radix commands to zuinteger type.
2009-01-23 Pedro Alves <pedro@codesourcery.com>
* gdb.base/radix.exp: Add tests to ensure that that set
input-radix 0 and set output-radix 0 are really rejected.