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 155392 Details for
Bug 269838
CDT gdb/mi fails to parse result of gdb cmd "thread info"
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]
Override info threads with -thread-list-ids for Mac command set
MacInfoThreads-patch2.txt (text/plain), 6.95 KB, created by
Marc-André Laperle
on 2010-01-06 00:47:00 EST
(
hide
)
Description:
Override info threads with -thread-list-ids for Mac command set
Filename:
MIME Type:
Creator:
Marc-André Laperle
Created:
2010-01-06 00:47:00 EST
Size:
6.95 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.debug.mi.core >Index: cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java,v >retrieving revision 1.35 >diff -u -r1.35 EventManager.java >--- cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java 14 Jun 2007 18:32:54 -0000 1.35 >+++ cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java 6 Jan 2010 04:34:12 -0000 >@@ -282,6 +282,12 @@ > currentTarget.updateState(threadId); > try { > Thread cthread = (Thread)currentTarget.getCurrentThread(); >+ >+ // As a fallback, use the id from the stopped event >+ if(cthread == null) { >+ cthread = (Thread)currentTarget.getThread(threadId); >+ } >+ > if (cthread != null) { > cthread.getCurrentStackFrame(); > } else { >@@ -422,9 +428,19 @@ > Thread currentThread = null; > try { > currentThread = (Thread)currentTarget.getCurrentThread(); >+ // As a fallback, use the id from the stopped event >+ if(currentThread == null) { >+ currentThread = (Thread)currentTarget.getThread(stopped.getThreadId()); >+ } >+ if(currentThread != null) { >+ tid = currentThread.getId(); >+ } >+ else { >+ return true; >+ } > } catch (CDIException e1) { > } >- tid = currentThread.getId(); >+ > // Select the old thread now. > if (tid > 0) { > MIThreadSelect selectThread = factory.createMIThreadSelect(tid); >Index: mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java,v >retrieving revision 1.3 >diff -u -r1.3 StandardMacOSCommandFactory.java >--- mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java 14 Jun 2007 18:32:55 -0000 1.3 >+++ mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java 6 Jan 2010 04:34:12 -0000 >@@ -15,6 +15,7 @@ > import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD; > import org.eclipse.cdt.debug.mi.core.command.MIInfoSharedLibrary; > import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory; >+import org.eclipse.cdt.debug.mi.core.command.CLIInfoThreads; > > public class StandardMacOSCommandFactory extends StandardCommandFactory { > >@@ -44,4 +45,8 @@ > return new MIInfoSharedLibrary(getMIVersion()); > } > >+ public CLIInfoThreads createCLIInfoThreads() { >+ return new MacOSCLIInfoThreads(); >+ } >+ > } >Index: mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOsCLIInfoThreadsInfo.java >=================================================================== >RCS file: mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOsCLIInfoThreadsInfo.java >diff -N mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOsCLIInfoThreadsInfo.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOsCLIInfoThreadsInfo.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,68 @@ >+package org.eclipse.cdt.debug.mi.core.command.factories.macos; >+ >+import java.util.Arrays; >+ >+import org.eclipse.cdt.debug.mi.core.output.CLIInfoThreadsInfo; >+import org.eclipse.cdt.debug.mi.core.output.MIConst; >+import org.eclipse.cdt.debug.mi.core.output.MIOutput; >+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; >+ >+/** >+ * This class actually parses -thread-list-ids and converts it to the >+ * CLIInfoThreadsInfo 'format' >+ */ >+class MacOsCLIInfoThreadsInfo extends CLIInfoThreadsInfo { >+ >+ public MacOsCLIInfoThreadsInfo(MIOutput out) { >+ super(out); >+ } >+ >+ protected void parse() { >+ 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(); >+ if (var.equals("thread-ids")) { //$NON-NLS-1$ >+ MIValue val = results[i].getMIValue(); >+ if (val instanceof MITuple) { >+ parseThreadIds((MITuple) val); >+ } >+ } >+ } >+ } >+ } >+ if (threadIds == null) { >+ threadIds = new int[0]; >+ } >+ Arrays.sort(threadIds); >+ >+ // -thread-list-ids doesn't provide the current thread id so we >+ // set currentThreadId to a dumb value. This has the effect of falling >+ // back to the thread id provided by the stopped event. See EventManager::processSuspendedEvent >+ currentThreadId = -1; >+ } >+ >+ void parseThreadIds(MITuple tuple) { >+ MIResult[] results = tuple.getMIResults(); >+ threadIds = new int[results.length]; >+ for (int i = 0; i < results.length; i++) { >+ String var = results[i].getVariable(); >+ if (var.equals("thread-id")) { //$NON-NLS-1$ >+ MIValue value = results[i].getMIValue(); >+ if (value instanceof MIConst) { >+ String str = ((MIConst) value).getCString(); >+ try { >+ threadIds[i] = Integer.parseInt(str.trim()); >+ } catch (NumberFormatException e) { >+ } >+ } >+ } >+ } >+ } >+} >Index: mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoThreads.java >=================================================================== >RCS file: mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoThreads.java >diff -N mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoThreads.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSCLIInfoThreads.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+package org.eclipse.cdt.debug.mi.core.command.factories.macos; >+ >+import org.eclipse.cdt.debug.mi.core.MIException; >+import org.eclipse.cdt.debug.mi.core.command.CLIInfoThreads; >+import org.eclipse.cdt.debug.mi.core.output.CLIInfoThreadsInfo; >+import org.eclipse.cdt.debug.mi.core.output.MIInfo; >+import org.eclipse.cdt.debug.mi.core.output.MIOutput; >+ >+class MacOSCLIInfoThreads extends CLIInfoThreads { >+ public MacOSCLIInfoThreads() { >+ super(); >+ // with apple-gdb, we use -thread-list-ids as a replacement for info >+ // threads >+ setOperation("-thread-list-ids"); //$NON-NLS-1$ >+ } >+ >+ // MI doesn't work with a space between the token and the >+ // operation, so we override CLICommmand's toString >+ public String toString() { >+ return getToken() + getOperation() + "\n"; //$NON-NLS-1$ >+ } >+ >+ public MIInfo getMIInfo() throws MIException { >+ MIInfo info = null; >+ MIOutput out = getMIOutput(); >+ if (out != null) { >+ info = new MacOsCLIInfoThreadsInfo(out); >+ if (info.isError()) { >+ throwMIException(info, out); >+ } >+ } >+ return info; >+ } >+ >+ public CLIInfoThreadsInfo getMIInfoThreadsInfo() throws MIException { >+ return (CLIInfoThreadsInfo) getMIInfo(); >+ } >+ >+}
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 269838
:
129741
|
129886
|
151905
|
151906
|
155392
|
155393
|
156477
|
157863
|
157865
|
158135
|
158393
|
158394