This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Fix mi-break.exp: 'b "basics.c":16'


On Wed, Apr 03, 2002 at 09:58:24AM -0600, Michael Elizabeth Chastain wrote:
> I have a question about this linespec patch.
> 
> After I apply the patch, decode_line_1 looks like this:
> 
>       /* Extract the file name.  */
>       p1 = p;
>       while (p != *argptr && p[-1] == ' ')
> 	--p;
>       if ((*p == '"') && is_quote_enclosed)
> 	--p;
>       copy = (char *) alloca (p - *argptr + 1);
>       memcpy (copy, *argptr, p - *argptr);
>       /* It may have the ending quote right after the file name */
>       if (is_quote_enclosed && copy[p - *argptr - 1] == '"')
> 	copy[p - *argptr - 1] = 0;
>       else
> 	copy[p - *argptr] = 0;
> 
> If there is a '"' at the end, then it won't be copied into "copy".
> So these lines look redundant to me:
> 
>       if (is_quote_enclosed && copy[p - *argptr - 1] == '"')
> 	copy[p - *argptr - 1] = 0;
> 
> Or maybe I am missing something, such as nested quotes?

The two lines:
      if ((*p == '"') && is_quote_enclosed)
	--p;
I left because they were there, and I don't understand every situation
that can reach this code.  But for "basics.c":16, *p == ':'.  So the
quote is actually copied.

> 
> Michael C
> 
>   2002-04-02  Daniel Jacobowitz  <drow@mvista.com>
> 
> 	  * linespec.c (decode_line_1): Check for a double quote after
> 	  a filename correctly.
> 
> 

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]