Skip to content
Open
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
64 changes: 63 additions & 1 deletion bundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,67 @@
plugin="com.espressif.idf.debug.gdbjtag.openocd">
</statusHandler>
</extension>

<extension
point="org.eclipse.debug.ui.launchConfigurationTabs">
<tab
class="com.espressif.idf.debug.gdbjtag.openocd.ui.TabMain"
group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
id="org.eclipse.cdt.cdi.launch.mainTab"
name="Main">
</tab>
<tab
class="com.espressif.idf.debug.gdbjtag.openocd.ui.TabDebugger"
group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
id="com.espressif.idf.debug.gdbjtag.openocd.ui.debuggertab"
name="Debugger">
<placement
after="org.eclipse.cdt.cdi.launch.mainTab">
</placement>
</tab>
<tab
class="com.espressif.idf.debug.gdbjtag.openocd.ui.TabStartup"
group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
id="com.espressif.idf.debug.gdbjtag.openocd.ui.startuptab"
name="Startup">
<placement
after="com.espressif.idf.debug.gdbjtag.openocd.ui.debuggertab">
</placement>
</tab>
<tab
class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab"
group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
id="org.eclipse.debug.ui.sourceLookupTab"
name="SourceLookupTab">
<placement
after="com.espressif.idf.debug.gdbjtag.openocd.ui.startuptab">
</placement>
</tab>
<tab
class="org.eclipse.debug.ui.CommonTab"
group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
id="org.eclipse.debug.ui.commonTab"
name="CommonTab">
<placement
after="org.eclipse.debug.ui.sourceLookupTab">
</placement>
</tab>
<tab
class="com.espressif.idf.debug.gdbjtag.openocd.ui.TabSvdTarget"
group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
id="org.eclipse.embedcdt.debug.gdbjtag.ui.svdtab"
name="TabSvdTarget">
<placement
after="org.eclipse.debug.ui.commonTab">
</placement>
</tab>
<tab
class="com.espressif.idf.debug.gdbjtag.openocd.ui.TabDebugger"
group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
id="com.espressif.idf.debug.gdbjtag.openocd.ui.debuggertab"
name="Debugger">
<placement
after="org.eclipse.cdt.cdi.launch.mainTab">
</placement>
</tab>
Comment on lines +231 to +239
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="bundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xml"

python - <<'PY'
import xml.etree.ElementTree as ET
from collections import Counter

file = "bundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xml"
root = ET.parse(file).getroot()

tab_ids = []
for ext in root.findall("extension"):
    if ext.attrib.get("point") == "org.eclipse.debug.ui.launchConfigurationTabs":
        for tab in ext.findall("tab"):
            tab_ids.append(tab.attrib.get("id"))

dups = {k: v for k, v in Counter(tab_ids).items() if k and v > 1}
print("Duplicate tab ids:", dups)
PY

rg -n 'com\.espressif\.idf\.debug\.gdbjtag\.openocd\.ui\.debuggertab|class="com\.espressif\.idf\.debug\.gdbjtag\.openocd\.ui\.TabDebugger"' "$FILE"

Repository: espressif/idf-eclipse-plugin

Length of output: 535


Remove duplicated TabDebugger tab contribution.

TabDebugger is declared twice with the same id (com.espressif.idf.debug.gdbjtag.openocd.ui.debuggertab) at lines 187–189 and lines 232–234. This duplicate registry entry can produce duplicate or misordered tabs at runtime.

🛠️ Proposed fix
-    <tab
-          class="com.espressif.idf.debug.gdbjtag.openocd.ui.TabDebugger"
-          group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
-          id="com.espressif.idf.debug.gdbjtag.openocd.ui.debuggertab"
-          name="Debugger">
-       <placement
-             after="org.eclipse.cdt.cdi.launch.mainTab">
-       </placement>
-    </tab>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<tab
class="com.espressif.idf.debug.gdbjtag.openocd.ui.TabDebugger"
group="com.espressif.idf.debug.gdbjtag.openocd.launchConfigurationTabGroup"
id="com.espressif.idf.debug.gdbjtag.openocd.ui.debuggertab"
name="Debugger">
<placement
after="org.eclipse.cdt.cdi.launch.mainTab">
</placement>
</tab>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xml` around lines 231
- 239, There is a duplicate launch-tab contribution for TabDebugger (class
"com.espressif.idf.debug.gdbjtag.openocd.ui.TabDebugger" with id
"com.espressif.idf.debug.gdbjtag.openocd.ui.debuggertab") which causes
duplicate/misordered tabs at runtime; remove the redundant <tab> element so the
plugin.xml contains only a single declaration of TabDebugger (keep the correct
one and delete the other duplicate), ensuring the remaining entry preserves its
group and placement attributes.

</extension>
</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public class TabDebugger extends AbstractLaunchConfigurationTab

// ------------------------------------------------------------------------

protected TabDebugger(TabStartup tabStartup)
public TabDebugger()
{
super();
fDefaultPreferences = Activator.getInstance().getDefaultPreferences();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;

import com.espressif.idf.core.logging.Logger;
import com.espressif.idf.core.util.IDFUtil;
Expand All @@ -33,24 +30,7 @@ public class TabGroupLaunchConfiguration extends AbstractLaunchConfigurationTabG
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode)
{

// Normally the tabs should be defined in the plugin.xml, and
// here just return an empty array:
// setTabs(new ILaunchConfigurationTab[0]);
// But the first attempt to make this work failed, it seems
// there is something missing in the definitions and
// the tab extensions are filtered out.

// To avoid these problems and for a better control,
// we manually define the tabs here.

TabStartup tabStartup = new TabStartup();

ILaunchConfigurationTab tabs[] = new ILaunchConfigurationTab[] { new TabMain(), new TabDebugger(tabStartup),
tabStartup, new SourceLookupTab(), new CommonTab(), new TabSvdTarget() };

setTabs(tabs);

setTabs();
}

@Override
Expand Down
41 changes: 36 additions & 5 deletions bundles/com.espressif.idf.launch.serial.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
</extension>
<extension
point="org.eclipse.launchbar.ui.launchBarUIContributions">
<buildTabGroup
launchConfigType="com.espressif.idf.launch.serial.launchConfigurationType"
launchDescriptorType="com.espressif.idf.launch.serial.core.idf.descriptorType"
tabGroup="org.eclipse.cdt.launch.internal.corebuild.CoreBuildTabGroup">
</buildTabGroup>
<descriptorUI
descriptorTypeId="com.espressif.idf.launch.serial.core.idf.descriptorType"
labelProvider="com.espressif.idf.launch.serial.ui.IDFLaunchDescriptorLabelProvider">
Expand Down Expand Up @@ -65,5 +60,41 @@
resolver="com.espressif.idf.launch.serial.ui.BuildFolderVariableResolver">
</variable>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTabs">
<tab
class="org.eclipse.cdt.launch.ui.corebuild.CoreBuildTab"
group="com.espressif.idf.launch.serial.ui.launchConfigurationTabGroup"
id="org.eclipse.cdt.cdi.launch.buildSettingsTab"
name="Core Build Tab">
</tab>
<tab
class="com.espressif.idf.launch.serial.ui.internal.CMakeMainTab2"
group="com.espressif.idf.launch.serial.ui.launchConfigurationTabGroup"
id="com.espressif.idf.launch.serial.ui.mainTab"
name="Main Tab">
<placement
after="org.eclipse.cdt.cdi.launch.buildSettingsTab">
</placement>
</tab>
<tab
class="org.eclipse.debug.ui.EnvironmentTab"
group="com.espressif.idf.launch.serial.ui.launchConfigurationTabGroup"
id="org.eclipse.debug.ui.environmentTab"
name="Environment Tab">
<placement
after="com.espressif.idf.launch.serial.ui.mainTab">
</placement>
</tab>
<tab
class="org.eclipse.debug.ui.CommonTab"
group="com.espressif.idf.launch.serial.ui.launchConfigurationTabGroup"
id="org.eclipse.debug.ui.commonTab"
name="Common Tab">
<placement
after="org.eclipse.debug.ui.environmentTab">
</placement>
</tab>
</extension>

</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,24 @@
*******************************************************************************/
package com.espressif.idf.launch.serial.ui.internal;

import org.eclipse.cdt.launch.ui.corebuild.CoreBuildTab;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.EnvironmentTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.launchbar.ui.internal.LaunchBarLaunchConfigDialog;

import com.espressif.idf.core.logging.Logger;
import com.espressif.idf.core.util.IDFUtil;

@SuppressWarnings("restriction")
public class SerialFlashLaunchConfigTabGroup extends AbstractLaunchConfigurationTabGroup
{

@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode)
{
if (dialog instanceof LaunchBarLaunchConfigDialog)
{
setTabs(new ILaunchConfigurationTab[] { new CMakeMainTab2(), new EnvironmentTab(), new CommonTab() });
}
else
{
setTabs(new ILaunchConfigurationTab[] { new CoreBuildTab(), new CMakeMainTab2(), new EnvironmentTab(),
new CommonTab() });
}

setTabs();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ private static void whenSelectJTAGflashInLaunchConfig() throws Exception
{
LaunchBarConfigSelector configSelector = new LaunchBarConfigSelector(bot);
configSelector.clickEdit();

TestWidgetWaitUtility.waitForDialogToAppear(bot, "Edit Configuration", 20000);
bot.cTabItem("Main").show();
bot.cTabItem("Main").setFocus();

bot.cTabItem("Main").activate();

bot.comboBoxWithLabel("Flash over:").setSelection("JTAG");
bot.button("OK").click();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,17 @@ private static void whenTurnOffOpenSerialMonitorAfterFlashingInLaunchConfig() th
{
LaunchBarConfigSelector configSelector = new LaunchBarConfigSelector(bot);
configSelector.clickEdit();

TestWidgetWaitUtility.waitForDialogToAppear(bot, "Edit Configuration", 20000);
bot.cTabItem("Main").show();
bot.cTabItem("Main").setFocus();

bot.cTabItem("Main").activate();

SWTBotCheckBox checkBox = bot.checkBox("Open Serial Monitor After Flashing");
if (checkBox.isChecked())
{
checkBox.click();
}

bot.button("OK").click();
}

Expand Down
Loading