DBMonitor CallStack
DBMonitor CallStack
Hi,
I wan to extend the db monitor to transfer the delphi call stack. I have changed the implementation of SendDBMonitorEvent to fill the CallStack field of TMonitorEvent, but what is the required format to enable the call tree in db monitor app?
I wan to extend the db monitor to transfer the delphi call stack. I have changed the implementation of SendDBMonitorEvent to fill the CallStack field of TMonitorEvent, but what is the required format to enable the call tree in db monitor app?
Hi,
I have added a new procedure variable to interface part of DASQLMonitor.pas:
and added the call of this procedure to SendDBMonitorEvent:
in the custom procedure I am using madExcept to get the current call stack and make up the call stack string array.
I have added a new procedure variable to interface part of DASQLMonitor.pas:
Code: Select all
var
GetCallStackProc: procedure (var ACallStack: TWideStringDynArray);
Code: Select all
if Assigned(GetCallStackProc) then
GetCallStackProc(Msg.CallStack);
This is just an array of method names:
Code: Select all
procedure FillCallStack(var CallStack: TWideStringDynArray);
begin
SetLength(CallStack, 3);
CallStack[0] := 'TClass1.Method1';
CallStack[1] := 'TClass2.Method2';
CallStack[2] := 'TClass3.Method3';
end;
So something like would work also:
Kind regards
Jens[/quote]
Code: Select all
procedure FillCallStack(var CallStack: TWideStringDynArray);
begin
SetLength(CallStack, 3);
CallStack[0] := 'TClass1.Method1 (p1 : ''abcd'', p2 : 123)';
CallStack[1] := 'TClass2.Method2 (p1 : ''abcd'')';
CallStack[2] := 'TClass3.Method3';
end;
Jens[/quote]
Method name should be the same for each call. Otherwise dbMonitor duplicates methods in Call Tree.
Normally you pass the parameter data types but not values:
Normally you pass the parameter data types but not values:
Code: Select all
'TClass1.Method1 (p1 : string, p2 : integer)'
Hi Jens,
Here it goes:jfudickar wrote:@ a-s-z:
Will you publish your madexcept code. I'm a little bit busy
Kind regards
Jens
Code: Select all
procedure GetCallStackMadExcept(var ACallStack: TWideStringDynArray);
var
off, idx: Integer;
AStackTrace: TStackTrace;
begin
madExcept.GetThreadStackTrace(0, False, True, True, @AStackTrace);
off := 1;
while off 0 then
ACallStack[idx] := 'line: ' + IntToStr(relLine) + ', '
else
ACallStack[idx] := '';
ACallStack[idx] := UnitName + '.' + FunctionName + ' (' +
ACallStack[idx] + '[' + ModuleName + '])@$' + IntToHex(Integer(Addr) - relAddr, 8);
end;
end;