Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to debug binaries with cdtdebug.sh from command line?
How to debug binaries with cdtdebug.sh from command line? [message #1754588] Mon, 20 February 2017 15:16 Go to next message
Thomas Mitterfellner is currently offline Thomas MitterfellnerFriend
Messages: 2
Registered: February 2017
Junior Member
I try to debug a program not built with eclipse (but with some custom build system) using the standalone cdtdebug.sh script:
cdtdebug.sh -e /path/to/my_program some args

But when the GUI has started up, I cannot start debugging immediately:
Launching 'New_configuration' has encountered a problem. Program file does not exist

When I click on the /path/to/my_program in the Executable tab (the executable is automatically entered there), I get an error:

An internal error occurred during: "Reading Debug Symbol Information: boost".
java.lang.IllegalArgumentException
        at java.nio.Buffer.position(Buffer.java:244)
        at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.parseSourceInCULineInfo(DwarfReader.java:295)
        at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.processCompileUnit(DwarfReader.java:647)
        at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.processDebugInfoEntry(DwarfReader.java:606)
        at org.eclipse.cdt.utils.debug.dwarf.Dwarf.parseDebugInfoEntry(Dwarf.java:593)
        at org.eclipse.cdt.utils.debug.dwarf.Dwarf.parseDebugInfo(Dwarf.java:485)
        at org.eclipse.cdt.utils.debug.dwarf.Dwarf.parse(Dwarf.java:454)
        at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.getSourceFilesFromDebugInfoSection(DwarfReader.java:564)
        at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.getSourceFiles(DwarfReader.java:542)
        at org.eclipse.cdt.internal.debug.application.CompilerOptionParser.run(CompilerOptionParser.java:104)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2267)
        at org.eclipse.cdt.internal.debug.application.DebugExecutable.importAndCreateLaunchConfig(DebugExecutable.java:241)
        at org.eclipse.cdt.debug.application.ApplicationWorkbenchWindowAdvisor$PostWindowCreateRunnable.run(ApplicationWorkbenchWindowAdvisor.java:363)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)


Only after I enter the path to the executable manually in the Debug configuration, I can start debugging, which makes me wonder: shouldn't the -e switch provide that?

So my question is: is there an easy way I can start debugging just using some command from the command line?

The reason I want this is I have several different executables and would like to avoid having to enter their paths manually each time, or select some configuration, but rather jump-start to debugging each using my custom debugging launcher.
N.B.: It was possible to do this with the intel debugger idb (which was based on the eclipse framework) but they deprecated that, so I'm trying to switch to eclipse debugging.
Re: How to debug binaries with cdtdebug.sh from command line? [message #1754721 is a reply to message #1754588] Tue, 21 February 2017 19:20 Go to previous messageGo to next message
Marc-André Laperle is currently offline Marc-André LaperleFriend
Messages: 256
Registered: July 2009
Senior Member
It looks like there might be a bug in CDT's Dwarf parsing. Can you try with another executable with debug info, like a simple hello world? Also, is this using the new Dwarf 5 by any chance? I'm asking in case because the spec just came out Wink
Re: How to debug binaries with cdtdebug.sh from command line? [message #1755196 is a reply to message #1754588] Tue, 28 February 2017 23:57 Go to previous messageGo to next message
Travis Downs is currently offline Travis DownsFriend
Messages: 2
Registered: January 2017
Junior Member
I am getting the same DWARF parsing error, just when I click on some executable in the "Executables" view. Here's the full trace:

java.lang.IllegalArgumentException
	at java.nio.Buffer.position(Buffer.java:244)
	at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.parseSourceInCULineInfo(DwarfReader.java:295)
	at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.processCompileUnit(DwarfReader.java:647)
	at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.processDebugInfoEntry(DwarfReader.java:606)
	at org.eclipse.cdt.utils.debug.dwarf.Dwarf.parseDebugInfoEntry(Dwarf.java:593)
	at org.eclipse.cdt.utils.debug.dwarf.Dwarf.parseDebugInfo(Dwarf.java:485)
	at org.eclipse.cdt.utils.debug.dwarf.Dwarf.parse(Dwarf.java:454)
	at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.getSourceFilesFromDebugInfoSection(DwarfReader.java:564)
	at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.getSourceFiles(DwarfReader.java:542)
	at org.eclipse.cdt.utils.debug.dwarf.DwarfReader.getSourceFiles(DwarfReader.java:655)
	at org.eclipse.cdt.debug.internal.core.executables.StandardSourceFilesProvider.getSourceFiles(StandardSourceFilesProvider.java:122)
	at org.eclipse.cdt.debug.core.executables.ExecutablesManager.getSourceFiles(ExecutablesManager.java:558)
	at org.eclipse.cdt.debug.core.executables.Executable.getSourceFiles(Executable.java:206)
	at org.eclipse.cdt.debug.internal.ui.views.executables.SourceFilesContentProvider$QuickParseJob.run(SourceFilesContentProvider.java:53)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


Oddly, this problem happens only with the "debug" version of my binary, not the release one (but debug info is included in both).

My binary is a mix of C and asm code, with the C code apparently writing DWARF 2 and the asm writing DWARF 3. The crash seems probably related to the asm code since changing the debug format to stabs for the asm avoids the crash.
Re: How to debug binaries with cdtdebug.sh from command line? [message #1780503 is a reply to message #1755196] Tue, 23 January 2018 13:53 Go to previous message
Thomas Mitterfellner is currently offline Thomas MitterfellnerFriend
Messages: 2
Registered: February 2017
Junior Member
The program I'm trying to debug is a mix of C/Fortran and it's a large executable. A simple hello-world-like fortran program can be debugged, however.
Previous Topic:Getting started with CDT development
Next Topic:How do I link MinGW C/C++ compiler to Eclipse
Goto Forum:
  


Current Time: Tue Mar 19 07:34:22 GMT 2024

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

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

Back to the top