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 151905 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-patch.txt (text/plain), 5.29 KB, created by
Marc-André Laperle
on 2009-11-10 21:54:51 EST
(
hide
)
Description:
Override info threads with -thread-list-ids for Mac command set
Filename:
MIME Type:
Creator:
Marc-André Laperle
Created:
2009-11-10 21:54:51 EST
Size:
5.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.debug.mi.core >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 11 Nov 2009 02:45:59 -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,66 @@ >+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); >+ if (threadIds.length > 0) { >+ currentThreadId = threadIds[0]; >+ } >+ } >+ >+ 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