This is the mail archive of the gdb@sourceware.org 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: MI: type prefixes for values


> > > - The parsing of that value will have to be done by ad-hoc code, which is
> > > contrary to MI-goal of being easily parsable.
> >
> > Why ad-hoc? if you have {}, parse it, if not, don't.  Why is this
> > simple rule hard for a parser?
> 
> Here's the relevant part from KDevelop:
> 
>   if (*start == '{')
>     {
>         // Gdb uses '{' in two cases:
>         // - composites (arrays and structures)
>         // - pointers to functions. In this case type is
>         //   enclosed in "{}". Not sure why it's so, as
>         //   when printing pointer, type is in parenthesis.
>         if (type == typePointer)
>         {
>             // Looks like type in braces at the beginning. Strip it.
>             start = skipDelim(start, '{', '}');
>         }
>         else
>         {
>             // Looks like composite, strip the braces and return.
>             return QCString(start+1, end - start -1);
>         }

Hi Volodya,

I have to say, this looks like a problem with the way you parse the
output of GDB. There should be no "stripping". If you parse it into a
data structure, you simply walk that structure and get the info you
want.

Bob Rossi


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