darling-gdb/gdb/doc
Pedro Alves df3ee9ca89 Support an "unlimited" number of user-defined arguments
New in v2:

  - A few adjustments / simplifications were possible now that we
    require C++11:

    . Use std::unique_ptr to make the user_args_stack std::vector own
      its elements:

       static std::vector<std::unique_ptr<user_args>> user_args_stack;

    . use vector::emplace_back to construct elements directly in the
      corresponding vectors.

    . use std::to_string instead of adding a gdb::to_string
      replacement.

  - Now includes a test.

Docs/NEWS are unchanged from v1 and have already been approved.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I recently wrote a user-defined command that could benefit from
supporting an unlimited number of arguments:

 http://palves.net/list-active-signal-handlers-with-gdb/

E.g., 'info signal-dispositions 1 2 3 4 5 6 7 8 9 10 11'

However, we currently only support up to 10 arguments passed to
user-defined commands ($arg0..$arg9).

I can't find a good reason for that, other than "old code with hard
coded limits".  This patch removes that limit and modernizes the code
along the way:

  - Makes the user_args struct a real C++ class that uses std::vector
    for storage.

  - Removes the "next" pointer from within user_args and uses a
    std::vector to maintain a stack instead.

  - Adds a new RAII-based scoped_user_args_level class to help
    push/pop user args in the stack instead of using a cleanup.

gdb/ChangeLog:
2016-12-02  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention that user commands now accept an unlimited number
	of arguments.
	* cli/cli-script.c: Include <vector>.
	(struct string_view): New type.
	(MAXUSERARGS): Delete.
	(struct user_args): Now a C++ class.
	(user_args_stack): New.
	(struct scoped_user_args_level): New type.
	(execute_user_command): Use scoped_user_args_level.
	(arg_cleanup): Delete.
	(setup_user_args): Deleted, and refactored as ...
	(user_args::user_args): ... this new constructor.  Limit of number
	of arguments removed.
	(insert_user_defined_cmd_args): Defer to user_args_stack.
	(user_args::insert_args): New, bits based on old
	insert_user_defined_cmd_args with limit of number of arguments
	eliminated.

gdb/doc/ChangeLog:
2016-12-02  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (User-defined Commands): Limit on number of
	arguments passed to user-defined commands removed; update.

gdb/testsuite/ChangeLog:
2016-12-02  Pedro Alves  <palves@redhat.com>

	* gdb.base/commands.exp (user_defined_command_manyargs_test): New
	procedure.
	(top level): Call it.
2016-12-02 19:22:48 +00:00
..
.gitignore Update and add .gitignore's 2016-09-21 13:12:21 -04:00
a4rc.sed
agentexpr.texi Fix zero_ext documentation 2016-04-13 12:36:24 -04:00
all-cfg.texi GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
annotate.texinfo GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
ChangeLog Support an "unlimited" number of user-defined arguments 2016-12-02 19:22:48 +00:00
doxy-index.in GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
Doxyfile-base.in GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
Doxyfile-gdb-api.in GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
Doxyfile-gdb-xref.in GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
Doxyfile-gdbserver.in GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
fdl.texi
filter-for-doxygen
filter-params.pl
gdb.texinfo Support an "unlimited" number of user-defined arguments 2016-12-02 19:22:48 +00:00
gpl.texi
guile.texi Remove Java support 2016-10-06 10:10:40 -06:00
lpsrc.sed
Makefile.in Makefiles: Disable suffix rules and implicit rules 2016-11-30 16:23:59 -05:00
observer.texi Emit inferior, thread and frame selection events to all UIs 2016-10-03 16:54:58 -04:00
psrc.sed
python.texi Remove Java support 2016-10-06 10:10:40 -06:00
refcard.tex GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
stabs.texinfo GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
stack_frame.eps
stack_frame.pdf
stack_frame.png
stack_frame.svg
stack_frame.txt