This question is not related to cnPack, so I apologise in advance for that, but I was thinking that maybe some of you know the answer
I am trying to make debugger Visualizer for Dataset classes for Delphi 2010, using build in StringListVisualizer as a reference, but I can't get
viewed object with IOTAThread.Evaluate, btw. StringListVisualizer gets content with eval as string.
I tried casting value returned from Evaluate in ResultAddr to TDataset but that is not working, in variable Exppresion is dataset variable
name and EvalRes is returne as erOK, but when I try to use Result access violation occures.
Here is the code (this is a slightly modified code from StringList visualizer) :
function TDatasetViewerFrame.GetDataset(Expression: string): TDataset;
var
CurProcess: IOTAProcess;
CurThread: IOTAThread;
ResultStr: array[0..4095] of Char;
CanModify: Boolean;
ResultAddr, ResultSize, ResultVal: LongWord;
EvalRes: TOTAEvaluateResult;
DebugSvcs: IOTADebuggerServices;
begin
begin
Result := nil;
if Supports(BorlandIDEServices, IOTADebuggerServices, DebugSvcs) then
CurProcess := DebugSvcs.CurrentProcess;
if CurProcess <> nil then
begin
CurThread := CurProcess.CurrentThread;
if CurThread <> nil then
begin
EvalRes := CurThread.Evaluate(Expression, @ResultStr, Length(ResultStr), CanModify, eseAll, '', ResultAddr, ResultSize, ResultVal,
'', 0);
case EvalRes of
erOK:
Result := TDataset(ResultAddr); // Result is shown as Inaccessible value in debugger