[PATCH] Allow spaces in filenames to load command

Andrew STUBBS andrew.stubbs@st.com
Tue Dec 6 20:28:00 GMT 2005


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



More information about the Gdb-patches mailing list