View previous topic :: View next topic |
Author |
Message |
davidl
Joined: 17 Aug 2006 Posts: 27
|
Posted: Tue Aug 14, 2007 9:09 pm Post subject: the IDE works great, though some bugs |
|
|
I've found when i place my binary in different directory would make the debugging system not functionating by setting the running working directory to somewhere else.(I already set my source directory to the source lookup directory, including looking up in subdirs option, )
And also if i F8 continue the execution to the func would make the local var not working. and sometimes, ddbg returns junk data , the console shows them, the speed is low. |
|
Back to top |
|
|
davidl
Joined: 17 Aug 2006 Posts: 27
|
Posted: Wed Aug 15, 2007 6:05 am Post subject: patch for setting breakpoint correctly |
|
|
Index: dtool/.classpath
===================================================================
--- dtool/.classpath (revision 633)
+++ dtool/.classpath (working copy)
@@ -3,7 +3,7 @@
<classpathentry kind="src" path="src-descent"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-util"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="libs/antlr-3.0b5.jar"/>
<classpathentry exported="true" kind="lib" path="libs/ini4j.jar" sourcepath="libs/ini4j-0.2.6/src/classes">
Index: descent.tests/descent/tests/launching/DmdCompilerType_Tests.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: descent.debug.ui/src/descent/internal/debug/ui/model/DescentLineBreakpointAdapter.java
===================================================================
--- descent.debug.ui/src/descent/internal/debug/ui/model/DescentLineBreakpointAdapter.java (revision 633)
+++ descent.debug.ui/src/descent/internal/debug/ui/model/DescentLineBreakpointAdapter.java (working copy)
@@ -18,6 +18,8 @@
import descent.core.JavaCore;
import descent.debug.core.IDescentLaunchConfigurationConstants;
import descent.debug.core.model.DescentLineBreakpoint;
+import descent.core.dom.*;
+import descent.internal.compiler.parser.*;
public class DescentLineBreakpointAdapter implements IToggleBreakpointsTarget {
@@ -58,9 +60,26 @@
} catch (BadLocationException e) {
e.printStackTrace();
}
-
+ // FIXME: get document d version !!
+ AST ast = AST.newAST(AST.D1);
+ Parser parser = new Parser(ast, document.get());
+ Module mod = parser.parseModuleObj();
+ StringBuilder sb = new StringBuilder();
+ String modname;
+ if (mod.md != null){
+ for(IdentifierExp pack : mod.md.packages) {
+ sb.append(pack);
+ sb.append("/");
+ }
+ sb.append(mod.md.id);
+ modname = sb.toString();
+ modname = modname + ".d";
+ }
+ else
+ modname = resource.getLocation().lastSegment();
+
// create line breakpoint (doc line numbers start at 0)
- DescentLineBreakpoint lineBreakpoint = new DescentLineBreakpoint(resource, lineNumber + 1, charStart, charEnd);
+ DescentLineBreakpoint lineBreakpoint = new DescentLineBreakpoint(resource, modname, lineNumber + 1, charStart, charEnd);
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
}
}
Index: descent.ui/src/descent/internal/ui/wizards/JavaProjectWizardFirstPage.java
===================================================================
--- descent.ui/src/descent/internal/ui/wizards/JavaProjectWizardFirstPage.java (revision 633)
+++ descent.ui/src/descent/internal/ui/wizards/JavaProjectWizardFirstPage.java (working copy)
@@ -543,7 +543,7 @@
} else {
fHintText.setVisible(false);
}
- ?/
+ */
}
public void update(Observable o, Object arg) {
Index: descent.debug.core/src/descent/debug/core/model/DescentLineBreakpoint.java
===================================================================
--- descent.debug.core/src/descent/debug/core/model/DescentLineBreakpoint.java (revision 633)
+++ descent.debug.core/src/descent/debug/core/model/DescentLineBreakpoint.java (working copy)
@@ -10,18 +10,26 @@
import descent.debug.core.DescentDebugPlugin;
import descent.debug.core.IDescentLaunchConfigurationConstants;
+import descent.debug.core.IDescentLineBreakpoint;
-public class DescentLineBreakpoint extends LineBreakpoint {
+public class DescentLineBreakpoint extends LineBreakpoint implements IDescentLineBreakpoint{
+
+ String modulename;
+ public String getModuleName(){
+ return modulename;
+ }
+
public DescentLineBreakpoint() {
}
- public DescentLineBreakpoint(final IResource resource, final int lineNumber, final int charStart, final int charEnd) throws CoreException {
+ public DescentLineBreakpoint(final IResource resource,final String FileName, final int lineNumber, final int charStart, final int charEnd) throws CoreException {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
IMarker marker = resource
.createMarker(DescentDebugPlugin.PLUGIN_ID + ".descentLineBreakpointMarker"); //$NON-NLS-1$
setMarker(marker);
+ modulename = FileName;
marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
Index: descent.debug.core/src/descent/internal/debug/core/model/DescentDebugTarget.java
===================================================================
--- descent.debug.core/src/descent/internal/debug/core/model/DescentDebugTarget.java (revision 633)
+++ descent.debug.core/src/descent/internal/debug/core/model/DescentDebugTarget.java (working copy)
@@ -25,6 +25,7 @@
import descent.debug.core.DescentDebugPlugin;
import descent.debug.core.IDescentLaunchConfigurationConstants;
import descent.debug.core.IDescentLaunchingPreferenceConstants;
+import descent.debug.core.IDescentLineBreakpoint;
import descent.debug.core.model.IDebugElementFactory;
import descent.debug.core.model.IDebugger;
import descent.debug.core.model.IDebuggerListener;
@@ -85,7 +86,7 @@
IBreakpoint[] breakpoints = manager.getBreakpoints(IDescentLaunchConfigurationConstants.ID_D_DEBUG_MODEL);
for(IBreakpoint breakpoint : breakpoints) {
if (breakpoint.isEnabled()) {
- fDebugger.addBreakpoint(breakpoint.getMarker().getResource().getLocation().toOSString(), ((ILineBreakpoint) breakpoint).getLineNumber());
+ fDebugger.addBreakpoint(((IDescentLineBreakpoint)breakpoint).getModuleName(), ((ILineBreakpoint) breakpoint).getLineNumber());
}
}
} catch (IOException e) {
this patch makes descent set breakpoint based on the AST parse result of module name to set breakpoint.
i use "/" to generate module path, this is supported by ddbg, so i think it's a nice way of getting both windows/linux(gdb) debugger happy
Though descent's debugging still get problem when i set a few breakpoints when i use F8 to continue those breakpoints, after a continuation, the editor seems fail to focus on correct source, ddbg returns correct source code and line, seems there lacks of some handling. |
|
Back to top |
|
|
davidl
Joined: 17 Aug 2006 Posts: 27
|
Posted: Thu Aug 16, 2007 7:53 pm Post subject: yet another patch |
|
|
This patch fixes the problem as last patch, and also refreshes every breakpoint to a way that descent could understand.
Code: | Index: descent.debug.ui/META-INF/MANIFEST.MF
===================================================================
--- descent.debug.ui/META-INF/MANIFEST.MF (revision 636)
+++ descent.debug.ui/META-INF/MANIFEST.MF (working copy)
@@ -17,5 +17,6 @@
org.eclipse.jface.text,
descent.core,
descent.ui,
- descent.debug.core
+ descent.debug.core,
+ org.eclipse.cdt.debug.core
Eclipse-LazyStart: true
Index: descent.debug.ui/src/descent/debug/ui/DescentDebugUI.java
===================================================================
--- descent.debug.ui/src/descent/debug/ui/DescentDebugUI.java (revision 636)
+++ descent.debug.ui/src/descent/debug/ui/DescentDebugUI.java (working copy)
@@ -1,12 +1,21 @@
package descent.debug.ui;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
import java.net.URL;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Shell;
@@ -15,6 +24,12 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import descent.core.dom.AST;
+import descent.debug.core.IDescentLaunchConfigurationConstants;
+import descent.debug.core.model.DescentLineBreakpoint;
+import descent.internal.compiler.parser.IdentifierExp;
+import descent.internal.compiler.parser.Module;
+import descent.internal.compiler.parser.Parser;
import descent.internal.debug.ui.Images;
/**
@@ -26,28 +41,96 @@
public static final String PLUGIN_ID = "descent.debug.ui"; //$NON-NLS-1$
// The shared instance
+
private static DescentDebugUI plugin;
-
+
/**
+ * @param filePath
+ * the name of the file to open. Not sure if it can accept URLs
+ * or just filenames. Path handling could be better, and buffer
+ * sizes are hardcoded
+ */
+ private static String readFileAsString(String filePath)
+ throws java.io.IOException {
+ StringBuffer fileData = new StringBuffer(1000);
+ BufferedReader reader = new BufferedReader(new FileReader(filePath));
+ char[] buf = new char[1024];
+ int numRead = 0;
+ while ((numRead = reader.read(buf)) != -1) {
+ String readData = String.valueOf(buf, 0, numRead);
+ fileData.append(readData);
+ buf = new char[1024];
+ }
+ reader.close();
+ return fileData.toString();
+ }
+
+ /**
* The constructor
+ * @throws IOException
+ * @throws CoreException
+ *
+ * @throws CoreException
*/
- public DescentDebugUI() {
+ public DescentDebugUI() throws IOException, CoreException {
plugin = this;
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IDescentLaunchConfigurationConstants.ID_D_DEBUG_MODEL);
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ int lineNumber = ((ILineBreakpoint)breakpoint).getLineNumber();
+ IMarker marker = breakpoint.getMarker();
+ IResource resource = marker.getResource();
+ String lastseg = resource.getLocation().lastSegment();
+ // FIXME: get document d version !!
+ AST ast = AST.newAST(AST.D1);
+ Parser parser = new Parser(ast, readFileAsString(resource.getLocation().toOSString()));
+ Module mod = parser.parseModuleObj();
+ StringBuilder sb = new StringBuilder();
+ String modname;
+ if (mod.md != null){
+ for(IdentifierExp pack : mod.md.packages) {
+ sb.append(pack);
+ sb.append("/");
+ }
+ sb.append(mod.md.id);
+ modname = sb.toString();
+ modname = modname + ".d";
+ }
+ else
+ modname = lastseg;
+ int charStart = marker.getAttribute(IMarker.CHAR_START,-1);
+ int charEnd = marker.getAttribute(IMarker.CHAR_START,-1);
+ assert(charStart != -1);
+ assert(charEnd != -1);
+
+ // remove
+ breakpoint.delete();
+
+ // create line breakpoint (doc line numbers start at 0)
+ DescentLineBreakpoint lineBreakpoint = new DescentLineBreakpoint(resource, modname, lineNumber + 1, charStart, charEnd);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
+
+ }
+
}
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
-
- getImageRegistry().put(Images.MAIN_TAB, createImageDescriptor(new Path(Images.MAIN_TAB)));
- getImageRegistry().put(Images.VARIABLE_TAB, createImageDescriptor(new Path(Images.VARIABLE_TAB)));
+
+ getImageRegistry().put(Images.MAIN_TAB,
+ createImageDescriptor(new Path(Images.MAIN_TAB)));
+ getImageRegistry().put(Images.VARIABLE_TAB,
+ createImageDescriptor(new Path(Images.VARIABLE_TAB)));
}
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
@@ -57,24 +140,24 @@
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static DescentDebugUI getDefault() {
return plugin;
}
-
+
/*
* Since 3.1.1. Load from icon paths with $NL$
*/
public ImageDescriptor createImageDescriptor(IPath path) {
- URL url= FileLocator.find(getBundle(), path, null);
+ URL url = FileLocator.find(getBundle(), path, null);
if (url != null) {
return ImageDescriptor.createFromURL(url);
}
return null;
}
-
+
/**
* Logs the specified status with this plug-in's log.
*
@@ -84,6 +167,7 @@
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
+
/**
* Logs an internal error with the specified message.
*
@@ -93,7 +177,7 @@
public static void logErrorMessage(String message) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, null));
}
-
+
/**
* Logs an internal error with the specified throwable
*
@@ -101,9 +185,10 @@
* the exception to be logged
*/
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, e.getMessage(),
+ e));
}
-
+
/**
* Returns the active workbench window
*
@@ -120,7 +205,7 @@
}
return null;
}
-
+
/**
* Returns the active workbench shell or <code>null</code> if none
*
@@ -133,7 +218,7 @@
}
return null;
}
-
+
public static void errorDialog(String message, IStatus status) {
log(status);
Shell shell = getActiveWorkbenchShell();
@@ -146,7 +231,8 @@
log(t);
Shell shell = getActiveWorkbenchShell();
if (shell != null) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, 1, t.getMessage(), null);
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, 1, t
+ .getMessage(), null);
ErrorDialog.openError(shell, "Unexpected Error", message, status); //$NON-NLS-1$
}
}
Index: descent.debug.ui/src/descent/internal/debug/ui/model/DescentLineBreakpointAdapter.java
===================================================================
--- descent.debug.ui/src/descent/internal/debug/ui/model/DescentLineBreakpointAdapter.java (revision 636)
+++ descent.debug.ui/src/descent/internal/debug/ui/model/DescentLineBreakpointAdapter.java (working copy)
@@ -18,6 +18,8 @@
import descent.core.JavaCore;
import descent.debug.core.IDescentLaunchConfigurationConstants;
import descent.debug.core.model.DescentLineBreakpoint;
+import descent.core.dom.*;
+import descent.internal.compiler.parser.*;
public class DescentLineBreakpointAdapter implements IToggleBreakpointsTarget {
@@ -58,9 +60,26 @@
} catch (BadLocationException e) {
e.printStackTrace();
}
-
+ // FIXME: get document d version !!
+ AST ast = AST.newAST(AST.D1);
+ Parser parser = new Parser(ast, document.get());
+ Module mod = parser.parseModuleObj();
+ StringBuilder sb = new StringBuilder();
+ String modname;
+ if (mod.md != null){
+ for(IdentifierExp pack : mod.md.packages) {
+ sb.append(pack);
+ sb.append("/");
+ }
+ sb.append(mod.md.id);
+ modname = sb.toString();
+ modname = modname + ".d";
+ }
+ else
+ modname = resource.getLocation().lastSegment();
+
// create line breakpoint (doc line numbers start at 0)
- DescentLineBreakpoint lineBreakpoint = new DescentLineBreakpoint(resource, lineNumber + 1, charStart, charEnd);
+ DescentLineBreakpoint lineBreakpoint = new DescentLineBreakpoint(resource, modname, lineNumber + 1, charStart, charEnd);
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
}
}
Index: descent.tests/descent/tests/launching/DmdCompilerType_Tests.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: descent.debug.core/src/descent/debug/core/model/DescentLineBreakpoint.java
===================================================================
--- descent.debug.core/src/descent/debug/core/model/DescentLineBreakpoint.java (revision 636)
+++ descent.debug.core/src/descent/debug/core/model/DescentLineBreakpoint.java (working copy)
@@ -10,18 +10,26 @@
import descent.debug.core.DescentDebugPlugin;
import descent.debug.core.IDescentLaunchConfigurationConstants;
+import descent.debug.core.IDescentLineBreakpoint;
-public class DescentLineBreakpoint extends LineBreakpoint {
+public class DescentLineBreakpoint extends LineBreakpoint implements IDescentLineBreakpoint{
+
+ String modulename;
+ public String getModuleName(){
+ return modulename;
+ }
+
public DescentLineBreakpoint() {
}
- public DescentLineBreakpoint(final IResource resource, final int lineNumber, final int charStart, final int charEnd) throws CoreException {
+ public DescentLineBreakpoint(final IResource resource,final String FileName, final int lineNumber, final int charStart, final int charEnd) throws CoreException {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
IMarker marker = resource
.createMarker(DescentDebugPlugin.PLUGIN_ID + ".descentLineBreakpointMarker"); //$NON-NLS-1$
setMarker(marker);
+ modulename = FileName;
marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
Index: descent.debug.core/src/descent/internal/debug/core/model/DescentDebugTarget.java
===================================================================
--- descent.debug.core/src/descent/internal/debug/core/model/DescentDebugTarget.java (revision 636)
+++ descent.debug.core/src/descent/internal/debug/core/model/DescentDebugTarget.java (working copy)
@@ -25,6 +25,7 @@
import descent.debug.core.DescentDebugPlugin;
import descent.debug.core.IDescentLaunchConfigurationConstants;
import descent.debug.core.IDescentLaunchingPreferenceConstants;
+import descent.debug.core.IDescentLineBreakpoint;
import descent.debug.core.model.IDebugElementFactory;
import descent.debug.core.model.IDebugger;
import descent.debug.core.model.IDebuggerListener;
@@ -85,7 +86,7 @@
IBreakpoint[] breakpoints = manager.getBreakpoints(IDescentLaunchConfigurationConstants.ID_D_DEBUG_MODEL);
for(IBreakpoint breakpoint : breakpoints) {
if (breakpoint.isEnabled()) {
- fDebugger.addBreakpoint(breakpoint.getMarker().getResource().getLocation().toOSString(), ((ILineBreakpoint) breakpoint).getLineNumber());
+ fDebugger.addBreakpoint(((IDescentLineBreakpoint)breakpoint).getModuleName(), ((ILineBreakpoint) breakpoint).getLineNumber());
}
}
} catch (IOException e) {
Index: descent.ui/src/descent/internal/ui/wizards/JavaProjectWizardFirstPage.java
===================================================================
--- descent.ui/src/descent/internal/ui/wizards/JavaProjectWizardFirstPage.java (revision 636)
+++ descent.ui/src/descent/internal/ui/wizards/JavaProjectWizardFirstPage.java (working copy)
@@ -543,7 +543,7 @@
} else {
fHintText.setVisible(false);
}
- ?/
+ */
}
public void update(Observable o, Object arg) {
|
|
|
Back to top |
|
|
asterite
Joined: 01 Jun 2006 Posts: 235 Location: Buenos Aires, Argentina
|
Posted: Mon Aug 20, 2007 6:36 pm Post subject: |
|
|
Hi davidl.
We're planning on releasing a maintenance release which will have performance improvements, additions to the formatter as requested by the users, and possibly bug fixes. Could you update you svn copy and attach the patch to this ticket: http://www.dsource.org/projects/descent/ticket/21
Also, could you explain me what did you fix with the patch?
(sorry I didn't checked it before, I was more concerned with performance issues)
Thanks,
Ary |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|