From patchwork Tue Jun 7 08:56:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 12833 Received: (qmail 126812 invoked by alias); 7 Jun 2016 08:57:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 126798 invoked by uid 89); 7 Jun 2016 08:57:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, FSL_HELO_HOME, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=sk:af4ddcc, sk:3b305a6, H*MI:tom X-HELO: gproxy10-pub.mail.unifiedlayer.com Received: from gproxy10-pub.mail.unifiedlayer.com (HELO gproxy10-pub.mail.unifiedlayer.com) (69.89.20.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Tue, 07 Jun 2016 08:56:55 +0000 Received: (qmail 22909 invoked by uid 0); 7 Jun 2016 08:56:52 -0000 Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy10.mail.unifiedlayer.com with SMTP; 7 Jun 2016 08:56:52 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id 3kwl1t0032f2jeq01kwo5g; Tue, 07 Jun 2016 02:56:51 -0600 X-Authority-Analysis: v=2.1 cv=OPe0g0qB c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=-N9Dh3nx2ZYA:10 a=pD_ry4oyNxEA:10 a=zstS-IiYAAAA:8 a=qUXFsv20AAAA:8 a=7TqSWeQwdpryI1TQXhEA:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=9MODbo6-FXLeArg8YEg9:22 Received: from [65.128.48.199] (port=47324 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1bACoY-0005f1-2D; Tue, 07 Jun 2016 02:56:46 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA] Fix PR cli/18053 Date: Tue, 7 Jun 2016 02:56:35 -0600 Message-Id: <1465289795-9415-1-git-send-email-tom@tromey.com> X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 65.128.48.199 authed with tom+tromey.com} X-Exim-ID: 1bACoY-0005f1-2D X-Source-Sender: (bapiya.Home) [65.128.48.199]:47324 X-Source-Auth: tom+tromey.com X-Email-Count: 0 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== PR cli/18053 concerns a couple of minor bugs in the JIT debuginfo support. First, jit-reader-load should use filename completion and support tilde expansion. Second, the help for jit-reader-unload is incorrect. While working on this I also realized that jit-reader-unload should use the no-op completer, so I've included that as well. Built and regtested on x86-64 Fedora 23. A completer test for jit-reader-load is included, but not a tilde-expansion test, as I couldn't think of a reliable way to test that. 2016-06-07 Tom Tromey PR cli/18053: * jit.c (jit_reader_load_command): Use tilde_expand. (_initialize_jit): Fix help for jit-reader-unload. Set completer for new commands. 2016-06-07 Tom Tromey PR cli/18053: * gdb.base/jit-so.exp (one_jit_test): Add jit-reader-load completion test. --- gdb/ChangeLog | 7 +++++++ gdb/jit.c | 24 ++++++++++++++++++------ gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.base/jit-so.exp | 7 +++++++ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index af4ddcc..77616ba 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2016-06-07 Tom Tromey + + PR cli/18053: + * jit.c (jit_reader_load_command): Use tilde_expand. + (_initialize_jit): Fix help for jit-reader-unload. Set completer + for new commands. + 2016-06-02 Jon Turney * windows-nat.c (handle_output_debug_string): Return type of diff --git a/gdb/jit.c b/gdb/jit.c index 9fd5ae6..39b310a 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -39,6 +39,8 @@ #include "gdb-dlfcn.h" #include #include "gdb_bfd.h" +#include "readline/tilde.h" +#include "completer.h" static const char *jit_reader_dir = NULL; @@ -207,15 +209,19 @@ jit_reader_load_command (char *args, int from_tty) if (args == NULL) error (_("No reader name provided.")); + args = tilde_expand (args); + prev_cleanup = make_cleanup (xfree, args); if (loaded_jit_reader != NULL) error (_("JIT reader already loaded. Run jit-reader-unload first.")); if (IS_ABSOLUTE_PATH (args)) - so_name = xstrdup (args); + so_name = args; else - so_name = xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING, args); - prev_cleanup = make_cleanup (xfree, so_name); + { + so_name = xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING, args); + make_cleanup (xfree, so_name); + } loaded_jit_reader = jit_reader_load (so_name); do_cleanups (prev_cleanup); @@ -1516,15 +1522,21 @@ _initialize_jit (void) jit_gdbarch_data = gdbarch_data_register_pre_init (jit_gdbarch_data_init); if (is_dl_available ()) { - add_com ("jit-reader-load", no_class, jit_reader_load_command, _("\ + struct cmd_list_element *c; + + c = add_com ("jit-reader-load", no_class, jit_reader_load_command, _("\ Load FILE as debug info reader and unwinder for JIT compiled code.\n\ Usage: jit-reader-load FILE\n\ Try to load file FILE as a debug info reader (and unwinder) for\n\ JIT compiled code. The file is loaded from " JIT_READER_DIR ",\n\ relocated relative to the GDB executable if required.")); - add_com ("jit-reader-unload", no_class, jit_reader_unload_command, _("\ + set_cmd_completer (c, filename_completer); + + c = add_com ("jit-reader-unload", no_class, + jit_reader_unload_command, _("\ Unload the currently loaded JIT debug info reader.\n\ -Usage: jit-reader-unload FILE\n\n\ +Usage: jit-reader-unload\n\n\ Do \"help jit-reader-load\" for info on loading debug info readers.")); + set_cmd_completer (c, noop_completer); } } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3b305a6..38646d8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-07 Tom Tromey + + PR cli/18053: + * gdb.base/jit-so.exp (one_jit_test): Add jit-reader-load + completion test. + 2016-06-02 Tom Tromey PR python/18984: diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp index 0db3259..9fadd86 100644 --- a/gdb/testsuite/gdb.base/jit-so.exp +++ b/gdb/testsuite/gdb.base/jit-so.exp @@ -117,3 +117,10 @@ proc one_jit_test {count match_str} { one_jit_test 1 "${hex} jit_function_0000" one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001" + +# We don't intend to load the .so as a JIT debuginfo reader, but we +# need some handy file name for a completion test. +gdb_test \ + "complete jit-reader-load [standard_output_file ${solib_testfile}.s]" \ + "jit-reader-load $solib_binfile" \ + "test jit-reader-load filename completion"