Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Debugging Text Hover in CDT.

Anita,

Thank you for looking at it. I have attached your patch to https://bugs.eclipse.org/bugs/show_bug.cgi?id=40101.
I'll put my comments there when I try it.

Mikhail

----- Original Message ----- From: "Birje, Anita (STSD)" <anita.birje@xxxxxx>
To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Sent: Monday, November 14, 2005 6:18 AM
Subject: RE: [cdt-dev] Debugging Text Hover in CDT.



Hi,

Problem  :
----------
Hovering on 'array_index', 'structure_var.fieldname' and
'structure_var -> fieldname' doesn't give the correct value.

Analysis :
---------
I analysed the code in 'CWordFinder.java' (findWord() method),
which passes the offset and length to 'DebugTextHover.java'. The
document is parsed to get the word boundaries i.e. offset. Parsing stops
when a non Java identifier is found (Character.isJavaIdentifierPart at
line no. 65), which are not the actual delimiters in case of C/C++.

This breaks the field or an array index leading to an incorrect variable
name.

Solution :
----------
Following are the code changes required which gives the correct text
hover value.

 i) For 'structure_variable.fieldname' (To continue if "." is
encountered, i.e. displaying the structure field)

if (character is not JavaIdentifier AND character is not '.')
break;

ii) For 'structure_variable->fieldname' (To continue if "->" is
encountered, i.e. pointers to structures)
if (character is '>' and previous_character is '-') get
next_offset


iii) For 'array_name[index]' (To continue if its an array index)
if(character or previous_character is ']' )
do
get next_offset
get character at offset

while character != ']'


This is just the code fix for the above listed problems, I am not sure
if there would be any repercussions.

If you think this is a correct fix, I have attached the patch. Please
apply the patch.

Regards,
Anita Birje


-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Mikhail Khodjaiants
Sent: Friday, November 11, 2005 1:37 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Debugging Text Hover in CDT.

This is a known issue. See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=40101.
The expression selected in the editor has to be parsed to avoid
expressions like "++i". Currently we don't use parser for filtering.

----- Original Message -----
From: "Birje, Anita (STSD)" <anita.birje@xxxxxx>
To: <cdt-dev@xxxxxxxxxxx>
Sent: Thursday, November 10, 2005 9:37 AM
Subject: [cdt-dev] Debugging Text Hover in CDT.


Hi,

I am trying to investigate how hover works in CDT debug mode.

When I hover over struct variable it gives field details as follows
currentdate = {day = 10, month = 11, year = 2005}

Whereas hovering over the struct fields, doesn't display its value.
Message displayed at console is : 'No symbol "day" in current
context'.

I went through the CDT code, the "DebugTextHover.java" takes only the
"fieldname" and not the "structure_variable.fieldname" to get the
value.
(offset and length passed might be incorrect)
For Eg: Line No. 64 -> String expression = document.get(
hoverRegion.getOffset(), hoverRegion.getLength() );
This returns "day" instead it should have been "currentdate.day".

Is this an expected behaviour,a known issue or an unknown bug. Please
help!

Thanks & Regards,
Anita Birje

P.S. The program used for testing this functionality:


//**********************************************************************
*****************
struct date
{
int day;
int month;
int year;
};

#include <stdio.h>
int main()
{
struct date currentdate = {10,11,2005};

cout<<"\n\nPrinting day : "<<currentdate.day<<endl
<<"Printing month : "<<currentdate.month<<endl
<<"Printing year : "<<currentdate.year<<endl<<endl;

return 0;
}

//**********************************************************************
******************

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev





Back to the top