Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2020-04-01 22:56:24 +0000
committerEugene Tarassov2020-04-01 22:56:24 +0000
commita89f65cd164286a116c23c9e179ca000bb921dc4 (patch)
tree7e037237145b42f00575881ec71e29536899ce9f
parent724eaa06cde5fa610deb3cd2f7efbd885d4570a6 (diff)
downloadorg.eclipse.tcf-a89f65cd164286a116c23c9e179ca000bb921dc4.tar.gz
org.eclipse.tcf-a89f65cd164286a116c23c9e179ca000bb921dc4.tar.xz
org.eclipse.tcf-a89f65cd164286a116c23c9e179ca000bb921dc4.zip
TCF Debugger: improved Symbol File dialog
Don't show "The symbol file not found on the local host" if connected to remote agent
-rw-r--r--plugins/org.eclipse.tcf.core/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractChannel.java21
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java20
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/IChannel.java8
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java71
6 files changed, 89 insertions, 35 deletions
diff --git a/plugins/org.eclipse.tcf.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.core/META-INF/MANIFEST.MF
index 4126e46d1..a80ba488e 100644
--- a/plugins/org.eclipse.tcf.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.tcf.core/META-INF/MANIFEST.MF
@@ -15,7 +15,7 @@ Import-Package: org.osgi.framework,
Export-Package: org.eclipse.tcf.core;version="1.7.0",
org.eclipse.tcf.internal;x-internal:=true,
org.eclipse.tcf.internal.core;x-internal:=true,
- org.eclipse.tcf.internal.services.local;x-internal:=true,
+ org.eclipse.tcf.internal.services.local;x-friends:="org.eclipse.tcf.debug.ui",
org.eclipse.tcf.internal.services.remote;x-internal:=true,
org.eclipse.tcf.protocol;version="1.7.0",
org.eclipse.tcf.services;version="1.7.0",
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractChannel.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractChannel.java
index 8dd9f5760..1a6b6ea14 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractChannel.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractChannel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2018 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007-2020 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import org.eclipse.tcf.internal.core.ServiceManager;
@@ -154,9 +155,7 @@ public abstract class AbstractChannel implements IChannel {
private final Collection<IChannelListener> channel_listeners = new ArrayList<IChannelListener>();
private final Map<String,IChannel.IEventListener[]> event_listeners = new HashMap<String,IChannel.IEventListener[]>();
private final Map<String,IChannel.ICommandServer> command_servers = new HashMap<String,IChannel.ICommandServer>();
- /**
- * Tokens used for output
- */
+ private final LinkedList<IPeer> remote_peer_list = new LinkedList<IPeer>();
private final Map<String,Message> out_tokens = new LinkedHashMap<String,Message>();
private final Thread inp_thread;
private final Thread out_thread;
@@ -199,6 +198,7 @@ public abstract class AbstractChannel implements IChannel {
assert Protocol.isDispatchThread();
this.remote_peer = remote_peer;
this.local_peer = local_peer;
+ remote_peer_list.add(remote_peer);
/**
* Thread used handles messages received through the channel
@@ -608,9 +608,11 @@ public abstract class AbstractChannel implements IChannel {
public void peerAdded(IPeer peer) {
if (peer.getID().equals(peer_id)) {
found[0] = true;
- state = STATE_OPEN;
l.removeListener(this);
- redirect(peer_id);
+ if (state == STATE_OPENING) {
+ state = STATE_OPEN;
+ redirect(peer_id);
+ }
}
}
public void peerChanged(IPeer peer) {
@@ -631,6 +633,7 @@ public abstract class AbstractChannel implements IChannel {
if (state != STATE_OPENING) return;
if (x != null) terminate(x);
remote_peer = peer;
+ remote_peer_list.add(remote_peer);
remote_service_by_class.clear();
remote_service_by_name.clear();
event_listeners.clear();
@@ -653,6 +656,7 @@ public abstract class AbstractChannel implements IChannel {
return c;
}
};
+ remote_peer_list.add(remote_peer);
remote_service_by_class.clear();
remote_service_by_name.clear();
event_listeners.clear();
@@ -892,6 +896,11 @@ public abstract class AbstractChannel implements IChannel {
return remote_peer;
}
+ public List<IPeer> getRemotePeerList() {
+ assert Protocol.isDispatchThread();
+ return remote_peer_list;
+ }
+
public Collection<String> getLocalServices() {
assert Protocol.isDispatchThread();
assert state != STATE_OPENING;
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
index b3c43add6..065d967f7 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007-2020 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -97,6 +97,7 @@ public class LocatorService implements ILocator {
final int prefix_length;
final InetAddress address;
final InetAddress broadcast;
+ final String host_name;
long last_slaves_req_time;
boolean send_all_ok;
@@ -105,6 +106,7 @@ public class LocatorService implements ILocator {
this.prefix_length = prefix_length;
this.address = address;
this.broadcast = broadcast;
+ host_name = address.getHostName();
}
/**
@@ -514,6 +516,19 @@ public class LocatorService implements ILocator {
return local_peer;
}
+ public static boolean isLocalHostPeer(IPeer peer) {
+ assert Protocol.isDispatchThread();
+ String host = peer.getAttributes().get(IPeer.ATTR_IP_HOST);
+ if (host != null && host.length() > 0 && locator != null) {
+ InetAddress addr = locator.getInetAddress(host);
+ for (SubNet subnet : locator.subnets) {
+ if (host.equals(subnet.host_name)) return true;
+ if (addr != null && addr.equals(subnet.address)) return true;
+ }
+ }
+ return false;
+ }
+
/**
* Get the Locator Event listeners
* @return array of locator listeners
@@ -765,7 +780,8 @@ public class LocatorService implements ILocator {
HashSet<SubNet> set = new HashSet<SubNet>();
try {
String osname = System.getProperty("os.name", "");
- if (osname.startsWith("Windows")) {
+ String java_version = System.getProperty("java.version", "");
+ if (osname.startsWith("Windows") && (java_version.startsWith("1.6.") || java_version.startsWith("1.7."))) {
/*
* Workaround for JVM bug:
* InterfaceAddress.getNetworkPrefixLength() does not conform to Javadoc
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/IChannel.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/IChannel.java
index 241874527..07812ac84 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/IChannel.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/IChannel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007-2020 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.tcf.protocol;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
/**
@@ -234,6 +235,11 @@ public interface IChannel {
IPeer getRemotePeer();
/**
+ * @return list of remote IPeer objects, which includes intermediate peers used to redirect the channel
+ */
+ List<IPeer> getRemotePeerList();
+
+ /**
* @return collection of services available on local peer.
*/
Collection<String> getLocalServices();
diff --git a/plugins/org.eclipse.tcf.debug.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.debug.ui/META-INF/MANIFEST.MF
index acc2559a3..4fb8b73d0 100644
--- a/plugins/org.eclipse.tcf.debug.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.tcf.debug.ui/META-INF/MANIFEST.MF
@@ -24,6 +24,7 @@ Require-Bundle: com.jcraft.jsch;bundle-version="0.1.46",
org.eclipse.ui.workbench.texteditor;bundle-version="3.8.0",
org.eclipse.tcf.debug;bundle-version="1.7.0"
Import-Package: org.eclipse.tcf.core;version="1.7.0",
+ org.eclipse.tcf.internal.services.local,
org.eclipse.tcf.protocol;version="1.7.0",
org.eclipse.tcf.services;version="1.7.0",
org.eclipse.tcf.ssl;version="1.7.0",
@@ -43,3 +44,4 @@ Export-Package: org.eclipse.tcf.debug.ui,
org.eclipse.tcf.internal.debug.ui.preferences;x-internal:=true,
org.eclipse.tcf.internal.debug.ui.properties;x-internal:=true,
org.eclipse.tcf.internal.debug.ui.trace;x-internal:=true
+Automatic-Module-Name: org.eclipse.tcf.debug.ui
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java
index 2db816a94..4bc0077ab 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/MemoryMapWidget.java
@@ -79,7 +79,9 @@ import org.eclipse.tcf.internal.debug.ui.model.TCFModel;
import org.eclipse.tcf.internal.debug.ui.model.TCFNode;
import org.eclipse.tcf.internal.debug.ui.model.TCFNodeExecContext;
import org.eclipse.tcf.internal.debug.ui.model.TCFNodeLaunch;
+import org.eclipse.tcf.internal.services.local.LocatorService;
import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.JSON;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IMemory;
@@ -641,6 +643,7 @@ public class MemoryMapWidget {
final boolean enable_editing = !(region instanceof ForeignRegion);
if (enable_editing) props = new HashMap<String, Object>(props);
MemoryMapItemDialog dlg = new MemoryMapItemDialog(map_table.getShell(), props, enable_editing) {
+ boolean symbols_ok;
protected void createStatusFields(Composite parent) {
try {
if (mem_node != null && region != null) {
@@ -661,7 +664,7 @@ public class MemoryMapWidget {
}
if (mem_node != null && region != null && region.getAddress() != null) {
- String file_info = new TCFTask<String>(mem_node.getChannel()) {
+ String file_info = new TCFTask<String>(channel) {
public void run() {
StringBuilder buf = new StringBuilder();
TCFDataCache<TCFSymFileRef> sym_cache = mem_node.getSymFileInfo(JSON.toBigInteger(region.getAddress()));
@@ -674,14 +677,15 @@ public class MemoryMapWidget {
if (sym_file_name != null && !sym_file_name.equals(region.getFileName())) {
buf.append("Symbol file: "); //$NON-NLS-1$
buf.append(sym_file_name);
+ symbols_ok = true;
}
@SuppressWarnings("unchecked")
Map<String,Object> map = (Map<String,Object>)sym_data.props.get("FileError"); //$NON-NLS-1$
if (map != null) {
if (buf.length() > 0) buf.append("\n"); //$NON-NLS-1$
- String msg = TCFModel.getErrorMessage(new ErrorReport("", map), false); //$NON-NLS-1$
- buf.append("Symbol file error: ").append(msg); //$NON-NLS-1$
+ buf.append("Symbol file error: "); //$NON-NLS-1$
+ buf.append(TCFModel.getErrorMessage(new ErrorReport("", map), false)); //$NON-NLS-1$
}
}
else if (sym_data.error != null) {
@@ -701,8 +705,8 @@ public class MemoryMapWidget {
}
}
- if (mem_node != null && region != null && region.getFileName() != null) {
- TCFLaunch launch = mem_node.getModel().getLaunch();
+ if (!symbols_ok && mem_node != null && region != null && region.getFileName() != null) {
+ TCFLaunch launch = model.getLaunch();
Object mapped = TCFSourceLookupDirector.lookup(launch, mem_node.getID(), region.getFileName());
if (mapped instanceof IStorage) {
String file_name = ((IStorage)mapped).getFullPath().toOSString();
@@ -710,27 +714,41 @@ public class MemoryMapWidget {
Label label = new Label(parent, SWT.WRAP);
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
label.setFont(parent.getFont());
- label.setText("Mapped to: " + ((IStorage)mapped).getFullPath() +
+ label.setText("Mapped to: " + file_name +
"\nMapping can be edited in the Path Map tab of the launch configuration");
}
}
- if (!(mapped instanceof IStorage) || !((IStorage)mapped).getFullPath().toFile().exists()) {
- Label label = new Label(parent, SWT.WRAP);
- label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- label.setFont(parent.getFont());
- label.setText("The symbol file not found on the local host");
- if (!enable_editing) {
- final Button button_locate = new Button(parent, SWT.PUSH | SWT.WRAP);
- button_locate.setText("Locate local copy of the file... "); //$NON-NLS-1$
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
- layoutData.widthHint = 50;
- button_locate.setLayoutData(layoutData);
- button_locate.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- locateSymbolFile(region);
+ boolean local_host_peer = new TCFTask<Boolean>(channel) {
+ @Override
+ public void run() {
+ List<IPeer> peers = channel.getRemotePeerList();
+ for (IPeer peer : peers) {
+ if (LocatorService.isLocalHostPeer(peer)) {
+ done(true);
+ return;
}
- });
+ }
+ done(false);
+ }
+ }.get();
+ if (local_host_peer) {
+ if (!(mapped instanceof IStorage) || !((IStorage)mapped).getFullPath().toFile().exists()) {
+ Label label = new Label(parent, SWT.WRAP);
+ label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ label.setFont(parent.getFont());
+ label.setText("The symbol file not found on the local host");
+ if (!enable_editing) {
+ final Button button_locate = new Button(parent, SWT.PUSH | SWT.WRAP);
+ button_locate.setText("Locate local copy of the file... "); //$NON-NLS-1$
+ GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
+ button_locate.setLayoutData(layoutData);
+ button_locate.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ locateSymbolFile(region);
+ }
+ });
+ }
}
}
}
@@ -740,7 +758,10 @@ public class MemoryMapWidget {
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
label.setForeground(display.getSystemColor(SWT.COLOR_RED));
label.setFont(parent.getFont());
- label.setText("Cannot display region status: " + x.getMessage());
+ String s = "Cannot display region status: " + x.getClass().getName();
+ String m = x.getMessage();
+ if (m != null) s += " " + m;
+ label.setText(s);
}
}
};
@@ -867,7 +888,7 @@ public class MemoryMapWidget {
TCFDataCache<IMemory.MemoryContext> mem_ctx = syms_node.getMemoryContext();
if (!mem_ctx.validate(this)) return;
if (mem_ctx.getData() != null) {
- if (syms_node.getModel().getLaunch().isMemoryMapPreloadingSupported()) {
+ if (model.getLaunch().isMemoryMapPreloadingSupported()) {
TCFDataCache<String> name_cache = syms_node.getFullName();
if (!name_cache.validate(this)) return;
id = name_cache.getData();
@@ -928,7 +949,7 @@ public class MemoryMapWidget {
if (!mem_ctx.validate(this)) return false;
if (mem_ctx.getData() != null) {
String id = null;
- if (syms_node.getModel().getLaunch().isMemoryMapPreloadingSupported()) {
+ if (model.getLaunch().isMemoryMapPreloadingSupported()) {
TCFDataCache<String> name_cache = syms_node.getFullName();
if (!name_cache.validate(this)) return false;
id = name_cache.getData();

Back to the top