top bar

Difference between revisions of "Debugging MM on MacOSX and Unix"

(Using NetBeans with gdb for C++ debugging)
(Using NetBeans with gdb for C++ debugging)
Line 21: Line 21:
 
==Using NetBeans with gdb for C++ debugging==
 
==Using NetBeans with gdb for C++ debugging==
  
# Install NetBeans for C++ or install the C/C++ plugin for in your existing NetBeans installation.
+
<ol>
# Choose File > New Project... . Select Categories=C/C++, Projects=C/C++ Project with Existing Sources.
+
<li>Install NetBeans for C++ or install the C/C++ plugin for in your existing NetBeans installation.</li>
# Specifiy the folder that contains existing sources (e.g., '''/projects/micromanager/''') and press "Finish."
+
<li>Choose File > New Project... . Select Categories=C/C++, Projects=C/C++ Project with Existing Sources.</li>
# Right-click the new project and select "Properties".
+
<li>Specifiy the folder that contains existing sources (e.g., '''/projects/micromanager/''') and press "Finish."</li>
# Under Build...Make, Set Build Command to "make all; make install" and "Clean Command" to "make clean". Set Build Result to '''<your_ImageJ_directory>/ImageJ.app/Contents/MacOS/JavaApplicationStub''' .
+
<li>Right-click the new project and select "Properties".</li>
# Add the following option to the '''netbeans_default_options="..."''' line of '''/Applications/NetBeans/NetBeans\ 6.8.app/Contents/Resources/NetBeans/netbeans.conf''' :<pre>-J-Dgdb.init.enable=true</pre>
+
<li>Under Build...Make, Set Build Command to "make all; make install" and "Clean Command" to "make clean". Set Build Result to '''<your_ImageJ_directory>/ImageJ.app/Contents/MacOS/JavaApplicationStub''' .</li>
# Create a '''.gdbinit''' file in '''~''' that informs gdb of the directories of all '''.cpp''' and '''.h''' source files you might wish to debug:
+
<li>Add the following option to the '''netbeans_default_options="..."''' line of '''/Applications/NetBeans/NetBeans\ 6.8.app/Contents/Resources/NetBeans/netbeans.conf''' :<pre>-J-Dgdb.init.enable=true</pre></li>
<pre>directory /projects/micromanager/
+
<li> Create a '''.gdbinit''' file in '''~''' that informs gdb of the directories of all '''.cpp''' and '''.h''' source files you might wish to debug:<pre>directory /projects/micromanager/
 
directory /projects/micromanager/MMCore
 
directory /projects/micromanager/MMCore
 
directory /projects/micromanager/MMDevice
 
directory /projects/micromanager/MMDevice
directory /projects/micromanager/DeviceAdapters/DemoCamera</pre>
+
directory /projects/micromanager/DeviceAdapters/DemoCamera
# Launch ImageJ (the Micro-Manager make install)
+
</pre></li>
# Select Debug...Attach debugger.
+
<li>Launch ImageJ (the Micro-Manager make install)</li>
 +
<li>Select Debug...Attach debugger.</li>
 +
</ol>

Revision as of 20:27, 20 April 2010

Using gdb

Debugging of the C++ code on Mac and Unix can proceed as follows:

cd to your ImageJ directory that contains a self-starting Micro-Manager plugin:

   cd ~/ImageJ

Start gdb debugging java:

   $ gdb -arch i386 java

Now tell java on gdb to run ImageJ:

  (gdb) r -cp ij.jar ij.ImageJ

Control-C can interrupt execution.

Please refer to the gdb documentation for debugging commands.

Using NetBeans with gdb for C++ debugging

  1. Install NetBeans for C++ or install the C/C++ plugin for in your existing NetBeans installation.
  2. Choose File > New Project... . Select Categories=C/C++, Projects=C/C++ Project with Existing Sources.
  3. Specifiy the folder that contains existing sources (e.g., /projects/micromanager/) and press "Finish."
  4. Right-click the new project and select "Properties".
  5. Under Build...Make, Set Build Command to "make all; make install" and "Clean Command" to "make clean". Set Build Result to <your_ImageJ_directory>/ImageJ.app/Contents/MacOS/JavaApplicationStub .
  6. Add the following option to the netbeans_default_options="..." line of /Applications/NetBeans/NetBeans\ 6.8.app/Contents/Resources/NetBeans/netbeans.conf :
    -J-Dgdb.init.enable=true
  7. Create a .gdbinit file in ~ that informs gdb of the directories of all .cpp and .h source files you might wish to debug:
    directory /projects/micromanager/
    directory /projects/micromanager/MMCore
    directory /projects/micromanager/MMDevice
    directory /projects/micromanager/DeviceAdapters/DemoCamera
    
  8. Launch ImageJ (the Micro-Manager make install)
  9. Select Debug...Attach debugger.
© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact