* [PATCH] Allow spaces in filenames to load command
@ 2005-12-06 17:06 Andrew STUBBS
2005-12-06 18:23 ` Jim Blandy
0 siblings, 1 reply; 11+ messages in thread
From: Andrew STUBBS @ 2005-12-06 17:06 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 582 bytes --]
Hi,
I have been having trouble using GDB when there are spaces in the
executable filename (including in parent directories). This is quite
common on Windows.
The load command attempts to interpret everything after the first space
as a load offset - a number - and rejects the command of it won't parse.
This even happens when the filename is passed on the GDB command line.
The attached patch used buildargv() and tilde_expand() to give this
filename the same treatment as exec_file and symbol_file.
A quick search of gnats shows that this is bug #535.
OK?
Andrew Stubbs
[-- Attachment #2: load.patch --]
[-- Type: text/plain, Size: 2320 bytes --]
2005-12-05 Andrew Stubbs <andrew.stubbs@st.com>
* symfile.c (generic_load): Use buildargv and tilde_expand
to parse file names with quoting, spaces and tildes properly.
Index: src/gdb/symfile.c
===================================================================
--- src.orig/gdb/symfile.c 2005-12-02 16:15:22.000000000 +0000
+++ src/gdb/symfile.c 2005-12-05 18:46:48.000000000 +0000
@@ -1615,8 +1615,7 @@ generic_load (char *args, int from_tty)
bfd *loadfile_bfd;
struct timeval start_time, end_time;
char *filename;
- struct cleanup *old_cleanups;
- char *offptr;
+ struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
struct load_section_data cbdata;
CORE_ADDR entry;
@@ -1625,23 +1624,36 @@ generic_load (char *args, int from_tty)
cbdata.data_count = 0; /* Number of bytes written to target memory. */
cbdata.total_size = 0; /* Total size of all bfd sectors. */
- /* Parse the input argument - the user can specify a load offset as
- a second argument. */
- filename = xmalloc (strlen (args) + 1);
- old_cleanups = make_cleanup (xfree, filename);
- strcpy (filename, args);
- offptr = strchr (filename, ' ');
- if (offptr != NULL)
- {
- char *endptr;
-
- cbdata.load_offset = strtoul (offptr, &endptr, 0);
- if (offptr == endptr)
- error (_("Invalid download offset:%s."), offptr);
- *offptr = '\0';
- }
+ /* Do we have args from the user or from the default? */
+ if (exec_bfd && args == get_exec_file (1))
+ /* The string is ONLY the file name. */
+ filename = args;
else
- cbdata.load_offset = 0;
+ {
+ /* We have args from the user so the filename may be quoted
+ and there may be an offset argument. */
+ char **argv = buildargv (args);
+
+ if (argv == NULL)
+ nomem(0);
+
+ make_cleanup_freeargv (argv);
+
+ filename = tilde_expand (argv[0]);
+ make_cleanup (xfree, filename);
+
+ if (argv[1] != NULL)
+ {
+ char *endptr;
+
+ cbdata.load_offset = strtoul (argv[1], &endptr, 0);
+
+ /* If the last word was not a valid number then
+ treat it as a file name with spaces in. */
+ if (argv[1] == endptr)
+ error (_("Invalid download offset:%s."), argv[1]);
+ }
+ }
/* Open the file for loading. */
loadfile_bfd = bfd_openr (filename, gnutarget);
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] Allow spaces in filenames to load command 2005-12-06 17:06 [PATCH] Allow spaces in filenames to load command Andrew STUBBS @ 2005-12-06 18:23 ` Jim Blandy 2005-12-06 20:28 ` Andrew STUBBS 0 siblings, 1 reply; 11+ messages in thread From: Jim Blandy @ 2005-12-06 18:23 UTC (permalink / raw) To: Andrew STUBBS; +Cc: GDB Patches On 12/5/05, Andrew STUBBS <andrew.stubbs@st.com> wrote: > 2005-12-05 Andrew Stubbs <andrew.stubbs@st.com> > > * symfile.c (generic_load): Use buildargv and tilde_expand > to parse file names with quoting, spaces and tildes properly. Hi, Andrew. I like the idea of using buildargv and tilde_expand. > + /* Do we have args from the user or from the default? */ > + if (exec_bfd && args == get_exec_file (1)) > + /* The string is ONLY the file name. */ > + filename = args; What is this about? This seems very fragile. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2005-12-06 18:23 ` Jim Blandy @ 2005-12-06 20:28 ` Andrew STUBBS 2005-12-07 17:44 ` Jim Blandy 0 siblings, 1 reply; 11+ messages in thread From: Andrew STUBBS @ 2005-12-06 20:28 UTC (permalink / raw) To: Jim Blandy; +Cc: GDB Patches Jim Blandy wrote: > On 12/5/05, Andrew STUBBS <andrew.stubbs@st.com> wrote: > >>2005-12-05 Andrew Stubbs <andrew.stubbs@st.com> >> >> * symfile.c (generic_load): Use buildargv and tilde_expand >> to parse file names with quoting, spaces and tildes properly. > > > Hi, Andrew. I like the idea of using buildargv and tilde_expand. > > >>+ /* Do we have args from the user or from the default? */ >>+ if (exec_bfd && args == get_exec_file (1)) >>+ /* The string is ONLY the file name. */ >>+ filename = args; > > > What is this about? This seems very fragile. > load_command passes either the string from the command line or else the result of get_exec_file(). If it does the latter then we must not attempt to use build_argv because it would not be properly quoted and would break if there were spaces. How about a new comment? /* load_command() may have passed a string from the user or from get_exec_file(). In the latter case do not do build_argv. */ Andrew ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2005-12-06 20:28 ` Andrew STUBBS @ 2005-12-07 17:44 ` Jim Blandy 2005-12-07 19:35 ` Jim Blandy 0 siblings, 1 reply; 11+ messages in thread From: Jim Blandy @ 2005-12-07 17:44 UTC (permalink / raw) To: Andrew STUBBS; +Cc: GDB Patches Okay, we have a bigger problem here than I'd thought. generic_load is a generic implementation of the target to_load method, for use by targets that just want to use target_write_memory_partial to write the loadable sections of the exec file to the target's memory. It's used by the GDB remote protocol and some of the other remote targets. However: - dve3900-rom.c, remote-m32r-sdi.c, remote-mips.c, and wince.c just expect a filename. - monitor.c uses sscanf ("%s 0x%lx") to parse its argument. - remote-e7000.c parses -quiet and -nostart arguments, but no load offset. - remote-sim.c passes it on to sim_load, which always seems to expect a filename. So testing for address equality is a way for generic_load to recognize when it's being given a lone filename that shouldn't be broken up, without changing load_command in a way that would break the seven non-generic-load targets out there. I feel morally compromised. :) Let me think about this a bit. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2005-12-07 17:44 ` Jim Blandy @ 2005-12-07 19:35 ` Jim Blandy 2005-12-07 23:25 ` Andrew STUBBS 0 siblings, 1 reply; 11+ messages in thread From: Jim Blandy @ 2005-12-07 19:35 UTC (permalink / raw) To: Andrew STUBBS; +Cc: GDB Patches Here's what I think we should do. Folks who've worked a lot with the target vector, please review. First, I'd like to make the following change to target.h: *** target.h 15 Sep 2005 22:46:32 -0700 1.76 --- target.h 06 Dec 2005 19:03:13 -0800 *************** *** 679,686 **** /* Load an executable file into the target process. This is expected to not only bring new code into the target process, but also to ! update GDB's symbol tables to match. */ extern void target_load (char *arg, int from_tty); /* Look up a symbol in the target's symbol table. NAME is the symbol --- 679,692 ---- /* Load an executable file into the target process. This is expected to not only bring new code into the target process, but also to ! update GDB's symbol tables to match. + ARG contains command-line arguments, to be broken down with + buildargv (). The first non-switch argument is the filename to + load, FILE; the second is a number (as parsed by strtoul (..., ..., + 0)), which is an offset to apply to the load addresses of FILE's + sections. The target may define switches, or other non-switch + arguments, as it pleases. */ extern void target_load (char *arg, int from_tty); /* Look up a symbol in the target's symbol table. NAME is the symbol I believe generic_load (and all the targets that use it, which is most of them) already meet that description. Second, change gdbsim_load to actually call buildargv, error out if a load address is present (saying it's not implemented yet), and pass the filename to sim_load. Third, change load_command to quote the result from get_exec_file if needed. Fourth, drop the string address equality test from the patch. Fifth, error out if there are further arguments we haven't recognized. This moves towards a well-defined interface for target_load. I don't think it's fair to ask you to go in and fix freds-old-S100-bus-board-monitor.c; in the future, if people run into problems with specific targets not expecting the quotation, we can fix them, since we'll then have a person who can actually test the change. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2005-12-07 19:35 ` Jim Blandy @ 2005-12-07 23:25 ` Andrew STUBBS 2005-12-08 0:19 ` Andrew STUBBS 0 siblings, 1 reply; 11+ messages in thread From: Andrew STUBBS @ 2005-12-07 23:25 UTC (permalink / raw) To: Jim Blandy; +Cc: GDB Patches [-- Attachment #1: Type: text/plain, Size: 958 bytes --] Jim Blandy wrote: > Here's what I think we should do. Folks who've worked a lot with the > target vector, please review. I attach a patch which does what you suggested. I also updated the help for the load command to mention the offset. I have tested it and found no extra test failures. > This moves towards a well-defined interface for target_load. I don't > think it's fair to ask you to go in and fix > freds-old-S100-bus-board-monitor.c; in the future, if people run into > problems with specific targets not expecting the quotation, we can fix > them, since we'll then have a person who can actually test the change. If nobody ever uses a file name with space, tab, single or double quotes or an escape slash then custom target_load function should see no difference. Similarly, as long as all the places that use generic_load pass through the arguments they got from load_command then they should see no differences either. Andrew Stubbs [-- Attachment #2: load-2.patch --] [-- Type: text/plain, Size: 7438 bytes --] 2005-12-07 Andrew Stubbs <andrew.stubbs@st.com> * symfile.c (generic_load): Use buildargv() and tilde_expand() to parse file names with quoting, spaces and tildes properly. (load_command): Quote all special characters before calling target_load() such that buildargv() doesn't break file names. (_initialize_symfile): Mention the load offset in the help for the load command. * remote-sim.c: Include readline.h. (gdbsim_load): Use buildargv and tilde_expand() to parse file names with quoting, spaces and tildes properly. * target.h (target_load): Comment the parameters better. Index: src/gdb/symfile.c =================================================================== --- src.orig/gdb/symfile.c 2005-12-02 16:15:22.000000000 +0000 +++ src/gdb/symfile.c 2005-12-07 16:41:26.000000000 +0000 @@ -1468,7 +1468,42 @@ static void load_command (char *arg, int from_tty) { if (arg == NULL) - arg = get_exec_file (1); + { + char *parg; + int count = 0; + + parg = arg = get_exec_file (1); + + /* Count how many \ " ' tab space there are in the name. */ + while ((parg = strpbrk (parg, "\\\"'\t "))) + { + parg++; + count++; + } + + if (count) + { + /* We need to quote this string so buildargv can pull it apart. */ + char *temp = xmalloc (strlen (arg) + count + 1 ); + char *ptemp = temp; + char *prev; + + make_cleanup (xfree, temp); + + prev = parg = arg; + while ((parg = strpbrk (parg, "\\\"'\t "))) + { + strncpy (ptemp, prev, parg - prev); + ptemp += parg - prev; + prev = parg++; + *ptemp++ = '\\'; + } + strcpy (ptemp, prev); + + arg = temp; + } + } + target_load (arg, from_tty); /* After re-loading the executable, we don't really know which @@ -1615,33 +1650,40 @@ generic_load (char *args, int from_tty) bfd *loadfile_bfd; struct timeval start_time, end_time; char *filename; - struct cleanup *old_cleanups; - char *offptr; + struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0); struct load_section_data cbdata; CORE_ADDR entry; + char **argv; cbdata.load_offset = 0; /* Offset to add to vma for each section. */ cbdata.write_count = 0; /* Number of writes needed. */ cbdata.data_count = 0; /* Number of bytes written to target memory. */ cbdata.total_size = 0; /* Total size of all bfd sectors. */ - /* Parse the input argument - the user can specify a load offset as - a second argument. */ - filename = xmalloc (strlen (args) + 1); - old_cleanups = make_cleanup (xfree, filename); - strcpy (filename, args); - offptr = strchr (filename, ' '); - if (offptr != NULL) + argv = buildargv (args); + + if (argv == NULL) + nomem(0); + + make_cleanup_freeargv (argv); + + filename = tilde_expand (argv[0]); + make_cleanup (xfree, filename); + + if (argv[1] != NULL) { char *endptr; - cbdata.load_offset = strtoul (offptr, &endptr, 0); - if (offptr == endptr) - error (_("Invalid download offset:%s."), offptr); - *offptr = '\0'; + cbdata.load_offset = strtoul (argv[1], &endptr, 0); + + /* If the last word was not a valid number then + treat it as a file name with spaces in. */ + if (argv[1] == endptr) + error (_("Invalid download offset:%s."), argv[1]); + + if (argv[2] != NULL) + error (_("Too many parameters.")); } - else - cbdata.load_offset = 0; /* Open the file for loading. */ loadfile_bfd = bfd_openr (filename, gnutarget); @@ -3716,7 +3758,8 @@ Load the symbols from shared objects in c = add_cmd ("load", class_files, load_command, _("\ Dynamically load FILE into the running program, and record its symbols\n\ -for access from GDB."), &cmdlist); +for access from GDB.\n\ +A load OFFSET may also be given."), &cmdlist); set_cmd_completer (c, filename_completer); add_setshow_boolean_cmd ("symbol-reloading", class_support, Index: src/gdb/remote-sim.c =================================================================== --- src.orig/gdb/remote-sim.c 2005-11-29 10:51:01.000000000 +0000 +++ src/gdb/remote-sim.c 2005-12-07 17:32:55.000000000 +0000 @@ -43,6 +43,7 @@ #include "gdb_assert.h" #include "sim-regno.h" #include "arch-utils.h" +#include "readline/readline.h" /* Prototypes */ @@ -391,8 +392,21 @@ gdbsim_kill (void) GDB's symbol tables to match. */ static void -gdbsim_load (char *prog, int fromtty) +gdbsim_load (char *args, int fromtty) { + char **argv = buildargv (args); + char *prog; + + if (argv == NULL) + nomem (0); + + make_cleanup_freeargv (argv); + + prog = tilde_expand (argv[0]); + + if (argv[1] != NULL) + error (_("GDB sim does not yet support a load offset.")); + if (sr_get_debug ()) printf_filtered ("gdbsim_load: prog \"%s\"\n", prog); Index: src/gdb/target.h =================================================================== --- src.orig/gdb/target.h 2005-09-04 17:18:20.000000000 +0100 +++ src/gdb/target.h 2005-12-07 14:18:05.000000000 +0000 @@ -679,7 +679,14 @@ extern void print_section_info (struct t /* Load an executable file into the target process. This is expected to not only bring new code into the target process, but also to - update GDB's symbol tables to match. */ + update GDB's symbol tables to match. + + ARG contains command-line arguments, to be broken down with + buildargv (). The first non-switch argument is the filename to + load, FILE; the second is a number (as parsed by strtoul (..., ..., + 0)), which is an offset to apply to the load addresses of FILE's + sections. The target may define switches, or other non-switch + arguments, as it pleases. */ extern void target_load (char *arg, int from_tty); Index: src/gdb/testsuite/gdb.base/help.exp =================================================================== --- src.orig/gdb/testsuite/gdb.base/help.exp 2005-12-07 14:15:01.000000000 +0000 +++ src/gdb/testsuite/gdb.base/help.exp 2005-12-07 17:24:55.000000000 +0000 @@ -277,7 +277,7 @@ gdb_test "help l" "List specified functi # test help list gdb_test "help list" "List specified function or line\.\[\r\n\]+With no argument, lists ten more lines after or around previous listing\.\[\r\n\]+\"list -\" lists the ten lines before a previous ten-line listing\.\[\r\n\]+One argument specifies a line, and ten lines are listed around that line\.\[\r\n\]+Two arguments with comma between specify starting and ending lines to list\.\[\r\n\]+Lines can be specified in these ways:\[\r\n\]+ LINENUM, to list around that line in current file,\[\r\n\]+ FILE:LINENUM, to list around that line in that file,\[\r\n\]+ FUNCTION, to list around beginning of that function,\[\r\n\]+ FILE:FUNCTION, to distinguish among like-named static functions\.\[\r\n\]+ \[*\]ADDRESS, to list around the line containing that address\.\[\r\n\]+With two args if one is empty it stands for ten lines away from the other arg\." "help list" # test help load -gdb_test "help load" "Dynamically load FILE into the running program, and record its symbols\[\r\n\]+for access from GDB\." "help load" +gdb_test "help load" "Dynamically load FILE into the running program, and record its symbols\[\r\n\]+for access from GDB\.\[\r\n\]+A load OFFSET may also be given\." "help load" # test help make gdb_test "help make" "Run the ``make'' program using the rest of the line as arguments\." "help make" # test help next "n" abbreviation ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2005-12-07 23:25 ` Andrew STUBBS @ 2005-12-08 0:19 ` Andrew STUBBS 2006-02-20 17:07 ` Daniel Jacobowitz 0 siblings, 1 reply; 11+ messages in thread From: Andrew STUBBS @ 2005-12-08 0:19 UTC (permalink / raw) Cc: Jim Blandy, GDB Patches [-- Attachment #1: Type: text/plain, Size: 64 bytes --] I forgot to update the Makefile dependencies. Update attached. [-- Attachment #2: load-2.patch --] [-- Type: text/plain, Size: 8299 bytes --] 2005-12-07 Andrew Stubbs <andrew.stubbs@st.com> * symfile.c (generic_load): Use buildargv() and tilde_expand() to parse file names with quoting, spaces and tildes properly. (load_command): Quote all special characters before calling target_load() such that buildargv() doesn't break file names. (_initialize_symfile): Mention the load offset in the help for the load command. * remote-sim.c: Include readline.h. (gdbsim_load): Use buildargv and tilde_expand() to parse file names with quoting, spaces and tildes properly. * target.h (target_load): Comment the parameters better. * Makefile.in (remote_sim.o): Add readline.h dependency. Index: src/gdb/symfile.c =================================================================== --- src.orig/gdb/symfile.c 2005-12-02 16:15:22.000000000 +0000 +++ src/gdb/symfile.c 2005-12-07 16:41:26.000000000 +0000 @@ -1468,7 +1468,42 @@ static void load_command (char *arg, int from_tty) { if (arg == NULL) - arg = get_exec_file (1); + { + char *parg; + int count = 0; + + parg = arg = get_exec_file (1); + + /* Count how many \ " ' tab space there are in the name. */ + while ((parg = strpbrk (parg, "\\\"'\t "))) + { + parg++; + count++; + } + + if (count) + { + /* We need to quote this string so buildargv can pull it apart. */ + char *temp = xmalloc (strlen (arg) + count + 1 ); + char *ptemp = temp; + char *prev; + + make_cleanup (xfree, temp); + + prev = parg = arg; + while ((parg = strpbrk (parg, "\\\"'\t "))) + { + strncpy (ptemp, prev, parg - prev); + ptemp += parg - prev; + prev = parg++; + *ptemp++ = '\\'; + } + strcpy (ptemp, prev); + + arg = temp; + } + } + target_load (arg, from_tty); /* After re-loading the executable, we don't really know which @@ -1615,33 +1650,40 @@ generic_load (char *args, int from_tty) bfd *loadfile_bfd; struct timeval start_time, end_time; char *filename; - struct cleanup *old_cleanups; - char *offptr; + struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0); struct load_section_data cbdata; CORE_ADDR entry; + char **argv; cbdata.load_offset = 0; /* Offset to add to vma for each section. */ cbdata.write_count = 0; /* Number of writes needed. */ cbdata.data_count = 0; /* Number of bytes written to target memory. */ cbdata.total_size = 0; /* Total size of all bfd sectors. */ - /* Parse the input argument - the user can specify a load offset as - a second argument. */ - filename = xmalloc (strlen (args) + 1); - old_cleanups = make_cleanup (xfree, filename); - strcpy (filename, args); - offptr = strchr (filename, ' '); - if (offptr != NULL) + argv = buildargv (args); + + if (argv == NULL) + nomem(0); + + make_cleanup_freeargv (argv); + + filename = tilde_expand (argv[0]); + make_cleanup (xfree, filename); + + if (argv[1] != NULL) { char *endptr; - cbdata.load_offset = strtoul (offptr, &endptr, 0); - if (offptr == endptr) - error (_("Invalid download offset:%s."), offptr); - *offptr = '\0'; + cbdata.load_offset = strtoul (argv[1], &endptr, 0); + + /* If the last word was not a valid number then + treat it as a file name with spaces in. */ + if (argv[1] == endptr) + error (_("Invalid download offset:%s."), argv[1]); + + if (argv[2] != NULL) + error (_("Too many parameters.")); } - else - cbdata.load_offset = 0; /* Open the file for loading. */ loadfile_bfd = bfd_openr (filename, gnutarget); @@ -3716,7 +3758,8 @@ Load the symbols from shared objects in c = add_cmd ("load", class_files, load_command, _("\ Dynamically load FILE into the running program, and record its symbols\n\ -for access from GDB."), &cmdlist); +for access from GDB.\n\ +A load OFFSET may also be given."), &cmdlist); set_cmd_completer (c, filename_completer); add_setshow_boolean_cmd ("symbol-reloading", class_support, Index: src/gdb/remote-sim.c =================================================================== --- src.orig/gdb/remote-sim.c 2005-11-29 10:51:01.000000000 +0000 +++ src/gdb/remote-sim.c 2005-12-07 17:32:55.000000000 +0000 @@ -43,6 +43,7 @@ #include "gdb_assert.h" #include "sim-regno.h" #include "arch-utils.h" +#include "readline/readline.h" /* Prototypes */ @@ -391,8 +392,21 @@ gdbsim_kill (void) GDB's symbol tables to match. */ static void -gdbsim_load (char *prog, int fromtty) +gdbsim_load (char *args, int fromtty) { + char **argv = buildargv (args); + char *prog; + + if (argv == NULL) + nomem (0); + + make_cleanup_freeargv (argv); + + prog = tilde_expand (argv[0]); + + if (argv[1] != NULL) + error (_("GDB sim does not yet support a load offset.")); + if (sr_get_debug ()) printf_filtered ("gdbsim_load: prog \"%s\"\n", prog); Index: src/gdb/target.h =================================================================== --- src.orig/gdb/target.h 2005-09-04 17:18:20.000000000 +0100 +++ src/gdb/target.h 2005-12-07 14:18:05.000000000 +0000 @@ -679,7 +679,14 @@ extern void print_section_info (struct t /* Load an executable file into the target process. This is expected to not only bring new code into the target process, but also to - update GDB's symbol tables to match. */ + update GDB's symbol tables to match. + + ARG contains command-line arguments, to be broken down with + buildargv (). The first non-switch argument is the filename to + load, FILE; the second is a number (as parsed by strtoul (..., ..., + 0)), which is an offset to apply to the load addresses of FILE's + sections. The target may define switches, or other non-switch + arguments, as it pleases. */ extern void target_load (char *arg, int from_tty); Index: src/gdb/testsuite/gdb.base/help.exp =================================================================== --- src.orig/gdb/testsuite/gdb.base/help.exp 2005-12-07 14:15:01.000000000 +0000 +++ src/gdb/testsuite/gdb.base/help.exp 2005-12-07 17:24:55.000000000 +0000 @@ -277,7 +277,7 @@ gdb_test "help l" "List specified functi # test help list gdb_test "help list" "List specified function or line\.\[\r\n\]+With no argument, lists ten more lines after or around previous listing\.\[\r\n\]+\"list -\" lists the ten lines before a previous ten-line listing\.\[\r\n\]+One argument specifies a line, and ten lines are listed around that line\.\[\r\n\]+Two arguments with comma between specify starting and ending lines to list\.\[\r\n\]+Lines can be specified in these ways:\[\r\n\]+ LINENUM, to list around that line in current file,\[\r\n\]+ FILE:LINENUM, to list around that line in that file,\[\r\n\]+ FUNCTION, to list around beginning of that function,\[\r\n\]+ FILE:FUNCTION, to distinguish among like-named static functions\.\[\r\n\]+ \[*\]ADDRESS, to list around the line containing that address\.\[\r\n\]+With two args if one is empty it stands for ten lines away from the other arg\." "help list" # test help load -gdb_test "help load" "Dynamically load FILE into the running program, and record its symbols\[\r\n\]+for access from GDB\." "help load" +gdb_test "help load" "Dynamically load FILE into the running program, and record its symbols\[\r\n\]+for access from GDB\.\[\r\n\]+A load OFFSET may also be given\." "help load" # test help make gdb_test "help make" "Run the ``make'' program using the rest of the line as arguments\." "help make" # test help next "n" abbreviation Index: src/gdb/Makefile.in =================================================================== --- src.orig/gdb/Makefile.in 2005-12-02 16:15:21.000000000 +0000 +++ src/gdb/Makefile.in 2005-12-07 17:51:41.000000000 +0000 @@ -2465,7 +2465,8 @@ remote-sds.o: remote-sds.c $(defs_h) $(g remote-sim.o: remote-sim.c $(defs_h) $(inferior_h) $(value_h) \ $(gdb_string_h) $(terminal_h) $(target_h) $(gdbcore_h) \ $(gdb_callback_h) $(gdb_remote_sim_h) $(remote_utils_h) $(command_h) \ - $(regcache_h) $(gdb_assert_h) $(sim_regno_h) $(arch_utils_h) + $(regcache_h) $(gdb_assert_h) $(sim_regno_h) $(arch_utils_h) \ + $(readline_h) remote-st.o: remote-st.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \ $(serial_h) $(regcache_h) remote-utils.o: remote-utils.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) \ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2005-12-08 0:19 ` Andrew STUBBS @ 2006-02-20 17:07 ` Daniel Jacobowitz 2006-02-20 20:03 ` Jim Blandy 0 siblings, 1 reply; 11+ messages in thread From: Daniel Jacobowitz @ 2006-02-20 17:07 UTC (permalink / raw) To: Andrew STUBBS; +Cc: Jim Blandy, GDB Patches On Wed, Dec 07, 2005 at 05:52:05PM +0000, Andrew STUBBS wrote: > 2005-12-07 Andrew Stubbs <andrew.stubbs@st.com> > > * symfile.c (generic_load): Use buildargv() and tilde_expand() > to parse file names with quoting, spaces and tildes properly. > (load_command): Quote all special characters before calling > target_load() such that buildargv() doesn't break file names. > (_initialize_symfile): Mention the load offset in the help for > the load command. > * remote-sim.c: Include readline.h. > (gdbsim_load): Use buildargv and tilde_expand() to parse file > names with quoting, spaces and tildes properly. > * target.h (target_load): Comment the parameters better. > * Makefile.in (remote_sim.o): Add readline.h dependency. This all looks plausible to me. Jim, do you want to take a look at this, since you were previously? -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2006-02-20 17:07 ` Daniel Jacobowitz @ 2006-02-20 20:03 ` Jim Blandy 2006-02-20 20:38 ` Daniel Jacobowitz 0 siblings, 1 reply; 11+ messages in thread From: Jim Blandy @ 2006-02-20 20:03 UTC (permalink / raw) To: Andrew STUBBS, Jim Blandy, GDB Patches On 2/20/06, Daniel Jacobowitz <drow@false.org> wrote: > On Wed, Dec 07, 2005 at 05:52:05PM +0000, Andrew STUBBS wrote: > > 2005-12-07 Andrew Stubbs <andrew.stubbs@st.com> > > > > * symfile.c (generic_load): Use buildargv() and tilde_expand() > > to parse file names with quoting, spaces and tildes properly. > > (load_command): Quote all special characters before calling > > target_load() such that buildargv() doesn't break file names. > > (_initialize_symfile): Mention the load offset in the help for > > the load command. > > * remote-sim.c: Include readline.h. > > (gdbsim_load): Use buildargv and tilde_expand() to parse file > > names with quoting, spaces and tildes properly. > > * target.h (target_load): Comment the parameters better. > > * Makefile.in (remote_sim.o): Add readline.h dependency. > > This all looks plausible to me. Jim, do you want to take a look at > this, since you were previously? Yes --- this look good. Ideally, the code added to load_command to do the quoting should be in libiberty/argv.c. But this patch is fine as is. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2006-02-20 20:03 ` Jim Blandy @ 2006-02-20 20:38 ` Daniel Jacobowitz 2006-02-21 18:27 ` Andrew STUBBS 0 siblings, 1 reply; 11+ messages in thread From: Daniel Jacobowitz @ 2006-02-20 20:38 UTC (permalink / raw) To: Jim Blandy; +Cc: Andrew STUBBS, GDB Patches On Mon, Feb 20, 2006 at 11:59:42AM -0800, Jim Blandy wrote: > On 2/20/06, Daniel Jacobowitz <drow@false.org> wrote: > > On Wed, Dec 07, 2005 at 05:52:05PM +0000, Andrew STUBBS wrote: > > > 2005-12-07 Andrew Stubbs <andrew.stubbs@st.com> > > > > > > * symfile.c (generic_load): Use buildargv() and tilde_expand() > > > to parse file names with quoting, spaces and tildes properly. > > > (load_command): Quote all special characters before calling > > > target_load() such that buildargv() doesn't break file names. > > > (_initialize_symfile): Mention the load offset in the help for > > > the load command. > > > * remote-sim.c: Include readline.h. > > > (gdbsim_load): Use buildargv and tilde_expand() to parse file > > > names with quoting, spaces and tildes properly. > > > * target.h (target_load): Comment the parameters better. > > > * Makefile.in (remote_sim.o): Add readline.h dependency. > > > > This all looks plausible to me. Jim, do you want to take a look at > > this, since you were previously? > > Yes --- this look good. > > Ideally, the code added to load_command to do the quoting should be in > libiberty/argv.c. But this patch is fine as is. Good enough. We can deal with that separately, or just put it in utils.c, if we need it again. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow spaces in filenames to load command 2006-02-20 20:38 ` Daniel Jacobowitz @ 2006-02-21 18:27 ` Andrew STUBBS 0 siblings, 0 replies; 11+ messages in thread From: Andrew STUBBS @ 2006-02-21 18:27 UTC (permalink / raw) To: Jim Blandy, GDB Patches Daniel Jacobowitz wrote: >> Yes --- this look good. >> >> Ideally, the code added to load_command to do the quoting should be in >> libiberty/argv.c. But this patch is fine as is. > > Good enough. We can deal with that separately, or just put it in > utils.c, if we need it again. Thanks, committed. Andrew ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-02-21 18:23 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-12-06 17:06 [PATCH] Allow spaces in filenames to load command Andrew STUBBS 2005-12-06 18:23 ` Jim Blandy 2005-12-06 20:28 ` Andrew STUBBS 2005-12-07 17:44 ` Jim Blandy 2005-12-07 19:35 ` Jim Blandy 2005-12-07 23:25 ` Andrew STUBBS 2005-12-08 0:19 ` Andrew STUBBS 2006-02-20 17:07 ` Daniel Jacobowitz 2006-02-20 20:03 ` Jim Blandy 2006-02-20 20:38 ` Daniel Jacobowitz 2006-02-21 18:27 ` Andrew STUBBS
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox