How to get live object from IDE with OTA
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;
ResultStr: array[0..4095] of Char;
ResultAddr, ResultSize, ResultVal: LongWord;
Result := nil;
if Supports(BorlandIDEServices, IOTADebuggerServices, DebugSvcs) then
CurProcess := DebugSvcs.CurrentProcess;
if CurProcess <> nil then
CurThread := CurProcess.CurrentThread;
if CurThread <> nil then
EvalRes := CurThread.Evaluate(Expression, @ResultStr, Length(ResultStr), CanModify, eseAll, '', ResultAddr, ResultSize, ResultVal,
case EvalRes of
Result := TDataset(ResultAddr); // Result is shown as Inaccessible value in debugger
Could you check the hex value of returned ResultAddr?
Or just check its classname using TObject(ResultAddr).ClassName,
If AV occured, indicate it's not an object, and not a Dataset object.
I'm afraid it's a string such as "([csInheritable])", like shown in Evaluation/Modify window when evaluating an object var in it.
Hi Passion !
In Expression variable i have name of an live object (eg. "AdoDataset1") not "([csInheritable])"
Hex value of ResultAddr is $13A46AC
I tried to chek class name of casted pointer but AV occurred, in embarcadero.public.delphi.opentoolsapi I've got an answer that this is not possible because the object's address is in a different virtual address space, to bad :(
So it seems that is not possible to make visualizer for TDataset classes, anyway thanks for your time
I find workaround, but unfortunatly it will work only for dataset that have SaveToFile method, I will evaluate expression (here is the name of dataset variable) + 'SaveToFile('sometempfile')'
this works for TClientDataset
Oh yes. They're not in same process. We can only obtain needed values using whole expression with properties, such as StringList1.Text to get the simple value. Not the object itself.:)
Powered by Discuz! Archiver 5.0.0
© 2001-2006 Comsenz Inc.
This makes Debug Visualizers pretty limited, I hope that next OTA version will have this possibility