From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17158 invoked by alias); 6 Dec 2005 17:06:13 -0000 Received: (qmail 17149 invoked by uid 22791); 6 Dec 2005 17:06:12 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-01.spheriq.net (HELO lon-del-01.spheriq.net) (195.46.50.97) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 06 Dec 2005 17:06:09 +0000 Received: from lon-out-01.spheriq.net ([195.46.50.129]) by lon-del-01.spheriq.net with ESMTP id jB6H5tar012819 for ; Tue, 6 Dec 2005 17:05:55 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-01.spheriq.net with ESMTP id jB6H5tLa017185 for ; Tue, 6 Dec 2005 17:05:55 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id jB6H5rL0025529 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Tue, 6 Dec 2005 17:05:54 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6094DDA44 for ; Tue, 6 Dec 2005 17:05:53 +0000 (GMT) Received: by zeta.dmz-eu.st.com (STMicroelectronics, from userid 60012) id 19AE047441; Tue, 6 Dec 2005 17:09:01 +0000 (GMT) Received: from zeta.dmz-eu.st.com (localhost [127.0.0.1]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DB34C75999 for ; Tue, 6 Dec 2005 17:09:00 +0000 (UTC) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 65A9F47329 for ; Tue, 6 Dec 2005 17:09:00 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CHA81625 (AUTH "andrew stubbs"); Tue, 6 Dec 2005 17:05:51 GMT Message-ID: <4395C45C.2090108@st.com> Date: Tue, 06 Dec 2005 22:14:00 -0000 From: Andrew STUBBS User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) MIME-Version: 1.0 To: GDB Patches Subject: [PATCH] Allow spaces in filename to add-symbol-file command Content-Type: multipart/mixed; boundary="------------000708000004070601070708" X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.2.0 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2005-12/txt/msg00114.txt.bz2 This is a multi-part message in MIME format. --------------000708000004070601070708 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 380 Hi, The war against missing space support continues! I have altered add_symbol_file_command() to use buildargv() instead of parsing the arguments itself. This should allow quoting and hence spaces in the filename. Additionally, I have reordered the help message so that 'help files' uses the right part of the message and updated the testsuite to match. OK? Andrew Stubbs --------------000708000004070601070708 Content-Type: text/plain; name="add-symbol-file.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="add-symbol-file.patch" Content-length: 4358 2005-12-06 Andrew Stubbs * symfile.c (add_symbol_file_command): Use buildargv(), instead of hand decoding the command line, to allow use of quotes and spaces. (_initialize_symfile): Reorganize the help message for add-symbol-file such that 'help files' shows a better message. testsuite/ * gdb.base/help.exp (help add-symbol-file): Update. Index: src/gdb/symfile.c =================================================================== --- src.orig/gdb/symfile.c 2005-12-05 19:02:38.000000000 +0000 +++ src/gdb/symfile.c 2005-12-06 16:32:28.000000000 +0000 @@ -1782,6 +1782,7 @@ add_symbol_file_command (char *args, int int i; int expecting_sec_name = 0; int expecting_sec_addr = 0; + char **argv; struct sect_opt { @@ -1803,28 +1804,15 @@ add_symbol_file_command (char *args, int if (args == NULL) error (_("add-symbol-file takes a file name and an address")); - /* Make a copy of the string that we can safely write into. */ - args = xstrdup (args); + argv = buildargv (args); + make_cleanup_freeargv (argv); - while (*args != '\000') - { - /* Any leading spaces? */ - while (isspace (*args)) - args++; - - /* Point arg to the beginning of the argument. */ - arg = args; - - /* Move args pointer over the argument. */ - while ((*args != '\000') && !isspace (*args)) - args++; + if (argv == NULL) + nomem (0); - /* If there are more arguments, terminate arg and - proceed past it. */ - if (*args != '\000') - *args++ = '\000'; - - /* Now process the argument. */ + for (arg = argv[0], argcnt = 0; arg != NULL; arg = argv[++argcnt]) + { + /* Process the argument. */ if (argcnt == 0) { /* The first argument is the file name. */ @@ -1887,7 +1875,6 @@ add_symbol_file_command (char *args, int error (_("USAGE: add-symbol-file [-mapped] [-readnow] [-s ]*")); } } - argcnt++; } /* Print the prompt for the query below. And save the arguments into @@ -3710,8 +3697,8 @@ to execute."), &cmdlist); set_cmd_completer (c, filename_completer); c = add_cmd ("add-symbol-file", class_files, add_symbol_file_command, _("\ +Load symbols from FILE, assuming FILE has been dynamically loaded.\n\ Usage: add-symbol-file FILE ADDR [-s -s ...]\n\ -Load the symbols from FILE, assuming FILE has been dynamically loaded.\n\ ADDR is the starting address of the file's text.\n\ The optional arguments are section-name section-address pairs and\n\ should be specified if the data and bss segments are not contiguous\n\ Index: src/gdb/testsuite/gdb.base/help.exp =================================================================== --- src.orig/gdb/testsuite/gdb.base/help.exp 2005-12-02 16:15:21.000000000 +0000 +++ src/gdb/testsuite/gdb.base/help.exp 2005-12-06 17:03:18.000000000 +0000 @@ -35,7 +35,7 @@ gdb_test "set height 400" "" "test set h # use a larger expect input buffer for long help outputs. # test help add-symbol-file -gdb_test "help add-symbol-file" "Usage: add-symbol-file FILE ADDR \\\[-s -s \.\.\.\\\]\[\r\n\]+Load the symbols from FILE, assuming FILE has been dynamically loaded\.\[\r\n\]+ADDR is the starting address of the file's text\.\[\r\n\]+The optional arguments are section-name section-address pairs and\[\r\n\]+should be specified if the data and bss segments are not contiguous\[\r\n\]+with the text\. SECT is a section name to be loaded at SECT_ADDR\." "help add-symbol-file" +gdb_test "help add-symbol-file" "Load symbols from FILE, assuming FILE has been dynamically loaded\.\[\r\n\]+Usage: add-symbol-file FILE ADDR \\\[-s -s \.\.\.\\\]\[\r\n\]+ADDR is the starting address of the file's text\.\[\r\n\]+The optional arguments are section-name section-address pairs and\[\r\n\]+should be specified if the data and bss segments are not contiguous\[\r\n\]+with the text\. SECT is a section name to be loaded at SECT_ADDR\." "help add-symbol-file" # test help advance gdb_test "help advance" "Continue the program up to the given location \\(same form as args for break command\\)\.\[\r\n]+Execution will also stop upon exit from the current stack frame\." "help advance" # test help aliases --------------000708000004070601070708--