Skip to content

GDB Remote launch targets load attributes when editing. #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.ui;singleton:=true
Bundle-Version: 2.8.800.qualifier
Bundle-Version: 2.8.900.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.207.200,4)",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 QNX Software Systems and others.
* Copyright (c) 2019, 2025 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -42,6 +42,7 @@ public class NewGdbRemoteSerialTargetWizard extends LaunchTargetWizard {
private Text nameText;
private Combo portCombo;
private Text baudText;
private static final String DEFAULT_BAUD_RATE = "115200"; //$NON-NLS-1$

private class SerialPage extends WizardPage {
public SerialPage() {
Expand All @@ -55,6 +56,28 @@ public void createControl(Composite parent) {
Composite control = new Composite(parent, SWT.NONE);
control.setLayout(new GridLayout());

String targetName = ""; //$NON-NLS-1$
String serialPort = ""; //$NON-NLS-1$
String[] portNames;
String baudRate = DEFAULT_BAUD_RATE;
ILaunchTarget launchTarget = getLaunchTarget();
try {
portNames = SerialPort.list();
} catch (IOException e) {
GdbUIPlugin.log(e);
portNames = new String[0];
}
if (launchTarget == null) {
if (portNames.length > 0) {
targetName = portNames[0];
serialPort = portNames[0];
}
} else {
targetName = launchTarget.getId();
serialPort = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, serialPort);
baudRate = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, baudRate);
}

// Target name

Group nameGroup = new Group(control, SWT.NONE);
Expand All @@ -77,14 +100,15 @@ public void widgetSelected(SelectionEvent e) {
nameText.setEnabled(!same);
}
});
sameAsPortname.setSelection(true);
sameAsPortname.setSelection(targetName.equals(serialPort));

Label nameLabel = new Label(nameGroup, SWT.NONE);
nameLabel.setText(LaunchUIMessages.getString("NewGDBRemoteSerialTargetWizard_TargetName")); //$NON-NLS-1$

nameText = new Text(nameGroup, SWT.BORDER);
nameText.setText(targetName);
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
nameText.setEnabled(false);
nameText.setEnabled(!targetName.equals(serialPort));
nameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
Expand All @@ -105,17 +129,11 @@ public void modifyText(ModifyEvent e) {
portCombo = new Combo(connGroup, SWT.NONE);
portCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

try {
String[] portNames = SerialPort.list();
for (String portName : portNames) {
portCombo.add(portName);
}
if (portNames.length > 0) {
portCombo.select(0);
nameText.setText(portCombo.getText());
}
} catch (IOException e) {
GdbUIPlugin.log(e);
for (String portName : portNames) {
portCombo.add(portName);
}
if (portNames.length > 0) {
portCombo.setText(serialPort);
}

portCombo.addModifyListener(new ModifyListener() {
Expand All @@ -133,7 +151,7 @@ public void modifyText(ModifyEvent e) {

baudText = new Text(connGroup, SWT.BORDER);
baudText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
baudText.setText("115200"); //$NON-NLS-1$
baudText.setText(baudRate);
baudText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 QNX Software Systems and others.
* Copyright (c) 2019, 2025 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -50,6 +50,16 @@ public void createControl(Composite parent) {
Composite control = new Composite(parent, SWT.NONE);
control.setLayout(new GridLayout());

String targetName = ""; //$NON-NLS-1$
String targetHostName = ""; //$NON-NLS-1$
String targetPort = ""; //$NON-NLS-1$
ILaunchTarget launchTarget = getLaunchTarget();
if (launchTarget != null) {
targetName = launchTarget.getId();
targetHostName = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, targetHostName);
targetPort = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, targetPort);
}

// Target name

Group nameGroup = new Group(control, SWT.NONE);
Expand All @@ -72,14 +82,15 @@ public void widgetSelected(SelectionEvent e) {
nameText.setEnabled(!same);
}
});
sameAsHostname.setSelection(true);
sameAsHostname.setSelection(targetName.equals(targetHostName));

Label nameLabel = new Label(nameGroup, SWT.NONE);
nameLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.TargetName")); //$NON-NLS-1$

nameText = new Text(nameGroup, SWT.BORDER);
nameText.setText(targetName);
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
nameText.setEnabled(false);
nameText.setEnabled(!targetName.equals(targetHostName));
nameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
Expand All @@ -98,6 +109,7 @@ public void modifyText(ModifyEvent e) {
hostLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.HostName")); //$NON-NLS-1$

hostText = new Text(connGroup, SWT.BORDER);
hostText.setText(targetHostName);
hostText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
hostText.addModifyListener(new ModifyListener() {
@Override
Expand All @@ -113,6 +125,8 @@ public void modifyText(ModifyEvent e) {
portLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.Port")); //$NON-NLS-1$

portText = new Text(connGroup, SWT.BORDER);
portText.setText(targetPort);

portText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
Expand Down
2 changes: 1 addition & 1 deletion launchbar/org.eclipse.launchbar.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.launchbar.core;singleton:=true
Bundle-Version: 3.0.100
Bundle-Version: 3.0.200
Bundle-Activator: org.eclipse.launchbar.core.internal.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.33.0,4)",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016 QNX Software Systems and others.
* Copyright (c) 2016, 2025 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -102,6 +102,7 @@ public ILaunchTarget save() {
target.attributes.remove(key);
}
}
target.attributes.put("name", target.getId()); //$NON-NLS-1$
target.attributes.flush();
return target;
} catch (BackingStoreException e) {
Expand Down
Loading