check if debugger path name is an executable to prevent problems like bug #8454

git-svn-id: trunk@10719 -
This commit is contained in:
vincents 2007-03-07 22:45:15 +00:00
parent 7847b25113
commit 7b0a38e5ed
5 changed files with 63 additions and 35 deletions

View File

@ -992,6 +992,7 @@ type
public
class function Caption: String; virtual; // The name of the debugger as shown in the debuggeroptions
class function ExePaths: String; virtual; // The default locations of the exe
class function HasExePath: boolean; virtual; // If the debugger needs to have an exe path
// debugger properties
class function CreateProperties: TDebuggerProperties; virtual; // Creates debuggerproperties
@ -1372,6 +1373,11 @@ begin
Result := '';
end;
class function TDebugger.HasExePath: boolean;
begin
Result := true; // most debugger are external and have an exe path
end;
function TDebugger.GetCommands: TDBGCommands;
begin
Result := COMMANDMAP[State] * GetSupportedCommands;

View File

@ -57,6 +57,7 @@ type
function RequestCommand(const ACommand: TDBGCommand; const AParams: array of const): Boolean; override;
public
class function Caption: String; override;
class function HasExePath: boolean; override;
published
end;
@ -167,6 +168,11 @@ begin
{$ENDIF}
end;
class function TProcessDebugger.HasExePath: boolean;
begin
Result:= false; // no need to have a valid exe path for the process debugger
end;
initialization
RegisterDebugger(TProcessDebugger);

View File

@ -339,9 +339,9 @@ object DebuggerOptionsForm: TDebuggerOptionsForm
Caption = 'Page4'
object gbSignals: TGroupBox
Left = 6
Height = 354
Height = 362
Top = 6
Width = 454
Width = 450
Align = alClient
BorderSpacing.Around = 6
Caption = 'Signals'
@ -352,9 +352,9 @@ object DebuggerOptionsForm: TDebuggerOptionsForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = gbSignals
AnchorSideBottom.Side = asrBottom
Left = 369
Left = 365
Height = 25
Top = 302
Top = 313
Width = 75
Anchors = [akRight, akBottom]
AutoSize = True
@ -370,9 +370,9 @@ object DebuggerOptionsForm: TDebuggerOptionsForm
AnchorSideRight.Control = cmdSignalRemove
AnchorSideBottom.Control = gbSignals
AnchorSideBottom.Side = asrBottom
Left = 288
Left = 284
Height = 25
Top = 302
Top = 313
Width = 75
Anchors = [akRight, akBottom]
AutoSize = True
@ -386,9 +386,9 @@ object DebuggerOptionsForm: TDebuggerOptionsForm
object lvSignals: TListView
AnchorSideBottom.Control = cmdSignalAdd
Left = 6
Height = 290
Height = 301
Top = 6
Width = 438
Width = 434
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
@ -419,7 +419,7 @@ object DebuggerOptionsForm: TDebuggerOptionsForm
AnchorSideRight.Control = cmdCancel
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 308
Left = 311
Height = 25
Top = 412
Width = 75
@ -429,8 +429,8 @@ object DebuggerOptionsForm: TDebuggerOptionsForm
Caption = '&OK'
Constraints.MaxHeight = 25
Constraints.MinWidth = 75
Default = True
Kind = bkOK
ModalResult = 1
NumGlyphs = 0
OnClick = cmdOKCLICK
TabOrder = 1
@ -440,10 +440,10 @@ object DebuggerOptionsForm: TDebuggerOptionsForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 389
Left = 392
Height = 25
Top = 412
Width = 87
Width = 84
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Around = 6

View File

@ -100,47 +100,47 @@ LazarusResources.Add('TDebuggerOptionsForm','FORMDATA',[
+'Width'#3#198#1#5'Align'#7#8'alBottom'#11'AllowGrayed'#9#7'Anchors'#11#6'akL'
+'eft'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#27'Break on La'
+'zarus Exceptions'#8'TabOrder'#2#1#0#0#0#5'TPage'#9'pgSignals'#7'Caption'#6#5
+'Page4'#0#9'TGroupBox'#9'gbSignals'#4'Left'#2#6#6'Height'#3'b'#1#3'Top'#2#6#5
+'Width'#3#198#1#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#7'Captio'
+'Page4'#0#9'TGroupBox'#9'gbSignals'#4'Left'#2#6#6'Height'#3'j'#1#3'Top'#2#6#5
+'Width'#3#194#1#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#7'Captio'
+'n'#6#7'Signals'#11'ParentCtl3D'#8#8'TabOrder'#2#0#0#7'TButton'#15'cmdSignal'
+'Remove'#23'AnchorSideRight.Control'#7#9'gbSignals'#20'AnchorSideRight.Side'
+#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#9'gbSignals'#21'AnchorSideBot'
+'tom.Side'#7#9'asrBottom'#4'Left'#3'q'#1#6'Height'#2#25#3'Top'#3'.'#1#5'Widt'
+'tom.Side'#7#9'asrBottom'#4'Left'#3'm'#1#6'Height'#2#25#3'Top'#3'9'#1#5'Widt'
+'h'#2'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpaci'
+'ng.Around'#2#6#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#6'Remove'#21
+'Constraints.MaxHeight'#2#25#20'Constraints.MinWidth'#2'K'#7'Enabled'#8#8'Ta'
+'bOrder'#2#0#0#0#7'TButton'#12'cmdSignalAdd'#23'AnchorSideRight.Control'#7#15
+'cmdSignalRemove'#24'AnchorSideBottom.Control'#7#9'gbSignals'#21'AnchorSideB'
+'ottom.Side'#7#9'asrBottom'#4'Left'#3' '#1#6'Height'#2#25#3'Top'#3'.'#1#5'Wi'
+'ottom.Side'#7#9'asrBottom'#4'Left'#3#28#1#6'Height'#2#25#3'Top'#3'9'#1#5'Wi'
+'dth'#2'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpa'
+'cing.Around'#2#6#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#3'Add'#21'C'
+'onstraints.MaxHeight'#2#25#20'Constraints.MinWidth'#2'K'#8'TabOrder'#2#1#0#0
+#9'TListView'#9'lvSignals'#24'AnchorSideBottom.Control'#7#12'cmdSignalAdd'#4
+'Left'#2#6#6'Height'#3'"'#1#3'Top'#2#6#5'Width'#3#182#1#5'Align'#7#5'alTop'#7
+'Left'#2#6#6'Height'#3'-'#1#3'Top'#2#6#5'Width'#3#178#1#5'Align'#7#5'alTop'#7
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Ar'
+'ound'#2#6#7'Columns'#14#1#7'Caption'#6#4'Name'#5'Width'#3#200#0#0#1#7'Capti'
+'on'#6#2'ID'#0#1#7'Caption'#6#10'Handled by'#5'Width'#2'K'#0#1#7'Caption'#6#6
+'Resume'#5'Width'#2#5#0#0#9'PopupMenu'#7#9'popSignal'#8'TabOrder'#2#2#9'View'
+'Style'#7#8'vsReport'#0#0#0#0#0#7'TBitBtn'#5'cmdOK'#23'AnchorSideRight.Contr'
+'ol'#7#9'cmdCancel'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBot'
+'tom.Side'#7#9'asrBottom'#4'Left'#3'4'#1#6'Height'#2#25#3'Top'#3#156#1#5'Wid'
+'tom.Side'#7#9'asrBottom'#4'Left'#3'7'#1#6'Height'#2#25#3'Top'#3#156#1#5'Wid'
+'th'#2'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpac'
+'ing.Around'#2#6#7'Caption'#6#3'&OK'#21'Constraints.MaxHeight'#2#25#20'Const'
+'raints.MinWidth'#2'K'#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0
+#7'OnClick'#7#10'cmdOKCLICK'#8'TabOrder'#2#1#0#0#7'TBitBtn'#9'cmdCancel'#23
+'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'
,#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBo'
+'ttom'#4'Left'#3#133#1#6'Height'#2#25#3'Top'#3#156#1#5'Width'#2'W'#7'Anchors'
+#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#6'Ca'
+'ncel'#9#7'Caption'#6#6'Cancel'#21'Constraints.MaxHeight'#2#25#20'Constraint'
+'s.MinWidth'#2'K'#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2#9'NumGlyphs'#2#0
+#8'TabOrder'#2#2#0#0#10'TPopupMenu'#9'popSignal'#4'left'#2#8#3'top'#3#192#1#0
+#9'TMenuItem'#19'mnuHandledByProgram'#9'AutoCheck'#9#7'Caption'#6#18'Handled'
+' by Program'#10'GroupIndex'#2#1#9'RadioItem'#9#0#0#9'TMenuItem'#21'mnuiHand'
+'ledByDebugger'#9'AutoCheck'#9#7'Caption'#6#19'Handled by Debugger'#10'Group'
+'Index'#2#1#9'RadioItem'#9#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TM'
+'enuItem'#16'mnuResumeHandled'#9'AutoCheck'#9#7'Caption'#6#14'Resume Handled'
+#10'GroupIndex'#2#2#9'RadioItem'#9#0#0#9'TMenuItem'#18'mnuResumeUnhandled'#9
+'AutoCheck'#9#7'Caption'#6#16'Resume Unhandled'#10'GroupIndex'#2#2#9'RadioIt'
+'em'#9#0#0#0#0
+'raints.MinWidth'#2'K'#7'Default'#9#4'Kind'#7#4'bkOK'#9'NumGlyphs'#2#0#7'OnC'
+'lick'#7#10'cmdOKCLICK'#8'TabOrder'#2#1#0#0#7'TBitBtn'#9'cmdCancel'#23'Ancho'
+'rSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'A'
,'nchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'
+#4'Left'#3#136#1#6'Height'#2#25#3'Top'#3#156#1#5'Width'#2'T'#7'Anchors'#11#7
+'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#6'Cancel'
+#9#7'Caption'#6#6'Cancel'#21'Constraints.MaxHeight'#2#25#20'Constraints.MinW'
+'idth'#2'K'#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2#9'NumGlyphs'#2#0#8'Tab'
+'Order'#2#2#0#0#10'TPopupMenu'#9'popSignal'#4'left'#2#8#3'top'#3#192#1#0#9'T'
+'MenuItem'#19'mnuHandledByProgram'#9'AutoCheck'#9#7'Caption'#6#18'Handled by'
+' Program'#10'GroupIndex'#2#1#9'RadioItem'#9#0#0#9'TMenuItem'#21'mnuiHandled'
+'ByDebugger'#9'AutoCheck'#9#7'Caption'#6#19'Handled by Debugger'#10'GroupInd'
+'ex'#2#1#9'RadioItem'#9#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TMenu'
+'Item'#16'mnuResumeHandled'#9'AutoCheck'#9#7'Caption'#6#14'Resume Handled'#10
+'GroupIndex'#2#2#9'RadioItem'#9#0#0#9'TMenuItem'#18'mnuResumeUnhandled'#9'Au'
+'toCheck'#9#7'Caption'#6#16'Resume Unhandled'#10'GroupIndex'#2#2#9'RadioItem'
+#9#0#0#0#0
]);

View File

@ -103,6 +103,7 @@ type
FCurDebuggerClass: TDebuggerClass; // currently shown debugger class
procedure AddExceptionLine(const AException: TIDEException; AName: String);
procedure AddSignalLine(const ASignal: TIDESignal);
function CheckValues: boolean;
procedure FetchDebuggerClass;
procedure FetchDebuggerGeneralOptions;
procedure FetchDebuggerSpecificOptions;
@ -147,6 +148,19 @@ begin
Item.Data := ASignal;
end;
function TDebuggerOptionsForm.CheckValues: boolean;
begin
Result := false;
if assigned(FCurDebuggerClass) and FCurDebuggerClass.HasExePath and
not CheckExecutable(FOldDebuggerPathAndParams,cmbDebuggerPath.Text,
lisEnvOptDlgInvalidDebuggerFilename,
lisEnvOptDlgInvalidDebuggerFilenameMsg)
then exit;
Result := true;
end;
procedure TDebuggerOptionsForm.FetchDebuggerClass;
var
n: PtrInt;
@ -290,6 +304,8 @@ var
n: Integer;
ie: TIDEException;
begin
if not CheckValues then exit;
for n := 0 to FExceptionDeleteList.Count - 1 do
FExceptionDeleteList.Objects[n].Free;