+2019-08-15 Christian Biesinger <cbiesinger@google.com>
+
+ * python/lib/gdb/__init__.py (GdbOutputFile): Rename to have a
+ leading underscore.
+ (GdbOutputErrorFile): Likewise.
+ (global scope): Adjust constructor calls to GdbOutput{,Error}File
+ accordingly.
+ (execute_unwinders): Rename to have a leading underscore.
+ (auto_load_packages): Likewise.
+ (global scope): Adjust call to auto_load_packages accordingly.
+ (GdbSetPythonDirectory): Likewise.
+ * python/py-unwind.c (pyuw_sniffer): Call _execute_unwinders
+ instead of execute_unwinders.
+
2019-08-15 Tom Tromey <tom@tromey.com>
* tui/tui-layout.c (show_layout, show_source_disasm_command)
def flush(self):
flush()
-class GdbOutputFile (_GdbFile):
+class _GdbOutputFile (_GdbFile):
def write(self, s):
write(s, stream=STDOUT)
-sys.stdout = GdbOutputFile()
+sys.stdout = _GdbOutputFile()
-class GdbOutputErrorFile (_GdbFile):
+class _GdbOutputErrorFile (_GdbFile):
def write(self, s):
write(s, stream=STDERR)
-sys.stderr = GdbOutputErrorFile()
+sys.stderr = _GdbOutputErrorFile()
# Default prompt hook does nothing.
prompt_hook = None
# Initial frame unwinders.
frame_unwinders = []
-def execute_unwinders(pending_frame):
+def _execute_unwinders(pending_frame):
"""Internal function called from GDB to execute all unwinders.
Runs each currently enabled unwinder until it finds the one that
# manually iterate the list, collating the Python files in each module
# path. Construct the module name, and import.
-def auto_load_packages():
+def _auto_load_packages():
for package in packages:
location = os.path.join(os.path.dirname(__file__), package)
if os.path.exists(location):
except:
sys.stderr.write (traceback.format_exc() + "\n")
-auto_load_packages()
+_auto_load_packages()
def GdbSetPythonDirectory(dir):
"""Update sys.path, reload gdb and auto-load packages."""
# note that reload overwrites the gdb module without deleting existing
# attributes
reload(__import__(__name__))
- auto_load_packages()
+ _auto_load_packages()
def current_progspace():
"Return the current Progspace."
/* Run unwinders. */
if (gdb_python_module == NULL
- || ! PyObject_HasAttrString (gdb_python_module, "execute_unwinders"))
+ || ! PyObject_HasAttrString (gdb_python_module, "_execute_unwinders"))
{
PyErr_SetString (PyExc_NameError,
- "Installation error: gdb.execute_unwinders function "
+ "Installation error: gdb._execute_unwinders function "
"is missing");
gdbpy_print_stack ();
return 0;
}
gdbpy_ref<> pyo_execute (PyObject_GetAttrString (gdb_python_module,
- "execute_unwinders"));
+ "_execute_unwinders"));
if (pyo_execute == NULL)
{
gdbpy_print_stack ();
+2019-08-15 Christian Biesinger <cbiesinger@google.com>
+
+ * gdb.python/python.exp: Expect a leading underscore on
+ GdbOutput{,Error}File.
+
2019-08-15 Sandra Loosemore <sandra@codesourcery.com>
* gdb.dwarf2/dw2-dir-file-name.exp: Skip on remote or
gdb_test "python print (symtab\[1\]\[0\].pc)" "0" "test decode_line *0 pc"
# gdb.write
-gdb_test "python print (sys.stderr)" ".*gdb.GdbOutputErrorFile (instance|object) at.*" "test stderr location"
-gdb_test "python print (sys.stdout)" ".*gdb.GdbOutputFile (instance|object) at.*" "test stdout location"
+gdb_test "python print (sys.stderr)" ".*gdb._GdbOutputErrorFile (instance|object) at.*" "test stderr location"
+gdb_test "python print (sys.stdout)" ".*gdb._GdbOutputFile (instance|object) at.*" "test stdout location"
gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "test default write"
gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error stream" "test stderr write"
gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal stream" "test stdout write"