Skip to content

Commit 798dcae

Browse files
committed
qemu: more cmsis both board & device
- previous patch did not fix all inits
1 parent b20bb1a commit 798dcae

File tree

1 file changed

+36
-33
lines changed
  • ilg.gnuarmeclipse.debug.gdbjtag.qemu/src/ilg/gnuarmeclipse/debug/gdbjtag/qemu/ui

1 file changed

+36
-33
lines changed

ilg.gnuarmeclipse.debug.gdbjtag.qemu/src/ilg/gnuarmeclipse/debug/gdbjtag/qemu/ui/TabDebugger.java

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public class TabDebugger extends AbstractLaunchConfigurationTab {
114114
protected TabDebugger(TabStartup tabStartup) {
115115
super();
116116

117-
fSavedCmsisDeviceName = "";
118-
fSavedCmsisBoardName = "";
117+
fSavedCmsisDeviceName = null;
118+
fSavedCmsisBoardName = null;
119119
}
120120

121121
@Override
@@ -795,35 +795,29 @@ public void initializeFrom(ILaunchConfiguration configuration) {
795795
ConfigurationAttributes.GDB_SERVER_EXECUTABLE,
796796
stringDefault));
797797

798-
// If the project has assigned a board name, use it
799-
stringDefault = CProjectAttributes
798+
String boardName = CProjectAttributes
800799
.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()))) {
802809

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();
807813
}
808814

809815
fQemuBoardName.setText(configuration.getAttribute(
810816
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));
824818
fQemuDeviceName.setText(configuration.getAttribute(
825819
ConfigurationAttributes.GDB_SERVER_DEVICE_NAME,
826-
stringDefault));
820+
deviceName == null ? "" : deviceName));
827821

828822
// Ports
829823
fGdbServerGdbPort
@@ -950,15 +944,22 @@ public void initializeFromDefaults() {
950944
stringDefault = DefaultPreferences.getGdbServerExecutable();
951945
fGdbServerExecutable.setText(stringDefault);
952946

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+
}
957960

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);
962963

963964
// Ports
964965
fGdbServerGdbPort
@@ -1267,9 +1268,11 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
12671268
}
12681269

12691270
configuration.setAttribute(
1270-
ConfigurationAttributes.GDB_SERVER_BOARD_NAME, boardName);
1271+
ConfigurationAttributes.GDB_SERVER_BOARD_NAME,
1272+
boardName == null ? "" : boardName);
12711273
configuration.setAttribute(
1272-
ConfigurationAttributes.GDB_SERVER_DEVICE_NAME, deviceName);
1274+
ConfigurationAttributes.GDB_SERVER_DEVICE_NAME,
1275+
deviceName == null ? "" : deviceName);
12731276

12741277
defaultString = PersistentPreferences.getGdbServerOtherOptions();
12751278
configuration.setAttribute(

0 commit comments

Comments
 (0)