@@ -114,8 +114,8 @@ public class TabDebugger extends AbstractLaunchConfigurationTab {
114
114
protected TabDebugger (TabStartup tabStartup ) {
115
115
super ();
116
116
117
- fSavedCmsisDeviceName = "" ;
118
- fSavedCmsisBoardName = "" ;
117
+ fSavedCmsisDeviceName = null ;
118
+ fSavedCmsisBoardName = null ;
119
119
}
120
120
121
121
@ Override
@@ -795,35 +795,29 @@ public void initializeFrom(ILaunchConfiguration configuration) {
795
795
ConfigurationAttributes .GDB_SERVER_EXECUTABLE ,
796
796
stringDefault ));
797
797
798
- // If the project has assigned a board name, use it
799
- stringDefault = CProjectAttributes
798
+ String boardName = CProjectAttributes
800
799
.getCmsisBoardName (configuration );
801
- fSavedCmsisBoardName = stringDefault ;
800
+ fSavedCmsisBoardName = boardName ;
801
+ String deviceName = CProjectAttributes
802
+ .getCmsisDeviceName (configuration );
803
+ fSavedCmsisDeviceName = deviceName ;
804
+
805
+ // If the project has assigned either a board name,
806
+ // or a device name, use them.
807
+ if (((boardName == null || boardName .isEmpty ()) && (deviceName == null || deviceName
808
+ .isEmpty ()))) {
802
809
803
- // Board name
804
- if (stringDefault == null || stringDefault .isEmpty ()) {
805
- // Otherwise try the name used previously
806
- stringDefault = PersistentPreferences .getQemuBoardName ();
810
+ // Otherwise try the names used previously
811
+ boardName = PersistentPreferences .getQemuBoardName ();
812
+ deviceName = PersistentPreferences .getQemuDeviceName ();
807
813
}
808
814
809
815
fQemuBoardName .setText (configuration .getAttribute (
810
816
ConfigurationAttributes .GDB_SERVER_BOARD_NAME ,
811
- stringDefault ));
812
-
813
- // If the project has assigned a device name, use it
814
- stringDefault = CProjectAttributes
815
- .getCmsisDeviceName (configuration );
816
- fSavedCmsisDeviceName = stringDefault ;
817
-
818
- // Device name
819
- if (stringDefault == null || stringDefault .isEmpty ()) {
820
- // Otherwise try the name used previously
821
- stringDefault = PersistentPreferences .getQemuDeviceName ();
822
- }
823
-
817
+ boardName == null ? "" : boardName ));
824
818
fQemuDeviceName .setText (configuration .getAttribute (
825
819
ConfigurationAttributes .GDB_SERVER_DEVICE_NAME ,
826
- stringDefault ));
820
+ deviceName == null ? "" : deviceName ));
827
821
828
822
// Ports
829
823
fGdbServerGdbPort
@@ -950,15 +944,22 @@ public void initializeFromDefaults() {
950
944
stringDefault = DefaultPreferences .getGdbServerExecutable ();
951
945
fGdbServerExecutable .setText (stringDefault );
952
946
953
- // Board name
954
- stringDefault = fSavedCmsisBoardName != null ? fSavedCmsisBoardName
955
- : DefaultPreferences .QEMU_BOARD_NAME_DEFAULT ;
956
- fQemuBoardName .setText (stringDefault );
947
+ String boardName ;
948
+ String deviceName ;
949
+ if (fSavedCmsisBoardName != null || fSavedCmsisDeviceName != null ) {
950
+ // If the project has assigned either a board name,
951
+ // or a device name, use them.
952
+ boardName = fSavedCmsisBoardName != null ? fSavedCmsisBoardName
953
+ : "" ;
954
+ deviceName = fSavedCmsisDeviceName != null ? fSavedCmsisDeviceName
955
+ : "" ;
956
+ } else {
957
+ boardName = DefaultPreferences .QEMU_BOARD_NAME_DEFAULT ;
958
+ deviceName = DefaultPreferences .QEMU_DEVICE_NAME_DEFAULT ;
959
+ }
957
960
958
- // Device name
959
- stringDefault = fSavedCmsisDeviceName != null ? fSavedCmsisDeviceName
960
- : DefaultPreferences .QEMU_DEVICE_NAME_DEFAULT ;
961
- fQemuDeviceName .setText (stringDefault );
961
+ fQemuBoardName .setText (boardName );
962
+ fQemuDeviceName .setText (deviceName );
962
963
963
964
// Ports
964
965
fGdbServerGdbPort
@@ -1267,9 +1268,11 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
1267
1268
}
1268
1269
1269
1270
configuration .setAttribute (
1270
- ConfigurationAttributes .GDB_SERVER_BOARD_NAME , boardName );
1271
+ ConfigurationAttributes .GDB_SERVER_BOARD_NAME ,
1272
+ boardName == null ? "" : boardName );
1271
1273
configuration .setAttribute (
1272
- ConfigurationAttributes .GDB_SERVER_DEVICE_NAME , deviceName );
1274
+ ConfigurationAttributes .GDB_SERVER_DEVICE_NAME ,
1275
+ deviceName == null ? "" : deviceName );
1273
1276
1274
1277
defaultString = PersistentPreferences .getGdbServerOtherOptions ();
1275
1278
configuration .setAttribute (
0 commit comments