Skip to content

Support and document debugging with gdbgui#887

Merged
TheJJ merged 1 commit into
SFTtech:masterfrom
arialwhite:gdb-frontend
Aug 24, 2017
Merged

Support and document debugging with gdbgui#887
TheJJ merged 1 commit into
SFTtech:masterfrom
arialwhite:gdb-frontend

Conversation

@arialwhite

Copy link
Copy Markdown
Contributor

I figured out how to debug libopenage with gdbgui. It is a browser-based frontend to gdb built with Python and JavaScript.

gdbgui: https://github.com/cs01/gdbgui

This PR:

  • Add a .gdbinit (gdb commands) to debug openage and break at main.cpp
  • Document how to debug openage and how to do this with gdbgui

gdbgui3

@TheJJ TheJJ added nice new thing ☺ A new feature that was not there before documentation Involves the project documentation labels Aug 20, 2017
@arialwhite arialwhite force-pushed the gdb-frontend branch 2 times, most recently from 22e74c8 to 6a4240a Compare August 20, 2017 18:32

@TheJJ TheJJ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for your additions.
I wouldn't add the .gdbinit file. I would instead write a code block in the debugging documentation that this could be done. If ever, we should put that file to etc/gdbinit, but it will outdate there once the linenumbers change.
The best place is a "recommendation" in the debug.md.

We create a run executable which is a compiled version of run.py, which also embeds the interpreter. This allows to easily run gdb -ex 'set breakpoint pending on' -ex 'b openage::run_game' -ex run --args run game (which could be the recommended command line in the debug.md file or a -x command file).

-> I think it's better do not commit the .gdbinit file

Do you have other suggestions?

@arialwhite

arialwhite commented Aug 21, 2017

Copy link
Copy Markdown
Contributor Author

Thanks for the review I agree with you and will do some changes.

I have also tried to use python3-dbg instead of python3 to be able to do this:
https://wiki.python.org/moin/DebuggingWithGdb

But this looks not very useful, and I am currently blocked by the '_imaging' module of python3-pil.

I tried also on a dummy Cython project:
http://cython.readthedocs.io/en/latest/src/userguide/debugging.html

I would be nice to debug Cython code, but it looks to be a difficult task on a real project

@arialwhite arialwhite force-pushed the gdb-frontend branch 2 times, most recently from 5c6a69c to c764c62 Compare August 21, 2017 20:32

@TheJJ TheJJ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)
I fear you need to do a quick rebase to solve the conflict in copying.md.

@TheJJ

TheJJ commented Aug 24, 2017

Copy link
Copy Markdown
Member

In my setup I can debug cython and python code. My setup is mainly this (I wrote large parts of the article): https://wiki.gentoo.org/wiki/Debugging

So I have (relevant for openage):

sys-libs/glibc installsources debugsyms
dev-libs/libuv debugsyms installsources
media-libs/libsdl2 installsources debugsyms
media-libs/libepoxy installsources debugsyms
dev-lang/python installsources debugsyms
media-libs/opusfile installsources debugsyms

Most importantly, python is built with debug infos and source files are provided.
Python also installs gdb helper functions like py-bt and the like, or py-print, which you can use to examine stacktraces with python-vm calls (as described in the DebuggingWithGdb wiki page)

I've never used cython --gdb so far, but it seems like this would be rather easy to add to the buildsystem.

My debugging setup uses gdb and voltron and I just launch the run program, set a breakpoint or use our BREAKPOINT macro, that's it.

@arialwhite

Copy link
Copy Markdown
Contributor Author

Thanks for your reply, I rebased my branch.

I was not aware of voltron it looks to be a great tool.

@TheJJ TheJJ merged commit 11fe3a3 into SFTtech:master Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Involves the project documentation nice new thing ☺ A new feature that was not there before

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants