diff options
author | khooyp <khooyp> | 2012-09-13 21:49:29 +0000 |
---|---|---|
committer | khooyp <khooyp> | 2012-09-13 21:49:29 +0000 |
commit | 6e1874fd9efaf65384d566d865e90f954e69e662 (patch) | |
tree | db57c1e3c03e30f1fe24ae9e3b58b50480142253 /gdb/python/python-internal.h | |
parent | 6d920fe0e94eb9def9dbe5f661312f4ec060860d (diff) | |
download | gdb-6e1874fd9efaf65384d566d865e90f954e69e662.tar.gz |
Refactor Python "gdb" module into a proper Python package, by introducing
a new "_gdb" module for code implemented in C, and using reload/__import__
instead of exec.
gdb/
* python/lib/gdb/__init__.py: Import * from _gdb.
(GdbOutputFile, sys.stdout, GdbOutputErrorFile, sys.stderr,
prompt_hook, sys.argv): Moved from finish_python_initialization.
(pretty_printers, PYTHONDIR): Moved from _initialize_python.
(packages, auto_load_packages): New list and function replacing
module_dict and auto-loading code, using __file__ instead of
gdb.PYTHONDIR and reload/__import__ instead of exec.
(GdbSetPythonDirectory): Replacing function of the same name
from finish_python_initialization, using reload/__import__ instead
of exec, as well as call auto_load_packages.
* python/py-prettyprint.c (find_pretty_printer_from_gdb): Check
gdb_python_module and not gdb_module.
* python/python-internal.h (gdb_python_module): Declare.
* python/python.c (gdb_python_module): New global.
(before_prompt_hook): Check gdb_python_module and not gdb_module.
(_initialize_python): Rename gdb module to _gdb.
Move gdb.PYTHONDIR and gdb.pretty_printer to lib/gdb/__init__.py.
(finish_python_initialization): Move Python code to
lib/gdb/__init__.py; instead, set up sys.path and import gdb into
__main__.
gdb/testsuite/
* gdb.python/python.exp (Test stderr location): Update module
location of GDB-specific sys.stderr.
(Test stdout location): Ditto for sys.stdout.
Diffstat (limited to 'gdb/python/python-internal.h')
-rw-r--r-- | gdb/python/python-internal.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index aa3678bc835..ee048600fa4 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -114,6 +114,7 @@ struct bpstats; struct inferior; extern PyObject *gdb_module; +extern PyObject *gdb_python_module; extern PyTypeObject value_object_type; extern PyTypeObject block_object_type; extern PyTypeObject symbol_object_type; |