Re: MI: type prefixes for values

Bob Rossi
2006-02-17T14:43:56Z

On Fri, Feb 17, 2006 at 05:35:13PM +0300, Vladimir Prus wrote:
> On Friday 17 February 2006 17:26, Bob Rossi wrote:
>
> > > 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 Bob,
>
> > 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.
>
> I'm afraid I don't get you. If I'm given literal string
> "{int (*)(int)} 0x12345678" by gdb, and I want to display it without "{}",
> then I surely have to remove the "{}" part, no?

OK, I misunderstood what you were doing there. Sorry. I have a personal
opinion that the FE is not capable of modifing data that GDB is passing
to it for display purposes. GDB is not bound to having {int (*)(int)},
and it could certainly change to [int (*)(int)] in the next release. (I
know it won't, but the point stands).

Any manipulation or parsing you do of the data that GDB passes back,
IMO, is on your hands. This is *as bad* as parsing the CLI output.

I would fully support the effort to have GDB give smaller chunks of
information, so that FE's can build on what it's given.

Bob Rossi