Search code examples
eclipseeclipse-plugineclipse-cdt

Eclipse CDT Custom Debugger


I would like to extend the debugger of eclipse cdt so that it is able to skip lines with a specified line number by default (step).

I was wondering what could be extended to do so, because I don't need to write a complete new debugger, the c/c++ functionallity is as good as it is.


Solution

  • This is a very broad question, so I provide some starting points for you so you can narrow down your question a bit.

    DSF-GDB

    The C/C++ Debugger in Eclipse is provided by CDT's DSF (Debug Services Framework). DSF is an amazing, but complicated asynchronous framework to write debuggers in. DSF-GDB is the implementation of DSF for GDB debuggers.

    1. I recommend starting with the DSF Tutorial
    2. Try to use the DSF-GDB custom extended example plug-in org.eclipse.cdt.examples.dsf.gdb
    3. Have a look at How to extend DSF-GDB
    4. If you have specific lines in C code, you will need to be aware and make your users aware of the limitations regarding compiler optimizations. e.g. if you write:
    int x = 2
    x++;
    x++;
    

    and expect to be able to run line 1 and 3 and skip 2, then you are going to have to get involved with the compiler, not just the debugger as the compiler will normally optimize the above to essentially int x = 4.

    CDI Debugger

    The CDI Debugger, aka the older pre-DSF CDT debugger is expected to be removed in CDT 9.0 scheduled for release in June 2016. The CDI Debugger is associated with the org.eclipse.cdt.debug.core.CDebugger extension point. See the message from the CDT co-leads Marc and Doug and the wiki entry. Therefore do not base new development work on CDI.