[Fixed Eclipse CDT] can run normally and cannot be debugged

Source: Internet
Author: User

1. Eclipse CDT is developed for C/C ++
2. symptom:
You can directly use Eclipse IDE for C/C ++ Developers to compile and run c/c ++ normally.
When Eclipse for rcp rap is used and MyEclipse has been integrated, the Eclipse CDT plug-in can only run normally but cannot be debugged, an exception is reported during debugging (it seems that the spring ide plug-in tool conflicts with CDT. After all, c/c ++ is developed in a java Development Environment ):
Java code
ENTRY org.eclipse.core.jobs 4 2 2011-07-19 02:27:53. 796
MESSAGE An internal error occurred during: "Launching tst ".
STACK 0
Java. lang. IllegalArgumentException
At org. eclipse. osgi. framework. internal. core. PackageAdminImpl. getBundles (PackageAdminImpl. java: 571)
At org. eclipse. core. internal. runtime. InternalPlatform. getBundle (InternalPlatform. java: 181)
At org. eclipse. core. runtime. Platform. getBundle (Platform. java: 1416)
At org. springframework. ide. eclipse. core. BundleStateLocationVariableResolver. resolveValue (BundleStateLocationVariableResolver. java: 32)
At org. eclipse. core. internal. variables. DynamicVariable. getValue (DynamicVariable. java: 54)
At org. eclipse. cdt. internal. core. cdtvariables. EclipseVariablesVariableSupplier $ EclipseVarMacro. loadValue (EclipseVariablesVariableSupplier. java: 103)
At org. eclipse. cdt. internal. core. cdtvariables. EclipseVariablesVariableSupplier $ EclipseVarMacro. getStringValue (EclipseVariablesVariableSupplier. java: 90)
At org. eclipse. cdt. dsf. gdb. launching. LaunchUtils. getLaunchEnvironment (LaunchUtils. java: 389)
At org. eclipse. cdt. dsf. gdb. launching. LaunchUtils. getGDBVersion (LaunchUtils. java: 281)
At org. eclipse. cdt. dsf. gdb. launching. GdbLaunchDelegate. getGDBVersion (GdbLaunchDelegate. java: 243)
At org. eclipse. cdt. dsf. gdb. launching. GdbLaunchDelegate. launchDebugSession (GdbLaunchDelegate. java: 129)
At org. eclipse. cdt. dsf. gdb. launching. GdbLaunchDelegate. launchDebugger (GdbLaunchDelegate. java: 83)
At org. eclipse. cdt. dsf. gdb. launching. GdbLaunchDelegate. launch (GdbLaunchDelegate. java: 72)
At org. eclipse. debug. internal. core. LaunchConfiguration. launch (LaunchConfiguration. java: 853)
At org. eclipse. debug. internal. core. LaunchConfiguration. launch (LaunchConfiguration. java: 702)
At org. eclipse. debug. internal. ui. DebugUIPlugin. buildAndLaunch (DebugUIPlugin. java: 924)
At org. eclipse. debug. internal. ui. DebugUIPlugin $ 8.run( DebugUIPlugin. java: 1128)
At org.eclipse.core.internal.jobs. Worker. run (Worker. java: 54)
 
Solution:
Create a plug-in project and introduce the CDT dependency package. Set the breakpoint at org. eclipse. cdt. dsf. gdb. launching. LaunchUtils. getLaunchEnvironment (LaunchUtils. java: 389) to observe the problem.
Through two different target plug-in platforms: a) integrated with eclipse RCP and B of MyEclipse) Eclipse IDE for C/C ++ Developers, the comparison shows that the obtained env content is different. The key is bundle_loc, bundle_state_loc, and bundle_version. springframework. ide. eclipse. core/META-INF/MANIFEST. MF reference code
Because I do not know about CDT and Spring IDE plug-ins, the code of LaunchUtils is fixed. envMap. put (var. getName (), var. getStringValue () in the getLaunchEnvironmen method; replaced:
Java code
Try {
EnvMap. put (var. getName (), var. getStringValue ());
} Catch (IllegalArgumentException e ){
If (var. getName () = null |! Var. getName (). startsWith ("bundle _") throw e;
ResourcesPlugin. getPlugin (). getLog (). log (new Status (IStatus. INFO, GdbPlugin. PLUGIN_ID, "ignore env variable [" + var. getName () + "] fetch error! ", E ));
}
 
Replace the binary code in org. eclipse. cdt. dsf. gdb_3.0.201102110609.jar.
Attachment description:
The zip package is the LaunchUtils. class code.
Org. eclipse. cdt. dsf. gdb_3.0.0.201102110609.jar is the repaired package.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.