[gobject-introspection/wip/dieterv/drive-by-review: 3/13] tools: add support for PyDev remote debugger.
- From: Dieter Verfaillie <dieterv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/dieterv/drive-by-review: 3/13] tools: add support for PyDev remote debugger.
- Date: Thu, 25 Jun 2015 20:25:05 +0000 (UTC)
commit 97a17861287b9ebb4f60d7d045fa2ab9b4a9060a
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Mon Mar 19 08:29:28 2012 +0100
tools: add support for PyDev remote debugger.
HACKING | 14 ++++++++++++++
tools/g-ir-annotation-tool.in | 21 +++++++++++++++------
tools/g-ir-doc-tool.in | 21 +++++++++++++++------
tools/g-ir-scanner.in | 21 +++++++++++++++------
4 files changed, 59 insertions(+), 18 deletions(-)
---
diff --git a/HACKING b/HACKING
index f951205..b5c9c81 100644
--- a/HACKING
+++ b/HACKING
@@ -8,6 +8,20 @@ debugging
* You can use the GI_SCANNER_DEBUG environment variable; see utils.py
for a list of debug flags.
+* It is possible to debug the various g-ir-* tools using PyDev's remote debugger.
+ To do this:
+ - locate the directory that contains the pydevd.py file matching the PyDev version
+ running in your Eclipse instance. This might look like:
+ /usr/lib64/eclipse/dropins/pydev-core/eclipse/plugins/org.python.pydev_4.0.0.201505131500/pysrc/)
+ - open the "Debug" perspective in your Eclipse instance, open the "PyDev" menu and start the
+ debug server
+ - execute the g-ir-* tool setting the GI_SCANNER_DEBUG and PYDEVDPATH environment variables.
+ For example:
+ GI_SCANNER_DEBUG="pydevd"
PYDEVDPATH="/usr/lib64/eclipse/dropins/pydev-core/eclipse/plugins/org.python.pydev_4.0.0.201505131500/pysrc/"
g-ir-scanner <parameters>
+ - In the example above, the PyDev debugger will run g-ir-scanner and stop execution in the main
+ script. You can then set extra breakpoints, step through the code, inspect variables at the
+ current scope, inspect the stack and so forth.
+
giscanner
---------
diff --git a/tools/g-ir-annotation-tool.in b/tools/g-ir-annotation-tool.in
index 811e915..cf17a23 100755
--- a/tools/g-ir-annotation-tool.in
+++ b/tools/g-ir-annotation-tool.in
@@ -24,12 +24,21 @@ import sys
import __builtin__
-if 'GI_SCANNER_DEBUG' in os.environ:
- def on_exception(exctype, value, tb):
- print "Caught exception: %r %r" % (exctype, value)
- import pdb
- pdb.pm()
- sys.excepthook = on_exception
+debug = os.getenv('GI_SCANNER_DEBUG', '').split(',')
+if debug:
+ if 'pydevd' in debug:
+ # http://pydev.org/manual_adv_remote_debugger.html
+ pydevdpath = os.getenv('PYDEVDPATH', None)
+ if pydevdpath is not None and os.path.isdir(pydevdpath):
+ sys.path.insert(0, pydevdpath)
+ import pydevd
+ pydevd.settrace()
+ else:
+ def on_exception(exctype, value, tb):
+ print "Caught exception: %r %r" % (exctype, value)
+ import pdb
+ pdb.pm()
+ sys.excepthook = on_exception
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
diff --git a/tools/g-ir-doc-tool.in b/tools/g-ir-doc-tool.in
index db389ba..e3bf8a3 100644
--- a/tools/g-ir-doc-tool.in
+++ b/tools/g-ir-doc-tool.in
@@ -24,12 +24,21 @@ import sys
import __builtin__
-if 'GI_SCANNER_DEBUG' in os.environ:
- def on_exception(exctype, value, tb):
- print "Caught exception: %r %r" % (exctype, value)
- import pdb
- pdb.pm()
- sys.excepthook = on_exception
+debug = os.getenv('GI_SCANNER_DEBUG', '').split(',')
+if debug:
+ if 'pydevd' in debug:
+ # http://pydev.org/manual_adv_remote_debugger.html
+ pydevdpath = os.getenv('PYDEVDPATH', None)
+ if pydevdpath is not None and os.path.isdir(pydevdpath):
+ sys.path.insert(0, pydevdpath)
+ import pydevd
+ pydevd.settrace()
+ else:
+ def on_exception(exctype, value, tb):
+ print "Caught exception: %r %r" % (exctype, value)
+ import pdb
+ pdb.pm()
+ sys.excepthook = on_exception
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
diff --git a/tools/g-ir-scanner.in b/tools/g-ir-scanner.in
index 420d435..7b2c568 100755
--- a/tools/g-ir-scanner.in
+++ b/tools/g-ir-scanner.in
@@ -24,12 +24,21 @@ import sys
import __builtin__
-if 'GI_SCANNER_DEBUG' in os.environ:
- def on_exception(exctype, value, tb):
- print "Caught exception: %r %r" % (exctype, value)
- import pdb
- pdb.pm()
- sys.excepthook = on_exception
+debug = os.getenv('GI_SCANNER_DEBUG', '').split(',')
+if debug:
+ if 'pydevd' in debug:
+ # http://pydev.org/manual_adv_remote_debugger.html
+ pydevdpath = os.getenv('PYDEVDPATH', None)
+ if pydevdpath is not None and os.path.isdir(pydevdpath):
+ sys.path.insert(0, pydevdpath)
+ import pydevd
+ pydevd.settrace()
+ else:
+ def on_exception(exctype, value, tb):
+ print "Caught exception: %r %r" % (exctype, value)
+ import pdb
+ pdb.pm()
+ sys.excepthook = on_exception
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]