From patchwork Wed Nov 29 21:44:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Durigan Junior X-Patchwork-Id: 24608 Received: (qmail 29830 invoked by alias); 29 Nov 2017 21:45:04 -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 29772 invoked by uid 89); 29 Nov 2017 21:45:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=promptly X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Nov 2017 21:45:01 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90F8D267F4 for ; Wed, 29 Nov 2017 21:44:59 +0000 (UTC) Received: from psique.yyz.redhat.com (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D8D25D6A3; Wed, 29 Nov 2017 21:44:57 +0000 (UTC) From: Sergio Durigan Junior To: GDB Patches Cc: Pedro Alves , Sergio Durigan Junior Subject: [PATCH] Make 'symbol-file' not care about the position of command line arguments Date: Wed, 29 Nov 2017 16:44:51 -0500 Message-Id: <20171129214451.14257-1-sergiodj@redhat.com> In-Reply-To: <779a2d21-badf-b54c-e1c9-2f869716fd71@redhat.com> References: <779a2d21-badf-b54c-e1c9-2f869716fd71@redhat.com> X-IsSubscribed: yes This is a bug that's been detected while doing the readnever work. Currently if you use the 'symbol-file' command you have to be careful about the position of each argument you pass on the command line. This is because while parsing its arguments, if the command detects a filename, it promptly calls 'symbol_file_add_main_1' without waiting to see if there are other args on the line. This only affects the '-readnow' argument so far, but while implementing the '-readnever' command it also affected it. gdb/ChangeLog: 2017-11-29 Sergio Durigan Junior * symfile.c (symbol_file_command): Call 'symbol_file_add_main_1' only after processing all command line options. --- gdb/symfile.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gdb/symfile.c b/gdb/symfile.c index 4bbe0b5a62..9565570734 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1634,14 +1634,13 @@ symbol_file_command (const char *args, int from_tty) else if (*arg == '-') error (_("unknown option `%s'"), arg); else - { - symbol_file_add_main_1 (arg, add_flags, flags); - name = arg; - } + name = arg; } if (name == NULL) error (_("no symbol file name was specified")); + + symbol_file_add_main_1 (arg, add_flags, flags); } }