Developer forums (C::B DEVELOPMENT STRICTLY!) > Contributions to C::B
Evaluate whole expression under cursor
p2rkw:
Hi,
tonight I make patch that sends whole expression under cursor to debugger.
If you often debug code like: getSth()->doSth you will like it ;)
I hope everything in patch is all right because it's bit late.
Here's my test code:
--- Code: ---struct A1
{
A1() : selfRef( *this )
{
alsoMe = this;
}
A1* selfPtr(int a, int b)
{
return this;
}
template<class T>
A1& memTemp( const T& t1, const T& t2 )
{
return *this;
}
static A1* alsoMe;
int someVeryLongInt;
A1& selfRef;
};
A1* A1::alsoMe = 0;
A1 giveAtPlease(int a, int b)
{
return A1();
}
int main()
{
A1 someVeryLongA1;
giveAtPlease( 4, 5 ) . selfRef . someVeryLongInt;
A1 array[5];
array[2].selfPtr(4, 2) -> selfRef . someVeryLongInt;
A1::alsoMe -> selfRef. memTemp< float> (4, 5.1f).someVeryLongInt;
someVeryLongA1.memTemp< float> (4, 5.1f).someVeryLongInt;
array[4].selfPtr(2,2);
return 0;
}
--- End code ---
As usual I look forward to feedback.
ollydbg:
Why not just select the expression, and press "CTRL"? (I have set the option: hover and press ctrl to show the value)
p2rkw:
Now c::b can select text for me :) When I debugging step by step I had to select almost every expression, it started annoying me,
especially when I have to select expression like: object.member every time. Consider that when you select to much (for instance: semicolon at end of line) debugger will not be able to evaluate selected text. For me it's faster to point single word than selecting everything.
Thanks for tip with CTRL, I don't know about this feature, finally I don't have to wait for tooltip ( maybe tooltip delay should be customizable? ;) ).
edit: I forgot about main reason: when I hover 'member' in expression 'object.member' I want to see value of object.member not value of local variable named member.
oBFusCATed:
Comments:
1. This is not the right way to do this. Because parsing c/c++ is not an easy task and errors could lead to some bad result as crashing the debugger or putting it in a loop -> crashing c::b. You have to use the code completion. I think there was a patch samewhere doing it. But this requires changes to the sdk.
2. Use spaces not tabs
3. Post your patch on the patch tracker
--- Quote from: p2rkw on September 06, 2012, 10:52:36 am ---... ( maybe tooltip delay should be customizable? ;) )...
--- End quote ---
It is but it is global for all tooltips.
ollydbg:
--- Quote from: p2rkw on September 06, 2012, 10:52:36 am ---edit: I forgot about main reason: when I hover 'member' in expression 'object.member' I want to see value of object.member not value of local variable named member.
--- End quote ---
So, if you hover on "object", you will show the value of "object", if you hover on "member", you will did a left search and show the value "object.member"? This sounds great, but as obF said, how did you do the "left search", it could be complex (contains a lot of expressions), and maybe will cause the gdb to crash. :)
Navigation
[0] Message Index
[#] Next page
Go to full version