Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "CDT/StandaloneDebugger"

< CDT
(What is it?)
Line 38: Line 38:
 
  Wiki page: <http://wiki.eclipse.org/CDT/StandaloneDebugger>
 
  Wiki page: <http://wiki.eclipse.org/CDT/StandaloneDebugger>
  
Normally, in Eclipse, a user needs to set up an Eclipse project.  In the case of C/C++ development, this means a
+
The Standalone Debugger is designed to make debugging easier for the C/C++ developer that has little to no experience with Eclipse.
C/C++ project.  As there are multiple ways of building a C/C++ project (e.g. using Autotools or a Standard Makefile project),
+
 
there are multiple types of C/C++ projects.  Rather than impose the project model on the end-user that just wishes
+
Normally, to use the C/C++ tools in Eclipse, a user needs to set up an Eclipse project.  The project has natures which dictates various menus and actions
 +
that are appropriate for the project.  For C/C++, there are multiple natures that may apply due to the fact that there are multiple ways such a project
 +
may be built (e.g. an Autotools vs a project which maintains its own Makefile).  Rather than impose the Eclipse project model on the end-user that just wishes
 
to debug, the Standalone Debugger automatically creates a project on behalf of the end-user.  As mentioned, the Standalone Debugger only loads a subset of the CDT plug-ins pertaining
 
to debug, the Standalone Debugger automatically creates a project on behalf of the end-user.  As mentioned, the Standalone Debugger only loads a subset of the CDT plug-ins pertaining
to debugging and build plug-ins are not included in this list.  This enables the Standalone debugger to create a default
+
to debugging and build plug-ins are not included in this list.  Thus, the Standalone debugger does not have to be concerned with adding natures pertaining
project without having to know details on how the project is built.
+
to build and can default the project type on behalf of the end-user.
  
[[Image:StandaloneDebuggerScreenshot.png]]
+
In addition, to debug an application, or an attached process, or a core-file, a user would normally have to set up
 +
an Eclipse launch configuration.  Launch configurations store all the information required to launch an application such as
 +
what application is being launched, parameters passed, environment variables, etc... In the case of a debug launch configuration this
 +
includes what debugger is used and parameters to the debugger itself.  Launch configurations can have different types based on what
 +
is being launched.  Rather than force an end-user to deal with this, the Standalone Debugger creates a launch configuration on behalf of
 +
the end-user based on the command-line parameters used.  As well, the debug session is automatically started so the end-user basically
 +
just has to start debugging which is fairly intuitive in the Eclipse IDE.
  
 +
[[Image:StandaloneDebuggerScreenshot.png]]
  
 
== How to try it out ==
 
== How to try it out ==

Revision as of 16:50, 15 July 2014

This page details the effort to create a stand-alone Debugger using Eclipse.

What is it?

The Standalone Debugger is an Eclipse application that starts up a subset of the Eclipse CDT plug-ins that pertain specifically to debugging. The application has an accompanying command-line script which allows an end-user to start up the debugger from the command-line and pass arguments that will start the debugger for the appropriate task.

The end-user can specify either to debug an application, to attach to an existing process, or to debug a core-file. In addition, a build log can be specified to aid the Debugger in locating include files and knowing what flags were used to compile the source code.

Usage: cdtdebug.sh [ECLIPSE_OPTIONS] [-b BUILD_LOG] [TARGET_OPTION]
Debug an executable, core-file, or an existing process using the Eclipse
C/C++ Stand-alone Debugger.  Eclipse command-line options may be passed
except for -vmargs which is being used to start up the Eclipse Debugger.
Operation modes:
  -h, --help                print this help, then exit
Indexing assist options:
  -b BUILD_LOG              build log to use for compiler includes/flags
Target options:
  -a                        attach to an existing process (list will be shown) 
  -c COREFILE               debug core-file (should also specify executable)
  -e EXECUTABLE [ARGS...]   debug given executable (passing ARGS to main)
The -e option must be used last as subsequent options are passed to main.
Specifying insufficient arguments for a particular target will result in a
dialog displayed to enter the required values for that target.  Specifying
no target option brings up a dialog for debugging an executable with the
executable path, program arguments, and build log filled in from the last -e
invocation, if one exists.
Wiki page: <http://wiki.eclipse.org/CDT/StandaloneDebugger>

The Standalone Debugger is designed to make debugging easier for the C/C++ developer that has little to no experience with Eclipse.

Normally, to use the C/C++ tools in Eclipse, a user needs to set up an Eclipse project. The project has natures which dictates various menus and actions that are appropriate for the project. For C/C++, there are multiple natures that may apply due to the fact that there are multiple ways such a project may be built (e.g. an Autotools vs a project which maintains its own Makefile). Rather than impose the Eclipse project model on the end-user that just wishes to debug, the Standalone Debugger automatically creates a project on behalf of the end-user. As mentioned, the Standalone Debugger only loads a subset of the CDT plug-ins pertaining to debugging and build plug-ins are not included in this list. Thus, the Standalone debugger does not have to be concerned with adding natures pertaining to build and can default the project type on behalf of the end-user.

In addition, to debug an application, or an attached process, or a core-file, a user would normally have to set up an Eclipse launch configuration. Launch configurations store all the information required to launch an application such as what application is being launched, parameters passed, environment variables, etc... In the case of a debug launch configuration this includes what debugger is used and parameters to the debugger itself. Launch configurations can have different types based on what is being launched. Rather than force an end-user to deal with this, the Standalone Debugger creates a launch configuration on behalf of the end-user based on the command-line parameters used. As well, the debug session is automatically started so the end-user basically just has to start debugging which is fairly intuitive in the Eclipse IDE.

StandaloneDebuggerScreenshot.png

How to try it out

  1. Download the IDE for C/C++ Developers Luna M7 product tar file
  2. Untar the C/C++ IDE into a local directory (let's call this $CPP_LUNA_M7_DIR)
  3. cd $CPP_LUNA_M7_DIR/eclipse/plugins/org.eclipse.cdt.debug.application_1.0.0.201405061918/scripts
  4. Run the command:
    • sh ./install.sh
    • this will create the directory: $HOME/cdtdebugger for you and fill it appropriately
  5. To run the debugger:
    • $HOME/cdtdebugger/cdtdebug.sh [-data workspace] [-consoleLog] -a | [-b build_log_location] [-c core_file_location] [-e executable_path] [arg1 ... argn]
    • this will default to workspace-gdbstandalone if you do not specifiy a workspace via the -data option
    • if you run with no arguments, it will debug the same executable you ran the last time
    • if you specify a core file, you must also specify an executable
    • the cdtdebug command can be moved from $HOME/cdtdebugger if you wish

Status

Sept 17, 2013

  • first pass at standalone GDB debugger using CDT components
  • using Eclipse application and restricting plug-ins used
  • debugger is working but indexer is not being invoked
  • header files not being recognized

Sept 23, 2013

  • added default GCC spec file LanguageSettingsProvider
  • this gets standard header files to open in Outline view

Sept 30, 2013

  • added code to add all source files specified as Project resources
  • this gets indexer to work and adds non-C-standard header file support

Oct 07, 2013

  • Removed Source and Refactoring menus using IActivity filters

Oct 14, 2013

  • added support for reading .debug_macro section to find command-line flags
    • currently not being picked up by indexer for header files

Oct 21, 2013

  • added Dwarf4 support to CDT
    • code submitted upstream for review
  • solved issue with indexer using data discovered from .debug_macro
    • command line macros now discovered from modules compiled with -g3

Oct 28, 2013

  • changed code to clean-up if an executable is specified
    • running again with no executable specified will use the last launch
  • added support for specifying build console
    • build console is parsed for flags and include path settings

Nov 18, 2013

  • added progress dialog
  • added support for running via command-line script
    • fixed program argument parsing
    • figured out what minimally is needed to reuse repository
  • fixed some warnings and errors

Dec 20, 2013

  • added gdbstandalone.zip to run from command line with Luna M4 CPP EPP
  • added default jar to use with Eclipse Luna M4 CPP EPP
  • completed GDBStandalone.product which contains icons
  • added check for invalid executable
    • special dialog brought up to fix executable location and enter arguments
  • fixed NPE issue when running debugger 2nd time on same workspace

Jan 15, 2014

  • added New Executable dialog off of File menu to allow specification of different executable to debug
  • added Help doc support, but no docs enabled as of yet
  • added Customize Perspective from Window menu to allow enablement of Reverse Debugging and C/C++ Tracepoint support

Jan 17, 2014

  • added Help menu which contains Help Contents, Search, Dynamic Help, and About Eclipse items

Feb 07, 2014

  • added User Guide which is transformed CDT guide
  • added mnemonics for menus
  • updated for Luna M5

May 09, 2014

  • Standalone debugger is part of Luna M7
  • shipped with C/C++ EPP for Luna M7
  • includes installation script to install locally
  • includes core-file debugging support
  • includes attach to executable debugging support

Back to the top