|
|
|
NavigationPersonal tools |
Debugging with Anjuta
[edit] Prepare the environmentYou 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. ssh -X <remote_computer> anjuta [edit] Creating an Anjuta projectCurrently 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[1]. Simply download and save it into the e17/apps/e folder. Then start Anjuta and open this project file. [edit] Attaching to the enlightenment processFor 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". 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(). [edit] Stepping through the source codeAfter 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 remote computer breaks into this function. 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. [edit] EpilogueIn 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. |