DBG: Callstack, show frames in assembler.

git-svn-id: trunk@32831 -
This commit is contained in:
martin 2011-10-12 01:26:11 +00:00
parent 5bdf949df0
commit 6a4928281a
6 changed files with 45 additions and 5 deletions

View File

@ -87,7 +87,8 @@ type
FDebugManager: TBaseDebugManager;
FDisassembler: TIDEDisassembler;
FDisassemblerNotification: TIDEDisassemblerNotification;
FCurrentLocation, FLocation: TDBGPtr;
FCurrentLocation: TDBGPtr; // current view location (lines are relative to this location)
FLocation: TDBGPtr; // the actual PC, green "=>" execution mark
FMouseIsDown: Boolean;
FIsVScrollTrack: Boolean;
FVScrollCounter, FVScrollPos: Integer;
@ -148,7 +149,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetLocation(ADebugger: TDebugger; const AAddr: TDBGPtr);
procedure SetLocation(ADebugger: TDebugger; const AAddr: TDBGPtr; const ADispAddr: TDBGPtr = 0);
property Disassembler: TIDEDisassembler read FDisassembler write SetDisassembler;
property DebugManager: TBaseDebugManager read FDebugManager write FDebugManager;
property BreakPoints;
@ -428,7 +429,9 @@ begin
if AnAsmDlgLineEntry.ImageIndex > 0 then exit;
if not (AnAsmDlgLineEntry.State in [lmsStatement, lmsSource]) then exit;
AnAsmDlgLineEntry.ImageIndex := GetBreakPointImageIndex(GetBreakpointFor(AnAsmDlgLineEntry), AnAsmDlgLineEntry.Addr = FLocation);
AnAsmDlgLineEntry.ImageIndex := GetBreakPointImageIndex(GetBreakpointFor(AnAsmDlgLineEntry),
(AnAsmDlgLineEntry.State = lmsStatement) and
(AnAsmDlgLineEntry.Addr = FLocation));
if AnAsmDlgLineEntry.ImageIndex >= 0
then exit;
@ -819,13 +822,15 @@ begin
SetLineCount(pbAsm.Height div FLineHeight);
end;
procedure TAssemblerDlg.SetLocation(ADebugger: TDebugger; const AAddr: TDBGPtr);
procedure TAssemblerDlg.SetLocation(ADebugger: TDebugger; const AAddr: TDBGPtr; const ADispAddr: TDBGPtr = 0);
var
i: Integer;
begin
SetDebugger(ADebugger);
FCurrentLocation := AAddr;
if ADispAddr <> 0
then FCurrentLocation := ADispAddr
else FCurrentLocation := AAddr;
FLocation := AAddr;
FLastTopLineValid := False;

View File

@ -173,6 +173,9 @@ inherited CallStackDlg: TCallStackDlg
Default = True
OnClick = actShowClick
end
object popShowDisass: TMenuItem
Action = actShowDisass
end
object popToggle: TMenuItem
Action = actToggleBreakPoint
OnClick = actToggleBreakPointExecute
@ -238,6 +241,10 @@ inherited CallStackDlg: TCallStackDlg
OnExecute = actToggleBreakPointExecute
ShortCut = 116
end
object actShowDisass: TAction
Caption = 'actShowDisass'
OnExecute = actShowDisassExecute
end
end
object mnuLimit: TPopupMenu[4]
left = 136

View File

@ -47,6 +47,7 @@ type
TCallStackDlg = class(TDebuggerDlg)
aclActions: TActionList;
actCopyAll: TAction;
actShowDisass: TAction;
actToggleBreakPoint: TAction;
actViewBottom: TAction;
actViewTop: TAction;
@ -55,6 +56,7 @@ type
actViewMore: TAction;
actSetCurrent: TAction;
actShow: TAction;
popShowDisass: TMenuItem;
popToggle: TMenuItem;
ToolButtonPower: TToolButton;
ToolButton2: TToolButton;
@ -82,6 +84,7 @@ type
ToolButtonMore: TToolButton;
ToolButtonMax: TToolButton;
ToolButtonGoto: TToolButton;
procedure actShowDisassExecute(Sender: TObject);
procedure actToggleBreakPointExecute(Sender: TObject);
procedure actViewBottomExecute(Sender: TObject);
procedure actViewGotoExecute(Sender: TObject);
@ -568,6 +571,15 @@ begin
ToggleBreakpoint(lvCallStack.Selected);
end;
procedure TCallStackDlg.actShowDisassExecute(Sender: TObject);
var
Entry: TCallStackEntry;
begin
Entry := GetCurrentEntry;
if (Entry = nil) or (Entry.Address = 0) then Exit;
DebugBoss.ViewDisassembler(Entry.Address);
end;
procedure TCallStackDlg.actViewGotoExecute(Sender: TObject);
begin
try
@ -641,6 +653,7 @@ begin
actViewBottom.Caption := lisBottom;
actViewGoto.Caption := lisGotoSelectedSourceLine;
actShow.Caption := lisViewSource;
actShowDisass.Caption := lisViewSourceDisass;
actToggleBreakPoint.Caption := uemToggleBreakpoint;
actSetCurrent.Caption := lisCurrent;
actCopyAll.Caption := lisCopyAll;

View File

@ -174,6 +174,9 @@ type
procedure ViewDebugDialog(const ADialogType: TDebugDialogType;
BringToFront: Boolean = True; Show: Boolean = true;
DoDisableAutoSizing: boolean = false); virtual; abstract;
procedure ViewDisassembler(AnAddr: TDBGPtr;
BringToFront: Boolean = True; Show: Boolean = true;
DoDisableAutoSizing: boolean = false); virtual; abstract;
public
property Commands: TDBGCommands read GetCommands; // All current available commands of the debugger
property Debuggers[const AIndex: Integer]: TDebuggerClass read GetDebuggerClass;

View File

@ -228,6 +228,9 @@ type
function ShowWatchProperties(const AWatch: TCurrentWatch; AWatchExpression: String = ''): TModalresult; override;
procedure ViewDebugDialog(const ADialogType: TDebugDialogType; BringToFront: Boolean = true; Show: Boolean = true; DoDisableAutoSizing: boolean = false); override;
procedure ViewDisassembler(AnAddr: TDBGPtr;
BringToFront: Boolean = True; Show: Boolean = true;
DoDisableAutoSizing: boolean = false); override;
end;
implementation
@ -1376,6 +1379,14 @@ begin
end;
end;
procedure TDebugManager.ViewDisassembler(AnAddr: TDBGPtr; BringToFront: Boolean;
Show: Boolean; DoDisableAutoSizing: boolean);
begin
ViewDebugDialog(ddtAssembler, BringToFront, Show, DoDisableAutoSizing);
if FDialogs[ddtAssembler] <> nil
then TAssemblerDlg(FDialogs[ddtAssembler]).SetLocation(FDebugger, FCurrentLocation.Address, AnAddr);
end;
procedure TDebugManager.DestroyDebugDialog(const ADialogType: TDebugDialogType);
begin
if FDialogs[ADialogType] = nil then Exit;

View File

@ -4585,6 +4585,7 @@ resourcestring
// Call Stack Dialog
lisCurrent = 'Current';
lisViewSource = 'View Source';
lisViewSourceDisass = 'View Assembler';
lisMaxS = 'Max %d';
lisMore = 'More';
lisTop = 'Top';