Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jtag
diff options
context:
space:
mode:
authorJohn Dallaway2019-01-03 10:30:45 -0500
committerJohn Dallaway2019-01-03 12:02:06 -0500
commitcb80708cb083b1da52419a472bf8c0ff0ea9a3a2 (patch)
treed780ff1c4598cfceca7eef9fb8541f4d1c6c4df3 /jtag
parent90dd1e77f954ad30fe23b08b288c3816f56a71c1 (diff)
downloadorg.eclipse.cdt-cb80708cb083b1da52419a472bf8c0ff0ea9a3a2.tar.gz
org.eclipse.cdt-cb80708cb083b1da52419a472bf8c0ff0ea9a3a2.tar.xz
org.eclipse.cdt-cb80708cb083b1da52419a472bf8c0ff0ea9a3a2.zip
Bug 543149: Report download progress during launch
Change-Id: Icf3545f600b91bc80827cec920fc10a0668ca0f1 Signed-off-by: John Dallaway <john@dallaway.org.uk>
Diffstat (limited to 'jtag')
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF2
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java73
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Message.properties4
3 files changed, 75 insertions, 4 deletions
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF
index e3103dc2dd..8fe80d6639 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core;singleton:=true
-Bundle-Version: 9.2.1.qualifier
+Bundle-Version: 9.2.2.qualifier
Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java
index c7225ac741..fc51324893 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2018 QNX Software Systems and others.
+ * Copyright (c) 2007, 2019 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -21,6 +21,7 @@
* John Dallaway - Execute run commands before resume (Bug 525692)
* John Dallaway - Test for reset/delay/halt command not defined (Bug 361881)
* Torbjörn Svensson (STMicroelectronics) - Bug 535024
+ * John Dallaway - Report download progress (Bug 543149)
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
@@ -49,10 +50,12 @@ import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext;
+import org.eclipse.cdt.dsf.debug.service.command.IEventListener;
import org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
@@ -65,11 +68,17 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLICommand;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIOOBRecord;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIResult;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIStatusAsyncOutput;
+import org.eclipse.cdt.dsf.mi.service.command.output.MITuple;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.utils.CommandLineUtil;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
@@ -88,6 +97,51 @@ import org.eclipse.core.variables.VariablesPlugin;
*/
public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
+ private abstract class DownloadStatusListener implements IEventListener {
+
+ private static final String ASYNC_CLASS_DOWNLOAD = "download"; //$NON-NLS-1$
+ private static final String VAR_SECTION = "section"; //$NON-NLS-1$
+ private static final String VAR_SECTION_SENT = "section-sent"; //$NON-NLS-1$
+ private static final String VAR_SECTION_SIZE = "section-size"; //$NON-NLS-1$
+
+ abstract void handleStatus(String status);
+
+ @Override
+ public void eventReceived(Object output) {
+ if (output instanceof MIOutput) {
+ for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
+ if (oobr instanceof MIStatusAsyncOutput) {
+ asyncOutputReceived((MIStatusAsyncOutput) oobr);
+ }
+ }
+ }
+ }
+
+ private void asyncOutputReceived(MIStatusAsyncOutput output) {
+ if (ASYNC_CLASS_DOWNLOAD.equals(output.getAsyncClass())) {
+ Map<String, String> results = new HashMap<>();
+ for (MIResult result : output.getMIResults()) {
+ if (result.getMIValue() instanceof MITuple) {
+ for (MIResult field : ((MITuple) result.getMIValue()).getMIResults()) {
+ results.put(field.getVariable(), field.getMIValue().toString());
+ }
+ }
+ }
+ String section = results.get(VAR_SECTION);
+ if (section != null) {
+ StringBuilder status = new StringBuilder();
+ status.append(String.format(Messages.getString("GDBJtagDebugger.downloading"), section)); //$NON-NLS-1$
+ String sectionSent = results.get(VAR_SECTION_SENT);
+ String sectionSize = results.get(VAR_SECTION_SIZE);
+ if ((sectionSent != null) && (sectionSize != null)) {
+ status.append(String.format(" (%s/%s)", sectionSent, sectionSize)); //$NON-NLS-1$
+ }
+ handleStatus(status.toString());
+ }
+ }
+ }
+ }
+
/** utility method; cuts down on clutter */
private void queueCommands(List<String> commands, RequestMonitor rm) {
if (!commands.isEmpty()) {
@@ -105,6 +159,7 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
private DsfServicesTracker fTracker;
private IMIContainerDMContext fContainerCtx;
+ private IProgressMonitor fProgressMonitor;
/**
* @since 8.2
@@ -112,6 +167,7 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
public GDBJtagDSFFinalLaunchSequence(DsfSession session, Map<String, Object> attributes,
RequestMonitorWithProgress rm) {
super(session, attributes, rm);
+ fProgressMonitor = rm.getProgressMonitor();
}
public GDBJtagDSFFinalLaunchSequence(DsfExecutor executor, GdbLaunch launch, SessionType sessionType,
@@ -491,7 +547,20 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
}
List<String> commands = new ArrayList<>();
fGdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
- queueCommands(commands, rm);
+ IEventListener downloadStatusListener = new DownloadStatusListener() {
+ @Override
+ protected void handleStatus(String status) {
+ fProgressMonitor.subTask("- " + status); //$NON-NLS-1$
+ }
+ };
+ fCommandControl.addEventListener(downloadStatusListener);
+ queueCommands(commands, new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleCompleted() {
+ fCommandControl.removeEventListener(downloadStatusListener);
+ rm.done();
+ }
+ });
} else {
rm.done();
}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Message.properties b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Message.properties
index 3505872fb6..59aa95115d 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Message.properties
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Message.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 - 2017 QNX Software Systems and others.
+# Copyright (c) 2008 - 2019 QNX Software Systems and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
# Contributors:
# QNX Software Systems - initial API and implementation
# John Dallaway - Test for reset/delay/halt command not defined (Bug 361881)
+# John Dallaway - Report download progress (Bug 543149)
###############################################################################
GDBJtagDebugger.0=Starting debug session
GDBJtagDebugger.1=Error getting debug target
@@ -28,3 +29,4 @@ GDBJtagDebugger.err_no_img_file=Image loading was requested but file was not spe
GDBJtagDebugger.delay_not_defined=Delay command not defined for device '%s'
GDBJtagDebugger.halt_not_defined=Halt command not defined for device '%s'
GDBJtagDebugger.reset_not_defined=Reset command not defined for device '%s'
+GDBJtagDebugger.downloading=Downloading %s

Back to the top