Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Debug Target is null(Debug Target was null although having launched into Debug mode)
Debug Target is null [message #1809429] Tue, 16 July 2019 06:43 Go to next message
Kien Minh Quan is currently offline Kien Minh QuanFriend
Messages: 7
Registered: July 2019
Junior Member
Hi everyone,

These days, I have faced to the inextricable issue in getting value of Debug Target in CDT Debugger after I had launched into Debug mode. In particular, I used method getDebugTarget() for Launch object, it just returns null, which wasn't what I actually expected. So I wonder whether I launched CDT Debugger in the right way, and there is any Debug Target added into Launch object default. Please help me to get over this obstacle.

I'm definitely grateful when receiving your feedback.

Many thanks!

Below is my code in python that I used for launch CDT Debugger.:
from py4j.java_gateway import JavaGateway, java_import

gateway = JavaGateway()
jvm = gateway.jvm

java_import(jvm, 'org.eclipse.debug.core.*')
java_import(jvm, 'org.eclipse.cdt.launch.*')
java_import(jvm, 'org.eclipse.debug.core.ILaunchManager')
java_import(jvm, 'org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants')
java_import(jvm, 'org.eclipse.debug.core.Launch')

DebugPlugin = jvm.DebugPlugin.getDefault()
manager = DebugPlugin.getLaunchManager()
ATTR_PROJECT_NAME = jvm.ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME
ATTR_PROGRAM_NAME= jvm.ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME
ID_LAUNCH_C_APP = jvm.ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP
DEBUG_MODE = jvm.ILaunchManager.DEBUG_MODE
RUN_MODE = jvm.ILaunchManager.RUN_MODE

type = manager.getLaunchConfigurationType(ID_LAUNCH_C_APP)
wc = type.newInstance(None, project)
wc.setAttribute(ATTR_PROJECT_NAME, project)
wc.setAttribute(ATTR_PROGRAM_NAME, program)
config = wc.doSave()
launch = config.launch(DEBUG_MODE, None)
Re: Debug Target is null [message #1817952 is a reply to message #1809429] Tue, 03 December 2019 14:28 Go to previous message
Gidi Gal is currently offline Gidi GalFriend
Messages: 42
Registered: July 2009
Member
I'm facing an issue with ILaunch.getDebugTarget() returning null as well.
I suspect it is related to the change to DSF.
I tried the following in Eclipse 4.2.2:
1) I installed Eclipse SDK.
2) I imported as source org.eclipse.debug.core plugin.
3) I opened org.eclipse.debug.core.Launch.java.
4) I placed a breakpoint in addDebugTarget method.

Now, I launched Eclipse debug session.
I created a simple "Hello World" project. I tried debugging this project in two ways:
1) Using "GDB (DSF) create process launcher".
2) Using "standard create process launcher".
(See the option "Using GDB (DSF) Create Process Launcher" at the bottom of the "Debug Configurations" wizard for "C/C++ Application").
Only when I used the "standard create process launcher" I hit this breakpoint. From what I understand, this is the only entry to add IDebugTarget.

In case anyone with DSF knowledge is reading this, please explain if the conclusion that IDebugTarget API is not supported by DSF is correct. If it is, please explain what alternative API in DSF is used. If it is not, please explain what we are doing wrong which prevents IDebugTarget to be added. Thanks.
Previous Topic:hello world with eclipse c/c++
Next Topic:undefined reference to 'WinMain@16'
Goto Forum:
  


Current Time: Fri Apr 26 17:07:43 GMT 2024

Powered by FUDForum. Page generated in 0.03149 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top