Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 151945 Details for
Bug 294874
Pending breakpoints in shared objects do not work in CDT
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch from bug 248595
eclipse.org-294874.patch (text/plain), 17.59 KB, created by
Alexandre Rusev
on 2009-11-11 10:13:23 EST
(
hide
)
Description:
Patch from bug 248595
Filename:
MIME Type:
Creator:
Alexandre Rusev
Created:
2009-11-11 10:13:23 EST
Size:
17.59 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.debug.mi.core >Index: cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java,v >retrieving revision 1.25 >diff -u -r1.25 SharedLibraryManager.java >--- cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java 25 Apr 2008 21:23:32 -0000 1.25 >+++ cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java 29 Oct 2009 17:29:29 -0000 >@@ -59,6 +59,7 @@ > import org.eclipse.cdt.debug.mi.core.output.MIShared; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Path; >+import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent; > > /** > * Manager of the CDI shared libraries. >@@ -134,9 +135,29 @@ > MISession miSession = target.getMISession(); > Session session = (Session)target.getSession(); > List eventList = updateState(target); >- // A new Libraries loaded or something change, try to set the breakpoints. >- if (eventList.size() > 0) { >- BreakpointManager bpMgr = session.getBreakpointManager(); >+ // A new Libraries loaded or something change, try to update the breakpoints. >+ BreakpointManager bpMgr = session.getBreakpointManager(); >+ MIBreakpoint[] miBPoints = bpMgr.getAllMIBreakpoints(miSession); >+ if(miBPoints != null){ >+ for(int p=0;p<miBPoints.length;++p){ >+ int no = miBPoints[p].getNumber(); >+ Breakpoint bp = bpMgr.getBreakpoint(target, no); >+ if(bp != null) { >+ MIBreakpoint[] miBreakpoints = bp.getMIBreakpoints(); >+ for(int q=0;q<miBreakpoints.length;++q){ >+ if(miBreakpoints[q].getNumber() == no){ >+ if(!miBreakpoints[q].miFieldsEquals(miBPoints[p])){ >+ //update internal information on MI breakpoints and send event >+ miBreakpoints[q] = miBPoints[p]; >+ eventList.add(new MIBreakpointChangedEvent(miSession, no)); >+ } >+ } >+ } >+ } >+ } >+ } >+ >+ if (eventList.size() > 0 && !miSession.getCommandFactory().pendingBreakEnabled()) { > ICDIBreakpoint bpoints[] = null; > try { > bpoints = bpMgr.getDeferredBreakpoints(target); >Index: cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java,v >retrieving revision 1.54 >diff -u -r1.54 BreakpointManager.java >--- cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java 2 Jun 2009 19:39:38 -0000 1.54 >+++ cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java 29 Oct 2009 17:29:29 -0000 >@@ -409,7 +409,8 @@ > MIBreakpoint[] miBps = bp.getMIBreakpoints(); > for (int j = 0; j < miBps.length; j++) { > if (miBps[j].getNumber() == no) { >- if (hasBreakpointChanged(miBps[j], miBreakpoint)) { >+ //if (hasBreakpointChanged(miBps[j], miBreakpoint)) { >+ if(true){ > miBps[j] = miBreakpoint; > bp.setEnabled0(miBreakpoint.isEnabled()); > // FIXME: We have a problem if the thread id change. >@@ -479,7 +480,7 @@ > } else { > MIPlugin.log("Unsupported event breakpoint: "+miBreakpoint.getWhat()); //$NON-NLS-1$ log entry not for users > } >- } else if (addr != null && addr.length() > 0) { >+ } else if (addr != null && addr.length() > 0) {// addr may be "<PENDING>" > BigInteger big = MIFormat.getBigInteger(addr); > AddressLocation location = createAddressLocation(big); > newBreakpoint = new AddressBreakpoint(target, type, location, condition, >Index: .settings/org.eclipse.jdt.core.prefs >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/.settings/org.eclipse.jdt.core.prefs,v >retrieving revision 1.3 >diff -u -r1.3 org.eclipse.jdt.core.prefs >--- .settings/org.eclipse.jdt.core.prefs 8 Apr 2009 15:02:02 -0000 1.3 >+++ .settings/org.eclipse.jdt.core.prefs 29 Oct 2009 17:29:29 -0000 >@@ -1,4 +1,4 @@ >-#Wed Apr 08 15:56:28 BST 2009 >+#Thu Oct 29 14:12:08 MSK 2009 > eclipse.preferences.version=1 > org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled > org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 >@@ -61,7 +61,7 @@ > org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled > org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled > org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled >-org.eclipse.jdt.core.compiler.problem.unusedImport=error >+org.eclipse.jdt.core.compiler.problem.unusedImport=warning > org.eclipse.jdt.core.compiler.problem.unusedLabel=warning > org.eclipse.jdt.core.compiler.problem.unusedLocal=warning > org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore >Index: mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java,v >retrieving revision 1.22 >diff -u -r1.22 CommandFactory.java >--- mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java 25 Apr 2008 16:06:06 -0000 1.22 >+++ mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java 29 Oct 2009 17:29:29 -0000 >@@ -27,10 +27,22 @@ > public class CommandFactory { > > String fMIVersion; >+ private boolean pendingBreakEnabled; > > protected CommandFactory() { > } > >+ /** >+ * @param b enable/disable usage of pending breakpoints >+ */ >+ public void setMIPendingBreakpointEnabled(boolean b) { >+ pendingBreakEnabled = b; >+ } >+ >+ public boolean pendingBreakEnabled() { >+ return pendingBreakEnabled; >+ } >+ > public CommandFactory(String miVersion) { > fMIVersion = miVersion; > } >@@ -65,11 +77,11 @@ > > public MIBreakInsert createMIBreakInsert(boolean isTemporary, boolean isHardware, > String condition, int ignoreCount, String line, int tid) { >- return new MIBreakInsert(getMIVersion(), isTemporary, isHardware, condition, ignoreCount, line, tid); >+ return new MIBreakInsert(getMIVersion(), isTemporary, isHardware, true, condition, ignoreCount, line, tid,pendingBreakEnabled); > } > > public MIBreakInsert createMIBreakInsert(String func) { >- return new MIBreakInsert(getMIVersion(), func); >+ return new MIBreakInsert(getMIVersion(), func, pendingBreakEnabled); > } > > public MIBreakList createMIBreakList() { >Index: mi/org/eclipse/cdt/debug/mi/core/command/MIBreakInsert.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakInsert.java,v >retrieving revision 1.8 >diff -u -r1.8 MIBreakInsert.java >--- mi/org/eclipse/cdt/debug/mi/core/command/MIBreakInsert.java 23 Jun 2006 17:25:38 -0000 1.8 >+++ mi/org/eclipse/cdt/debug/mi/core/command/MIBreakInsert.java 29 Oct 2009 17:29:29 -0000 >@@ -60,15 +60,42 @@ > */ > public class MIBreakInsert extends MICommand > { >+ >+ /** >+ * >+ * @deprecated >+ */ > public MIBreakInsert(String miVersion, String func) { > this(miVersion, false, false, null, 0, func, 0); > } > >+ public MIBreakInsert(String miVersion, String func, boolean pendingSupported) { >+ this(miVersion, false, false, true, >+ null, 0, func, 0, pendingSupported); >+ } >+ >+ /** >+ * >+ * @deprecated >+ */ > public MIBreakInsert(String miVersion, boolean isTemporary, boolean isHardware, > String condition, int ignoreCount, String line, int tid) { >+ this(miVersion, isTemporary, isHardware, true, >+ condition, ignoreCount, line, tid, false); >+ } >+ >+ public MIBreakInsert(String miVersion, boolean isTemporary, boolean isHardware, boolean isPending, >+ String condition, int ignoreCount, String line, int tid, boolean pendingSupported) { > super(miVersion, "-break-insert"); //$NON-NLS-1$ > >+ >+ if(!pendingSupported) >+ isPending = false; >+ > int i = 0; >+ if (isPending) { >+ i++; >+ } > if (isTemporary) { > i++; > } >@@ -87,6 +114,10 @@ > String[] opts = new String[i]; > > i = 0; >+ if (isPending) { >+ opts[i] = "-f"; //$NON-NLS-1$ >+ i++; >+ } > if (isTemporary) { > opts[i] = "-t"; //$NON-NLS-1$ > i++; >Index: mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java,v >retrieving revision 1.10 >diff -u -r1.10 MIBreakpoint.java >--- mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java 14 Jun 2007 18:32:54 -0000 1.10 >+++ mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java 29 Oct 2009 17:29:29 -0000 >@@ -56,6 +56,7 @@ > boolean enabled; > String address; > String func = ""; //$NON-NLS-1$ >+ String pending = ""; //$NON-NLS-1$ > String file = ""; //$NON-NLS-1$ > int line; > String cond = ""; //$NON-NLS-1$ >@@ -69,6 +70,7 @@ > boolean isRWpt; > boolean isWWpt; > boolean isHdw; >+ boolean isPending; > > public MIBreakpoint(MITuple tuple) { > parse(tuple); >@@ -229,10 +231,19 @@ > } else if (var.equals("addr")) { //$NON-NLS-1$ > try { > address = str.trim(); >+ //TODO: parse HEX integer up to 64 bits long and throw NumberFormatException if needed >+ if(address.toUpperCase().equals("<PENDING>")){ >+ address = null; >+ isPending = true; >+ } > } catch (NumberFormatException e) { >+ isPending = true; > } > } else if (var.equals("func")) { //$NON-NLS-1$ > func = str; >+ } else if (var.equals("pending")) { //$NON-NLS-1$ >+ pending = str; >+ isPending = true; > } else if (var.equals("file")) { //$NON-NLS-1$ > file = str; > } else if (var.equals("thread")) { //$NON-NLS-1$ >@@ -258,9 +269,43 @@ > cond = str; > } > } >+ >+ if(isPending){ >+ if(func.trim().equals("")){ >+ func = pending; >+ } >+ } > } > > public void setFile(String file) { > this.file = file; > } >+ >+ >+ public boolean miFieldsEquals(MIBreakpoint other){ >+ boolean ret = true; >+ >+ ret = ret & (number == other.number); >+ ret = ret & (type.equals(other.type)); >+ ret = ret & (disp.equals(other.disp)); >+ ret = ret & (enabled == other.enabled); >+ if(address != null){ >+ ret = ret & (address.equals(other.address)); >+ }else{ >+ ret = ret & (other.address == null); >+ } >+ ret = ret & (func.equals(other.func)); >+ ret = ret & (pending.equals(other.pending)); >+ ret = ret & (file.equals(other.file)); >+ ret = ret & (line == other.line); >+ ret = ret & (cond.equals(other.cond)); >+ ret = ret & (times == other.times); >+ ret = ret & (what.equals(other.what)); >+ ret = ret & (threadId.equals(other.threadId)); >+ ret = ret & (ignore == other.ignore); >+ >+ return ret; >+ } >+ >+ > } >Index: mi/org/eclipse/cdt/debug/mi/core/MISession.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/MISession.java,v >retrieving revision 1.21 >diff -u -r1.21 MISession.java >--- mi/org/eclipse/cdt/debug/mi/core/MISession.java 30 Sep 2009 13:06:41 -0000 1.21 >+++ mi/org/eclipse/cdt/debug/mi/core/MISession.java 29 Oct 2009 17:29:29 -0000 >@@ -18,10 +18,13 @@ > import java.io.OutputStream; > import java.io.PipedInputStream; > import java.io.PipedOutputStream; >+import java.util.ArrayList; >+import java.util.List; > import java.util.Observable; > > import org.eclipse.cdt.debug.mi.core.command.Command; > import org.eclipse.cdt.debug.mi.core.command.CommandFactory; >+import org.eclipse.cdt.debug.mi.core.command.MICommand; > import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt; > import org.eclipse.cdt.debug.mi.core.command.MIGDBExit; > import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; >@@ -31,9 +34,18 @@ > import org.eclipse.cdt.debug.mi.core.command.MIVersion; > import org.eclipse.cdt.debug.mi.core.event.MIEvent; > import org.eclipse.cdt.debug.mi.core.event.MIGDBExitEvent; >+import org.eclipse.cdt.debug.mi.core.output.MIBreakInsertInfo; >+import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; >+import org.eclipse.cdt.debug.mi.core.output.MIConst; > import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo; >+import org.eclipse.cdt.debug.mi.core.output.MIInfo; >+import org.eclipse.cdt.debug.mi.core.output.MIList; > import org.eclipse.cdt.debug.mi.core.output.MIOutput; > import org.eclipse.cdt.debug.mi.core.output.MIParser; >+import org.eclipse.cdt.debug.mi.core.output.MIResult; >+import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; >+import org.eclipse.cdt.debug.mi.core.output.MITuple; >+import org.eclipse.cdt.debug.mi.core.output.MIValue; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.NullProgressMonitor; > >@@ -111,6 +123,7 @@ > */ > public MISession(MIProcess process, IMITTY tty, int type, int commandTimeout, int launchTimeout, String miVersion, IProgressMonitor monitor) throws MIException { > this(process, tty, type, new CommandFactory(miVersion), commandTimeout, launchTimeout, monitor); >+ inqureGDBFeatures(); > } > > >@@ -130,6 +143,7 @@ > // if exec console is present, assume MI2 supported > setCommandFactory(new CommandFactory(MIVersion.MI2)); > } >+ inqureGDBFeatures(); > } > > /** >@@ -166,6 +180,7 @@ > > // initialize/setup > setup(launchTimeout, new NullProgressMonitor()); >+ inqureGDBFeatures(); > } > > /** >@@ -179,7 +194,7 @@ > * > * @since 3.1 > */ >- public MISession(MIProcess process, IMITTY tty, int type, CommandFactory commandFactory, int commandTimeout) throws MIException { >+ public MISession(MIProcess process, IMITTY tty, int type, CommandFactory commandFactory, int commandTimeout) throws MIException { > gdbProcess = process; > inChannel = process.getInputStream(); > outChannel = process.getOutputStream(); >@@ -205,7 +220,9 @@ > > txThread.start(); > rxThread.start(); >- eventThread.start(); >+ eventThread.start(); >+ >+ inqureGDBFeatures(); > } > > /** >@@ -860,4 +877,85 @@ > public final void setBreakpointsWithFullName(boolean breakpointsWithFullName) { > this.breakpointsWithFullName = breakpointsWithFullName; > } >+ >+ >+ private final void inqureGDBFeatures() { >+ try{ >+ MIGdbListFearutes features = new MIGdbListFearutes(null); >+ postCommand(features); >+ factory.setMIPendingBreakpointEnabled(features.getMIInfo().pendingBrekpoints); >+ }catch(MIException e){ >+ e.printStackTrace(); >+ } >+ } >+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >+static class MIGdbListFearutes extends MICommand{ >+ boolean pendingBrekpoints; >+ boolean threadInfo; >+ boolean frozenVarobjs; >+ >+ public MIGdbListFearutes(String miVersion) { >+ super(miVersion, "-list-features"); //$NON-NLS-1$ >+ setParameters(new String[]{""}); >+ } >+ >+ >+ public MIGdbFeaturesInfo getMIInfo() throws MIException { >+ MIGdbFeaturesInfo info = null; >+ MIOutput out = getMIOutput(); >+ if (out != null) { >+ info = new MIGdbFeaturesInfo(out); >+ if (info.isError()) { >+ throwMIException(info, out); >+ } >+ } >+ return info; >+ } >+ >+} >+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >+public static class MIGdbFeaturesInfo extends MIInfo{ >+ boolean pendingBrekpoints; >+ boolean threadInfo; >+ boolean frozenVarobjs; >+ >+ public MIGdbFeaturesInfo(MIOutput record) { >+ super(record); >+ parse(); >+ } >+ >+ >+ >+ void parse() { >+ //List aList = new ArrayList(1); >+ if (isDone()) { >+ MIOutput out = getMIOutput(); >+ MIResultRecord rr = out.getMIResultRecord(); >+ if (rr != null) { >+ MIResult[] results = rr.getMIResults(); >+ for (int i = 0; i < results.length; i++) { >+ String var = results[i].getVariable(); >+ MIList valList = (MIList)(results[i].getMIValue()); >+ MIValue[] values = valList.getMIValues(); >+ for(int j=0;j<values.length;++j){ >+ String val=((MIConst)values[j]).getString(); >+ if("pending-breakpoints".equals(val)){ >+ pendingBrekpoints = true; >+ } else if("thread-info".equals(val)){ >+ threadInfo = true; >+ } else if("frozen-varobjs".equals(val)){ >+ frozenVarobjs = true; >+ } >+ } >+ } >+ >+ } >+ } >+ >+ } >+ >+ >+ >+} >+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > } >#P org.eclipse.cdt.debug.mi.ui >Index: src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java,v >retrieving revision 1.3 >diff -u -r1.3 MiConsolePageParticipant.java >--- src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java 15 Jan 2008 09:12:57 -0000 1.3 >+++ src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java 29 Oct 2009 17:29:32 -0000 >@@ -16,6 +16,7 @@ > > import org.eclipse.cdt.debug.mi.core.GDBProcess; > import org.eclipse.cdt.debug.mi.core.cdi.model.Target; >+import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent; > import org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleSaveAction; > import org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleVerboseModeAction; > import org.eclipse.debug.core.DebugEvent; >@@ -105,13 +106,15 @@ > } > } > } >- > /** > * Handle MISession notification > */ > public void update(Observable arg0, Object arg1) { >- if((arg1!=null) && (arg1 instanceof VerboseModeChangedEvent) && (fVerboseMode != null)) { >- try { >+ if((arg1!=null) && >+ ((arg1 instanceof VerboseModeChangedEvent) || (arg1 instanceof MIBreakpointChangedEvent)) >+ && (fVerboseMode != null)) { >+ try { >+ > fVerboseMode.updateStateAndEnablement(); > } catch (Exception e) { > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 294874
: 151945