This is the mail archive of the mailing list for the Archer 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: Expression Parser Plug-In Available

Keith> In October, we discussed writing a compiler plug-in to play/experiment
Keith> with the possibility of re-using the compiler's parsers for gdb.

Keith> Well, at long last, I have checked-in an initial version of the
Keith> plug-in to do this.

Very cool.

Keith> I should mention: the plug-in could probably be optimized a bit.  I
Keith> had to resort to some expensive location expansion and strcmp'ing
Keith> filename basenames... In the little playing around that I've done,
Keith> this hasn't really been as big an issue as I would have thought,
Keith> though, but I thought it worth mentioning.

I wouldn't worry about this.  Parsing all the C++ is going to be the
major cost.  And if by some miracle the basename stuff shows up, we can
fix it later.

Keith> The phrase "in-line expression" means that the expression was parsed
Keith> at the location given by the input.  [If parsing fails here, the
Keith> plug-in will continue until the end of the file and try again.  In
Keith> that case, it says "at exit".]

What is that for?

Keith> real	0m12.356s
Keith> user	0m5.123s


Keith> Comments/advice/suggestions -- please send them along!

A couple things...

First, I think we should not worry about the C compiler.  GDB's C parser
is not that bad, and anyway is more maintainable than the C++ stuff,
just because C is so much simpler.  I think it is fine to hack on the C
plugin if it helps you in some way, but if it gets in the way at all,
just ditch it.

Second, I realized recently that current approach will not work at all
with convenience functions.  This is because convenience functions are

I think this could be made to work via some evil tricks, but it seems
complicated and hard to make efficient.  (The trick is to do the base
parsing in GDB, using g++ only for name resolution, and do that at
expression-evaluation time.  That way you could invoke the convenience
function before name resolution.  But, this would at least need
memoization to be efficient and would also defer some syntax errors
until the wrong time...)


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