From 07ca107c2d958b45633ef0cdcce7219a95f0cf01 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Tue, 25 May 2010 15:27:17 +0000 Subject: Add python gdb.GdbError and gdb.string_to_argv. * NEWS: Document them. * python/py-cmd.c (cmdpy_function): Don't print a traceback if the exception is gdb.GdbError. Print a second traceback if there's an error computing the error message. (gdbpy_string_to_argv): New function. * python/py-utils.c (gdbpy_obj_to_string): New function. (gdbpy_exception_to_string): New function. * python/python-internal.h (gdbpy_string_to_argv): Declare. (gdbpy_obj_to_string, gdbpy_exception_to_string): Declare. (gdbpy_gdberror_exc): Declare. * python/python.c (gdbpy_gdberror_exc): New global. (_initialize_python): Initialize gdbpy_gdberror_exc and create gdb.GdbError. (GdbMethods): Add string_to_argv. doc/ * gdb.texinfo (Exception Handling): Document gdb.GdbError. (Commands In Python): Document gdb.string_to_argv. testsuite/ * gdb.python/py-cmd.exp: Add tests for gdb.GdbError and gdb.string_to_argv. --- gdb/python/python-internal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/python/python-internal.h') diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index f41f32a..bc07b5d 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -92,6 +92,7 @@ PyObject *gdbpy_block_for_pc (PyObject *self, PyObject *args); PyObject *gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw); PyObject *gdbpy_create_lazy_string_object (CORE_ADDR address, long length, const char *encoding, struct type *type); +PyObject *gdbpy_string_to_argv (PyObject *self, PyObject *args); PyObject *gdbpy_get_hook_function (const char *); PyObject *gdbpy_parameter (PyObject *self, PyObject *args); PyObject *gdbpy_parameter_value (enum var_types type, void *var); @@ -179,6 +180,9 @@ PyObject *python_string_to_target_python_string (PyObject *obj); char *python_string_to_host_string (PyObject *obj); PyObject *target_string_to_unicode (const gdb_byte *str, int length); int gdbpy_is_string (PyObject *obj); +char *gdbpy_obj_to_string (PyObject *obj); +char *gdbpy_exception_to_string (PyObject *ptype, PyObject *pvalue); + int gdbpy_is_lazy_string (PyObject *result); gdb_byte *gdbpy_extract_lazy_string (PyObject *string, struct type **str_type, @@ -197,4 +201,6 @@ extern PyObject *gdbpy_children_cst; extern PyObject *gdbpy_to_string_cst; extern PyObject *gdbpy_display_hint_cst; +extern PyObject *gdbpy_gdberror_exc; + #endif /* GDB_PYTHON_INTERNAL_H */ -- cgit v1.1