Page MenuHomePhabricator

Debugging With Anjuta
Updated 2,290 Days AgoPublic

Prepare the environment

You should install Anjuta 2.3.3 for this way of debugging. It's not possible to start Anjuta in the same X session as Enlightenment. This is because if you stop the enlightenment binary you're not longer able to interact with the Anjuta windows. So one solution would be to use a second X-Server or start Enlightenment in Xnest. But both ways aren't tested at the moment. Feel free to add more information if you did some tests.

The most comfortable way is to use a second computer for remote debugging. It would be perfect to use gdbserver for remote debugging. This would also be great for embedded devices running Enlightenment. But the current version of Anjuta (2.3.3) doesn't yet support gdbserver. So our way of choose is to start Anjuta through a ssh connection from the second computer. (TODO: gdbserver was reported to work with recent Anjuta. This needs to be tried out!)

ssh -X <remote_computer> anjuta

Another solution is to use Xephyr to start a (second) E17 session.

#!/bin/sh

Xephyr -ac -screen 1024x768 :1 &

sleep 3s && /opt/e17/bin/enlightenment_start -display :1

Creating an Anjuta project

Currently the anjuta project files aren't included in the Enlightenment CVS. So you need to create a new project and import the existing e17/apps/e source tree. To ease this step I've created this project file. Simply download and save it into the e17/apps/e folder. Then start Anjuta and open this project file.

Attaching to the enlightenment process

For sure Enlightenment should be started on the debugging computer. Then start Anjuta as described above on the remote computer. Now attach to the enlightenment process with the command "Debug->Attach Process".

{F2278, size=full}

After attaching the enlightenment process stops initial. That is your chance to set some breakpoints and continue the debugging. For this example I set a breakpoint at the beginning of e_about_show().

Stepping through the source code

After preparing the environment and setting some breakpoints we could step through the code. Activate the about dialog in Enlightenment on the debugging computer. You see that Enlightenment instantly freeze and Anjuta on the breaks into this function.

{F2277, size=full}

You see on the screenshot that that gdb is in e_about_show() and the program counter stands now on the fourth line in this function.

-> if (w > mw) mw = w;

The window below shows the local variables in this context. You may browse through it or change them by clicking and typing new values. On the left you see an assembler window. If you give the focus to this window you're able to step through the assembler code.

Epilogue

In my experience Anjuta did a very big step forward for debugging applications and libraries. But it has still some bugs. It often helps to start Anjuta itself in a gdb session to have a meaningful backtrace in the case of an Anjuta crash. The Anjuta developers are very active and happy for each bug that you report into their bugzilla.

One drawback at the moment is that Anjuta kills the attached process after de-attaching. So don't end your Anjuta debugger session on the remote computer if you have unsaved applications in the debugging Enlightenment session running. But a bug for this exists and hopefully it will be fixed fast.

Imported from https://trac.enlightenment.org/e/wiki/DebuggingWithAnjuta
History:
1 andreasvolz 2009-04-19 05:37:56
2 andreasvolz 2009-04-19 05:40:24
3 andreasvolz 2009-04-19 05:46:47
4 andreasvolz 2009-04-19 05:47:52
5 andreasvolz 2009-04-19 05:52:17
6 andreasvolz 2009-04-19 05:55:17
7 buergi 2010-02-21 01:22:52 attached images from old wiki

Last Author
beber
Last Edited
Sep 1 2013, 3:24 PM
Projects
None
Subscribers
None