{ "info": { "author": "Antonio Cuni", "author_email": "anto.cuni@gmail.com", "bugtrack_url": null, "classifiers": [], "description": ".. -*- restructuredtext -*-\n\npygdb2: control GDB from within the Python program being debugged\n==================================================================\n\n``pygdb2`` is a python module which allows you to send commands to the\nunderlying ``gdb`` process. For example, it can be used to automatically and\nprogrammatically add breakpoints and watchpoints.\n\nHow to install\n--------------\n\nMake sure that ``pygdb2`` is installed::\n\n $ pip install pygdb2\n\nThen, you need to activate the GDB integration by putting this line inside\nyour ``~/.gdbinit``::\n\n python import pygdb2\n\n\nHow to use it\n--------------\n\nYou need to launch your python program inside ``gdb`` using the special\n``pyrun`` command::\n\n $ gdb --args python myscript.py\n ...\n (gdb) pyrun\n ...\n\nFrom the python program, you can use ``pygdb2.set_trace()`` to enter the ``gdb``\nprompt, or ``pygdb2.execute()`` to send commands to ``gdb``.\n\nAt the ``(gdb)`` prompt, it is possible to invoke the ``pdb`` command to enter\nin the corresponding debugger at the Python level.\n\n\nExample\n-------\n\nFor example, the following code adds a watchpoint for a particular\nregion of memory created with ``ctypes``::\n\n import ctypes\n import pygdb2\n\n def main():\n buf = ctypes.c_int()\n buf.value = 42\n adr = ctypes.cast(ctypes.pointer(buf), ctypes.c_void_p)\n # enter gdb when we write to this memory\n pygdb2.execute(\"watch *(int*)%d\" % adr.value)\n\n i = 0\n while i < 5:\n print i\n i += 1\n if i == 2:\n buf.value = 43 # GDB stops here\n\nHere is an example of a gdb/pdb session::\n\n $ gdb --args python set_watchpoint.py\n ...\n (gdb) # lines prefixed \"pygdb2:\" contain the command coming from pygdb2.execute()\n (gdb) pyrun\n ...\n pygdb2: watch *(int*)14079984\n Hardware watchpoint 1: *(int*)14079984\n 0\n 1\n Hardware watchpoint 1: *(int*)14079984\n\n Old value = 42\n New value = 43\n i_set (ptr=0xd6d7f0, value=, size=4) at /build/buildd/python2.7-2.7.1/Modules/_ctypes/cfield.c:663\n 663\t/build/buildd/python2.7-2.7.1/Modules/_ctypes/cfield.c: No such file or directory.\n in /build/buildd/python2.7-2.7.1/Modules/_ctypes/cfield.c\n\n (gdb) # now we are debugging at the C level\n (gdb) # in particular, we are inside function of _ctypes\n (gdb) # which sets the value of the buffer\n\n (gdb) # Let's jump to the Python level\n (gdb) pdb\n Signal received, entering pdb\n Traceback:\n File \"set_watchpoint.py\", line 20, in \n main()\n File \"set_watchpoint.py\", line 16, in main\n buf.value = 43 # we should enter gdb here\n > /home/antocuni/env/src/pygdb2/pygdb2/test/set_watchpoint.py(12)main()\n -> while i < 5:\n (Pdb++) print i\n 2\n (Pdb++) c\n 2\n 3\n 4\n\n Program exited normally.\n (gdb) q\n\n\n\nUsing signals\n-----------------\n\n``pygdb2`` uses both ``SIGUSR1`` and ``SIGUSR2`` to communicate with ``gdb``,\nso if your program also needs those, you might have conflicts.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/antocuni/pygdb2/", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "pygdb2", "package_url": "https://pypi.org/project/pygdb2/", "platform": "unix,linux", "project_url": "https://pypi.org/project/pygdb2/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.org/antocuni/pygdb2/" }, "release_url": "https://pypi.org/project/pygdb2/0.1/", "requires_dist": null, "requires_python": null, "summary": "Control GDB from within the Python program being debugged", "version": "0.1" }, "last_serial": 704891, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "22f8163cfbbbc29fd21e8a53dd12caa9", "sha256": "2a35f5a25ca7bb18c03dfd4a0ff94798ab613faedf3f4015c2d162a9e26a3c61" }, "downloads": -1, "filename": "pygdb2-0.1.tar.gz", "has_sig": false, "md5_digest": "22f8163cfbbbc29fd21e8a53dd12caa9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3533, "upload_time": "2011-07-12T17:00:55", "url": "https://files.pythonhosted.org/packages/4d/06/6c8ad759e3fbc07f064071db9ff306cc6cd2546daa56dc868c788a624b77/pygdb2-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "22f8163cfbbbc29fd21e8a53dd12caa9", "sha256": "2a35f5a25ca7bb18c03dfd4a0ff94798ab613faedf3f4015c2d162a9e26a3c61" }, "downloads": -1, "filename": "pygdb2-0.1.tar.gz", "has_sig": false, "md5_digest": "22f8163cfbbbc29fd21e8a53dd12caa9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3533, "upload_time": "2011-07-12T17:00:55", "url": "https://files.pythonhosted.org/packages/4d/06/6c8ad759e3fbc07f064071db9ff306cc6cd2546daa56dc868c788a624b77/pygdb2-0.1.tar.gz" } ] }