From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30250 invoked by alias); 14 Mar 2011 18:29:26 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 30232 invoked by uid 22791); 14 Mar 2011 18:29:25 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org From: Tom Tromey To: Keith Seitz Cc: archer@sourceware.org Subject: Re: Expression Parser Plug-In Available References: <4D79389C.7050500@redhat.com> Date: Mon, 14 Mar 2011 18:29:00 -0000 In-Reply-To: <4D79389C.7050500@redhat.com> (Keith Seitz's message of "Thu, 10 Mar 2011 12:46:20 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2011-q1/txt/msg00127.txt.bz2 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 Yikes. 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 untyped. 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...) Tom