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]

Re: [RFA] linespec.c change to stop "malformed template specification" error


Elena Zannoni wrote:
> 
> Daniel Berlin writes:
>  > This error is cause by find_toplevel_char not knowing that '<' and '>'
>  > increase and decrease the depth we are at.
>  >
>  > The result is that if you say "break _Rb_tree<int, int>", when it goes
>  > to look for a comma at the top level, it thinks it found one right
>  > after the "int", and temporarily truncates the string to '_Rb_tree<int,'
>  > When we then proceed to go through the string, we see the "<", and
>  > then go to find the end of the template name, and can't, because we've
>  > truncated the string in the wrong place, and issue an error.
>  >
>  > Cute, no?
>  >
>  > --Dan
>  >
> 
> Seems OK to me, but could you update the comment on top of the
> find_toplevel_char() to reflect that the char is looked for also
> outside of '<' and '>' pairs?
> 
> Any of the other maintainers (Jim, Fernando) has any comments?
> 
> Thanks
> Elena
> 

It _seems_ OK to me, but, as we all know, in this particular piece of code unforeseen side effects may appear.  But the only way to know is to try it.  The current situation (of ignoring he < and >) is obviously wrong, so we must try.

Fernando


>  >
>  >  2001-05-22  Daniel Berlin  <dan@cgsoftware.com>
>  >
>  >      * linespec.c (find_toplevel_char): '<' and '>' also increase and
>  >      decrease the depth we are at, in the case of templates.
>  >
>  >
>  > Index: linespec.c
>  > ===================================================================
>  > RCS file: /cvs/src/src/gdb/linespec.c,v
>  > retrieving revision 1.11
>  > diff -c -3 -p -r1.11 linespec.c
>  > *** linespec.c       2001/04/27 00:19:09     1.11
>  > --- linespec.c       2001/05/22 20:58:12
>  > *************** find_toplevel_char (char *s, char c)
>  > *** 274,282 ****
>  >      return scan;
>  >         else if (*scan == '"' || *scan == '\'')
>  >      quoted = *scan;
>  > !       else if (*scan == '(')
>  >      depth++;
>  > !       else if (*scan == ')' && depth > 0)
>  >      depth--;
>  >       }
>  >
>  > --- 274,282 ----
>  >      return scan;
>  >         else if (*scan == '"' || *scan == '\'')
>  >      quoted = *scan;
>  > !       else if (*scan == '(' || *scan == '<')
>  >      depth++;
>  > !       else if ((*scan == ')' || *scan == '>') && depth > 0)
>  >      depth--;
>  >       }
>  >
>  >
>  > --
>  > "In my house on the ceilings I have paintings of the rooms
>  > above...  So I never have to go upstairs.
>  > "-Steven Wright
>  >

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


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