diff options
author | Eugene Tarassov | 2020-11-11 22:42:16 +0000 |
---|---|---|
committer | Eugene Tarassov | 2020-11-11 22:42:16 +0000 |
commit | a0483f7b54f40d19f79c47cd747a357f27e8517c (patch) | |
tree | 41e0f4d5f7795c45f9564aa92685ae87e19bce3f /plugins | |
parent | 160b9fc8fca4d0a69a52096ca6d40c36a3101e2f (diff) | |
download | org.eclipse.tcf-a0483f7b54f40d19f79c47cd747a357f27e8517c.tar.gz org.eclipse.tcf-a0483f7b54f40d19f79c47cd747a357f27e8517c.tar.xz org.eclipse.tcf-a0483f7b54f40d19f79c47cd747a357f27e8517c.zip |
TCF Debugger: fixed incorrect "The symbol file not found..." message in the Symbol File dialog
The incorrect message is shown when the file is stored in the Eclipse workspace
Diffstat (limited to 'plugins')
2 files changed, 54 insertions, 51 deletions
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 4bc0077ab..2fefa9c94 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 @@ -707,9 +707,9 @@ public class MemoryMapWidget { 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(); + IStorage mapped = TCFSourceLookupDirector.lookupByTargetPathMap(launch, mem_node.getID(), region.getFileName()); + if (mapped != null) { + String file_name = mapped.getFullPath().toOSString(); if (!file_name.equals(region.getFileName())) { Label label = new Label(parent, SWT.WRAP); label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); @@ -732,7 +732,10 @@ public class MemoryMapWidget { } }.get(); if (local_host_peer) { - if (!(mapped instanceof IStorage) || !((IStorage)mapped).getFullPath().toFile().exists()) { + boolean exists = + mapped != null && mapped.getFullPath().toFile().exists() || + new File(region.getFileName()).exists(); + if (!exists) { Label label = new Label(parent, SWT.WRAP); label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); label.setFont(parent.getFont()); diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFSourceLookupDirector.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFSourceLookupDirector.java index 2bb81ed0f..9fea72c92 100644 --- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFSourceLookupDirector.java +++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFSourceLookupDirector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2014 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 @@ -48,7 +48,51 @@ public class TCFSourceLookupDirector extends AbstractSourceLookupDirector { fSupportedContainerTypes.add("org.eclipse.cdt.debug.core.containerType.mapping"); }; - public static Object lookup(final TCFLaunch launch, final String ctx, Object element) { + public static IStorage lookupByTargetPathMap(final TCFLaunch launch, final String ctx, final String str) { + String key = str; + if (ctx != null) key = ctx + "::" + str; + Map<String,IStorage> map = launch.getTargetPathMappingCache(); + synchronized (map) { + if (map.containsKey(str)) return map.get(key); + } + return new TCFTask<IStorage>(launch.getChannel()) { + public void run() { + TCFDataCache<IPathMap.PathMapRule[]> cache = launch.getTargetPathMap(); + if (cache != null) { + if (!cache.validate(this)) return; + IPathMap.PathMapRule[] data = cache.getData(); + if (data != null) { + for (IPathMap.PathMapRule r : data) { + final String query = r.getContextQuery(); + if (query != null && query.length() > 0 && !query.equals("*")) { + if (ctx == null) continue; + TCFDataCache<String[]> q_cache = launch.getContextQuery(query); + if (q_cache == null) continue; + if (!q_cache.validate(this)) return; + String[] q_data = q_cache.getData(); + if (q_data == null) continue; + boolean ok = false; + for (String id : q_data) { + if (ctx.equals(id)) ok = true; + } + if (!ok) continue; + } + String fnm = TCFSourceLookupParticipant.toFileName(r, str); + if (fnm == null) continue; + File file = new File(fnm); + if (file.isAbsolute() && file.exists() && file.isFile()) { + done(new LocalFileStorage(file)); + return; + } + } + } + } + done(null); + } + }.getE(); + } + + public static Object lookup(TCFLaunch launch, String ctx, Object element) { if (element instanceof ILineNumbers.CodeArea) { element = TCFSourceLookupParticipant.toFileName((ILineNumbers.CodeArea)element); } @@ -62,48 +106,7 @@ public class TCFSourceLookupDirector extends AbstractSourceLookupDirector { } if (source_element == null && element instanceof String) { /* Try to lookup the element using target side path mapping rules */ - final String str = (String)element; - String key = str; - if (ctx != null) key = ctx + "::" + str; - Map<String,IStorage> map = launch.getTargetPathMappingCache(); - synchronized (map) { - if (map.containsKey(str)) return map.get(key); - } - IStorage storage = new TCFTask<IStorage>(launch.getChannel()) { - public void run() { - TCFDataCache<IPathMap.PathMapRule[]> cache = launch.getTargetPathMap(); - if (cache != null) { - if (!cache.validate(this)) return; - IPathMap.PathMapRule[] data = cache.getData(); - if (data != null) { - for (IPathMap.PathMapRule r : data) { - final String query = r.getContextQuery(); - if (query != null && query.length() > 0 && !query.equals("*")) { - if (ctx == null) continue; - TCFDataCache<String[]> q_cache = launch.getContextQuery(query); - if (q_cache == null) continue; - if (!q_cache.validate(this)) return; - String[] q_data = q_cache.getData(); - if (q_data == null) continue; - boolean ok = false; - for (String id : q_data) { - if (ctx.equals(id)) ok = true; - } - if (!ok) continue; - } - String fnm = TCFSourceLookupParticipant.toFileName(r, str); - if (fnm == null) continue; - File file = new File(fnm); - if (file.isAbsolute() && file.exists() && file.isFile()) { - done(new LocalFileStorage(file)); - return; - } - } - } - } - done(null); - } - }.getE(); + IStorage storage = lookupByTargetPathMap(launch, ctx, (String)element); if (storage != null) { /* Map to workspace resource */ IPath path = storage.getFullPath(); @@ -120,9 +123,6 @@ public class TCFSourceLookupDirector extends AbstractSourceLookupDirector { } } } - synchronized (map) { - map.put(key, storage); - } source_element = storage; } return source_element; |