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'


Daniel Jacobowitz writes:
 > On Tue, Apr 02, 2002 at 07:29:59PM -0500, Daniel Jacobowitz wrote:
 > > [I dislike decode_line_1.  But that seems to be the general consensus...]
 > > 
 > > There was a logic error in the code to handle "file":line.  Several,
 > > actually.  I suspect that it once worked and had bitrotten as the behavior
 > > of the function changed.  For instance, at the beginning of the function:
 > > 
 > >   if (p[0] == '"')
 > >     {
 > >       is_quote_enclosed = 1;
 > >       (*argptr)++;
 > >       p++;
 > >     }
 > > 
 > > Then below it checked 'is_quote_enclosed && (**argptr) == '"').  That'll
 > > only be true given a literal '"":<line>', which was not the intent of the
 > > test.
 > > 
 > > 
 > > This patch updates the behavior, should change nothing else, and causes no
 > > regressions.  OK to check in?
 > 
 > Only Michael Chastain (who recommended it for approval) had anything to
 > say about this patch.  Ping?
 > 


Argh. I thought from the subject it was a testsuite patch, not a
linespec patch. I'll take a look. Just a sec.

Elena


 > 
 > > 2002-04-02  Daniel Jacobowitz  <drow@mvista.com>
 > > 
 > > 	* linespec.c (decode_line_1): Check for a double quote after
 > > 	a filename correctly.
 > > 
 > > Index: linespec.c
 > > ===================================================================
 > > RCS file: /cvs/src/src/gdb/linespec.c,v
 > > retrieving revision 1.17
 > > diff -u -p -r1.17 linespec.c
 > > --- linespec.c	2002/03/22 18:57:07	1.17
 > > +++ linespec.c	2002/04/03 00:19:30
 > > @@ -929,20 +929,12 @@ decode_line_1 (char **argptr, int funfir
 > >        if ((*p == '"') && is_quote_enclosed)
 > >  	--p;
 > >        copy = (char *) alloca (p - *argptr + 1);
 > > -      if ((**argptr == '"') && is_quote_enclosed)
 > > -	{
 > > -	  memcpy (copy, *argptr + 1, p - *argptr - 1);
 > > -	  /* It may have the ending quote right after the file name */
 > > -	  if (copy[p - *argptr - 2] == '"')
 > > -	    copy[p - *argptr - 2] = 0;
 > > -	  else
 > > -	    copy[p - *argptr - 1] = 0;
 > > -	}
 > > +      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
 > > -	{
 > > -	  memcpy (copy, *argptr, p - *argptr);
 > > -	  copy[p - *argptr] = 0;
 > > -	}
 > > +	copy[p - *argptr] = 0;
 > >  
 > >        /* Find that file's data.  */
 > >        s = lookup_symtab (copy);
 > > 
 > 
 > -- 
 > 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]