Debugger: should expressionUnderCursor use the DUCain?

Niko Sams niko.sams at gmail.com
Sun Mar 21 13:24:34 UTC 2010


On Sun, Mar 21, 2010 at 13:48, David Nolden <zwabel at googlemail.com> wrote:
> Am Sonntag 21 März 2010 12:41:09 schrieb Niko Sams:
>> Hi,
>>
>> The current implementation of
>> VariableController::expressionUnderCursor (should return
>> the string of the variable that should be shown in the variable
>> tooltip) parses the text
>> manually.
>> Thow issues with this implementation:
>> - it's buggy (https://bugs.kde.org/show_bug.cgi?id=231466) - but that
>> can be fixed
>> - it shows the popup for basically everyting (functions, macros, even
>> comments) while it should
>>   only for variables (we could simply ignore this)
>>
>> And we have the data in the DUChain - why not use it; a simple
>> findContextAt and findDeclarationAt
>> should do it.
>>
>> Issues:
>> - it only works when the file is parsed correctly (projects may not be
>> setup correctly etc)
>> - gdb supports much more than just c/c++ (but atm we don't)
>>
>> Any comments on this?
>
> I guess the best thing would be if the duchain was used as an optional
> "helper" to either reject or manipulate the tooltip requests, and use the
> current implementation as fallback.
You mean something like this:
if (chain && chain->findContextAt(pos)) {
   //use chain->findContextAt(pos)->findDeclarationAt(pos);
} else {
   //current implementation
}

Niko




More information about the KDevelop-devel mailing list