public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] Support an "unlimited" number of user-defined arguments Date: Fri, 02 Dec 2016 21:13:00 -0000 [thread overview] Message-ID: <df3ee9ca894f7e831713c332aa7820a6463c2435@gdb-build> (raw) *** TEST RESULTS FOR COMMIT df3ee9ca894f7e831713c332aa7820a6463c2435 *** Author: Pedro Alves <palves@redhat.com> Branch: master Commit: df3ee9ca894f7e831713c332aa7820a6463c2435 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.
next reply other threads:[~2016-12-02 21:00 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-12-02 21:13 sergiodj+buildbot [this message] 2016-12-02 21:08 ` Failures on Fedora-i686, branch master sergiodj+buildbot 2016-12-02 21:25 ` Failures on Debian-s390x-m64, " sergiodj+buildbot 2016-12-02 21:30 ` Failures on Fedora-x86_64-m32, " sergiodj+buildbot 2016-12-02 21:30 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " sergiodj+buildbot 2016-12-02 21:55 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot 2016-12-03 18:00 ` Failures on Debian-i686-native-extended-gdbserver, " sergiodj+buildbot 2016-12-10 13:35 ` Failures on Fedora-ppc64be-native-gdbserver-m64, " sergiodj+buildbot 2016-12-10 13:35 ` Failures on Fedora-ppc64be-m64, " sergiodj+buildbot 2016-12-10 14:11 ` Failures on Fedora-ppc64be-native-extended-gdbserver-m64, " sergiodj+buildbot 2016-12-16 6:21 ` Failures on Fedora-ppc64le-native-extended-gdbserver-m64, " sergiodj+buildbot 2016-12-16 7:15 ` Failures on Fedora-ppc64le-native-gdbserver-m64, " sergiodj+buildbot 2016-12-16 7:51 ` Failures on Fedora-ppc64le-m64, " sergiodj+buildbot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=df3ee9ca894f7e831713c332aa7820a6463c2435@gdb-build \ --to=sergiodj+buildbot@sergiodj.net \ --cc=gdb-testers@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).