IDE, DBG: Obey Options for debug hint eval

git-svn-id: trunk@32236 -
This commit is contained in:
martin 2011-09-08 17:21:19 +00:00
parent 3a422036a4
commit 160132b781

View File

@ -16224,50 +16224,52 @@ begin
end;
case ToolStatus of
itDebugger: begin
if SrcEdit.SelectionAvailable and SrcEdit.CaretInSelection(CaretPos) then
Expression := SrcEdit.GetText(True)
else
Expression := SrcEdit.GetOperandFromCaret(CaretPos);
if Expression='' then exit;
//DebugLn(['TMainIDE.OnSrcNotebookShowHintForSource Expression="',Expression,'"']);
DBGType:=nil;
DBGTypeDerefer:=nil;
Opts := [];
if EditorOpts.DbgHintAutoTypeCastClass
then Opts := [defClassAutoCast];
if not DebugBoss.Evaluate(Expression, DebugEval, DBGType, Opts) or (DebugEval = '') then
DebugEval := '???';
// deference a pointer - maybe it is a class
if Assigned(DBGType) and (DBGType.Kind in [skPointer]) and
not( StringCase(Lowercase(DBGType.TypeName), ['char', 'character', 'ansistring']) in [0..2] )
then
begin
if DBGType.Value.AsPointer <> nil then
if EditorOpts.AutoToolTipExprEval then begin
if SrcEdit.SelectionAvailable and SrcEdit.CaretInSelection(CaretPos) then
Expression := SrcEdit.GetText(True)
else
Expression := SrcEdit.GetOperandFromCaret(CaretPos);
if Expression='' then exit;
//DebugLn(['TMainIDE.OnSrcNotebookShowHintForSource Expression="',Expression,'"']);
DBGType:=nil;
DBGTypeDerefer:=nil;
Opts := [];
if EditorOpts.DbgHintAutoTypeCastClass
then Opts := [defClassAutoCast];
if not DebugBoss.Evaluate(Expression, DebugEval, DBGType, Opts) or (DebugEval = '') then
DebugEval := '???';
// deference a pointer - maybe it is a class
if Assigned(DBGType) and (DBGType.Kind in [skPointer]) and
not( StringCase(Lowercase(DBGType.TypeName), ['char', 'character', 'ansistring']) in [0..2] )
then
begin
if DebugBoss.Evaluate(Expression + '^', DebugEvalDerefer, DBGTypeDerefer, Opts) then
if DBGType.Value.AsPointer <> nil then
begin
if Assigned(DBGTypeDerefer) and
( (DBGTypeDerefer.Kind <> skPointer) or
(StringCase(Lowercase(DBGTypeDerefer.TypeName), ['char', 'character', 'ansistring']) in [0..2])
)
then
DebugEval := DebugEval + ' = ' + DebugEvalDerefer;
if DebugBoss.Evaluate(Expression + '^', DebugEvalDerefer, DBGTypeDerefer, Opts) then
begin
if Assigned(DBGTypeDerefer) and
( (DBGTypeDerefer.Kind <> skPointer) or
(StringCase(Lowercase(DBGTypeDerefer.TypeName), ['char', 'character', 'ansistring']) in [0..2])
)
then
DebugEval := DebugEval + ' = ' + DebugEvalDerefer;
end;
end;
end;
FreeAndNil(DBGType);
FreeAndNil(DBGTypeDerefer);
HasHint:=true;
Expression := Expression + ' = ' + DebugEval;
if SmartHintStr<>'' then begin
p:=System.Pos('<body>',lowercase(SmartHintStr));
if p>0 then begin
Insert('<div class="debuggerhint">'+Expression+'</div><br>',SmartHintStr,p+length('<body>'));
end else begin
SmartHintStr:=Expression+LineEnding+LineEnding+SmartHintStr;
end;
end else
SmartHintStr:=Expression;
end;
FreeAndNil(DBGType);
FreeAndNil(DBGTypeDerefer);
HasHint:=true;
Expression := Expression + ' = ' + DebugEval;
if SmartHintStr<>'' then begin
p:=System.Pos('<body>',lowercase(SmartHintStr));
if p>0 then begin
Insert('<div class="debuggerhint">'+Expression+'</div><br>',SmartHintStr,p+length('<body>'));
end else begin
SmartHintStr:=Expression+LineEnding+LineEnding+SmartHintStr;
end;
end else
SmartHintStr:=Expression;
end;
end;