Remove trailing whitespace.

Whitespace cleanup.
	* python/py-breakpoint.c: Remove trailing whitespace.
	* python/py-cmd.c: Ditto.
	* python/py-evts.c: Ditto.
	* python/py-finishbreakpoint.c: Ditto.
	* python/py-frame.c: Ditto.
	* python/py-function.c: Ditto.
	* python/py-inferior.c: Ditto.
	* python/py-infthread.c: Ditto.
	* python/py-param.c: Ditto.
	* python/py-prettyprint.c: Ditto.
	* python/py-symbol.c: Ditto.
	* python/py-type.c: Ditto.
	* python/py-utils.c: Ditto.
	* python/py-value.c: Ditto.
	* python/python-internal.h: Ditto.
	* python/python.c: Ditto.
This commit is contained in:
Doug Evans 2013-11-29 12:00:47 -08:00
parent c9ae340d17
commit 256458bc0e
17 changed files with 126 additions and 106 deletions

View File

@ -1,3 +1,23 @@
2013-11-29 Doug Evans <xdje42@gmail.com>
Whitespace cleanup.
* python/py-breakpoint.c: Remove trailing whitespace.
* python/py-cmd.c: Ditto.
* python/py-evts.c: Ditto.
* python/py-finishbreakpoint.c: Ditto.
* python/py-frame.c: Ditto.
* python/py-function.c: Ditto.
* python/py-inferior.c: Ditto.
* python/py-infthread.c: Ditto.
* python/py-param.c: Ditto.
* python/py-prettyprint.c: Ditto.
* python/py-symbol.c: Ditto.
* python/py-type.c: Ditto.
* python/py-utils.c: Ditto.
* python/py-value.c: Ditto.
* python/python-internal.h: Ditto.
* python/python.c: Ditto.
2013-11-29 Pedro Alves <palves@redhat.com> 2013-11-29 Pedro Alves <palves@redhat.com>
* unwind_stop_reasons.def (UNWIND_NULL_ID): Update comment. * unwind_stop_reasons.def (UNWIND_NULL_ID): Update comment.

View File

@ -121,7 +121,7 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL) if (newvalue == NULL)
{ {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
_("Cannot delete `enabled' attribute.")); _("Cannot delete `enabled' attribute."));
return -1; return -1;
@ -160,7 +160,7 @@ bppy_set_silent (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL) if (newvalue == NULL)
{ {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
_("Cannot delete `silent' attribute.")); _("Cannot delete `silent' attribute."));
return -1; return -1;
} }
@ -191,7 +191,7 @@ bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL) if (newvalue == NULL)
{ {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
_("Cannot delete `thread' attribute.")); _("Cannot delete `thread' attribute."));
return -1; return -1;
} }
@ -202,7 +202,7 @@ bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure)
if (! valid_thread_id (id)) if (! valid_thread_id (id))
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Invalid thread ID.")); _("Invalid thread ID."));
return -1; return -1;
} }
@ -234,7 +234,7 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL) if (newvalue == NULL)
{ {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
_("Cannot delete `task' attribute.")); _("Cannot delete `task' attribute."));
return -1; return -1;
} }
@ -251,7 +251,7 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
if (! valid_id) if (! valid_id)
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Invalid task ID.")); _("Invalid task ID."));
return -1; return -1;
} }
@ -341,7 +341,7 @@ bppy_set_hit_count (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL) if (newvalue == NULL)
{ {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
_("Cannot delete `hit_count' attribute.")); _("Cannot delete `hit_count' attribute."));
return -1; return -1;
} }
@ -436,7 +436,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL) if (newvalue == NULL)
{ {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
_("Cannot delete `condition' attribute.")); _("Cannot delete `condition' attribute."));
return -1; return -1;
} }
@ -644,7 +644,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
bppy_pending_object = (gdbpy_breakpoint_object *) self; bppy_pending_object = (gdbpy_breakpoint_object *) self;
bppy_pending_object->number = -1; bppy_pending_object->number = -1;
bppy_pending_object->bp = NULL; bppy_pending_object->bp = NULL;
TRY_CATCH (except, RETURN_MASK_ALL) TRY_CATCH (except, RETURN_MASK_ALL)
{ {
char *copy = xstrdup (spec); char *copy = xstrdup (spec);
@ -805,7 +805,7 @@ gdbpy_breakpoint_has_py_cond (struct gdbpy_breakpoint_object *bp_obj)
struct gdbarch *garch = bp_obj->bp->gdbarch ? bp_obj->bp->gdbarch : struct gdbarch *garch = bp_obj->bp->gdbarch ? bp_obj->bp->gdbarch :
get_current_arch (); get_current_arch ();
struct cleanup *cleanup = ensure_python_env (garch, current_language); struct cleanup *cleanup = ensure_python_env (garch, current_language);
if (py_bp != NULL) if (py_bp != NULL)
has_func = PyObject_HasAttrString (py_bp, stop_func); has_func = PyObject_HasAttrString (py_bp, stop_func);
@ -829,9 +829,9 @@ gdbpy_breakpoint_created (struct breakpoint *bp)
if (bp->number < 0 && bppy_pending_object == NULL) if (bp->number < 0 && bppy_pending_object == NULL)
return; return;
if (bp->type != bp_breakpoint if (bp->type != bp_breakpoint
&& bp->type != bp_watchpoint && bp->type != bp_watchpoint
&& bp->type != bp_hardware_watchpoint && bp->type != bp_hardware_watchpoint
&& bp->type != bp_read_watchpoint && bp->type != bp_read_watchpoint
&& bp->type != bp_access_watchpoint) && bp->type != bp_access_watchpoint)
return; return;
@ -937,31 +937,31 @@ gdbpy_initialize_breakpoints (void)
PyObject_GenericSetAttr to allow extra validation of the attribute PyObject_GenericSetAttr to allow extra validation of the attribute
being set. */ being set. */
static int static int
local_setattro (PyObject *self, PyObject *name, PyObject *v) local_setattro (PyObject *self, PyObject *name, PyObject *v)
{ {
gdbpy_breakpoint_object *obj = (gdbpy_breakpoint_object *) self; gdbpy_breakpoint_object *obj = (gdbpy_breakpoint_object *) self;
char *attr = python_string_to_host_string (name); char *attr = python_string_to_host_string (name);
if (attr == NULL) if (attr == NULL)
return -1; return -1;
/* If the attribute trying to be set is the "stop" method, /* If the attribute trying to be set is the "stop" method,
but we already have a condition set in the CLI, disallow this but we already have a condition set in the CLI, disallow this
operation. */ operation. */
if (strcmp (attr, stop_func) == 0 && obj->bp->cond_string) if (strcmp (attr, stop_func) == 0 && obj->bp->cond_string)
{ {
xfree (attr); xfree (attr);
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Cannot set 'stop' method. There is an " \ _("Cannot set 'stop' method. There is an " \
"existing GDB condition attached to the " \ "existing GDB condition attached to the " \
"breakpoint.")); "breakpoint."));
return -1; return -1;
} }
xfree (attr); xfree (attr);
return PyObject_GenericSetAttr ((PyObject *)self, name, v); return PyObject_GenericSetAttr ((PyObject *)self, name, v);
} }
static PyGetSetDef breakpoint_object_getset[] = { static PyGetSetDef breakpoint_object_getset[] = {

View File

@ -308,14 +308,14 @@ cmdpy_completer (struct cmd_list_element *command,
/* Helper for cmdpy_init which locates the command list to use and /* Helper for cmdpy_init which locates the command list to use and
pulls out the command name. pulls out the command name.
NAME is the command name list. The final word in the list is the NAME is the command name list. The final word in the list is the
name of the new command. All earlier words must be existing prefix name of the new command. All earlier words must be existing prefix
commands. commands.
*BASE_LIST is set to the final prefix command's list of *BASE_LIST is set to the final prefix command's list of
*sub-commands. *sub-commands.
START_LIST is the list in which the search starts. START_LIST is the list in which the search starts.
This function returns the xmalloc()d name of the new command. On This function returns the xmalloc()d name of the new command. On
@ -464,16 +464,16 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
return -1; return -1;
pfx_name = NULL; pfx_name = NULL;
if (is_prefix != NULL) if (is_prefix != NULL)
{ {
cmp = PyObject_IsTrue (is_prefix); cmp = PyObject_IsTrue (is_prefix);
if (cmp == 1) if (cmp == 1)
{ {
int i, out; int i, out;
/* Make a normalized form of the command name. */ /* Make a normalized form of the command name. */
pfx_name = xmalloc (strlen (name) + 2); pfx_name = xmalloc (strlen (name) + 2);
i = 0; i = 0;
out = 0; out = 0;
while (name[i]) while (name[i])

View File

@ -26,7 +26,7 @@ static struct PyModuleDef EventModuleDef =
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"gdb.events", "gdb.events",
NULL, NULL,
-1, -1,
NULL, NULL,
NULL, NULL,
NULL, NULL,

View File

@ -185,7 +185,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
if (frame == NULL) if (frame == NULL)
{ {
PyErr_SetString (PyExc_ValueError, PyErr_SetString (PyExc_ValueError,
_("Invalid ID for the `frame' object.")); _("Invalid ID for the `frame' object."));
} }
else else
@ -232,9 +232,9 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
if (internal) if (internal)
{ {
internal_bp = PyObject_IsTrue (internal); internal_bp = PyObject_IsTrue (internal);
if (internal_bp == -1) if (internal_bp == -1)
{ {
PyErr_SetString (PyExc_ValueError, PyErr_SetString (PyExc_ValueError,
_("The value of `internal' must be a boolean.")); _("The value of `internal' must be a boolean."));
return -1; return -1;
} }
@ -303,10 +303,10 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
0, 1, internal_bp, 0); 0, 1, internal_bp, 0);
} }
GDB_PY_SET_HANDLE_EXCEPTION (except); GDB_PY_SET_HANDLE_EXCEPTION (except);
self_bpfinish->py_bp.bp->frame_id = frame_id; self_bpfinish->py_bp.bp->frame_id = frame_id;
self_bpfinish->py_bp.is_finish_bp = 1; self_bpfinish->py_bp.is_finish_bp = 1;
/* Bind the breakpoint with the current program space. */ /* Bind the breakpoint with the current program space. */
self_bpfinish->py_bp.bp->pspace = current_program_space; self_bpfinish->py_bp.bp->pspace = current_program_space;
@ -347,7 +347,7 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
struct breakpoint *bp_stopped = (struct breakpoint *) args; struct breakpoint *bp_stopped = (struct breakpoint *) args;
PyObject *py_bp = (PyObject *) b->py_bp_object; PyObject *py_bp = (PyObject *) b->py_bp_object;
struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch (); struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch ();
/* Trigger out_of_scope if this is a FinishBreakpoint and its frame is /* Trigger out_of_scope if this is a FinishBreakpoint and its frame is
not anymore in the current callstack. */ not anymore in the current callstack. */
if (py_bp != NULL && b->py_bp_object->is_finish_bp) if (py_bp != NULL && b->py_bp_object->is_finish_bp)
@ -412,11 +412,11 @@ gdbpy_initialize_finishbreakpoints (void)
{ {
if (PyType_Ready (&finish_breakpoint_object_type) < 0) if (PyType_Ready (&finish_breakpoint_object_type) < 0)
return -1; return -1;
if (gdb_pymodule_addobject (gdb_module, "FinishBreakpoint", if (gdb_pymodule_addobject (gdb_module, "FinishBreakpoint",
(PyObject *) &finish_breakpoint_object_type) < 0) (PyObject *) &finish_breakpoint_object_type) < 0)
return -1; return -1;
observer_attach_normal_stop (bpfinishpy_handle_stop); observer_attach_normal_stop (bpfinishpy_handle_stop);
observer_attach_inferior_exit (bpfinishpy_handle_exit); observer_attach_inferior_exit (bpfinishpy_handle_exit);

View File

@ -61,7 +61,7 @@ typedef struct {
struct frame_info * struct frame_info *
frame_object_to_frame_info (PyObject *obj) frame_object_to_frame_info (PyObject *obj)
{ {
frame_object *frame_obj = (frame_object *) obj; frame_object *frame_obj = (frame_object *) obj;
struct frame_info *frame; struct frame_info *frame;
frame = frame_find_by_id (frame_obj->frame_id); frame = frame_find_by_id (frame_obj->frame_id);
@ -583,7 +583,7 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
if (reason < UNWIND_FIRST || reason > UNWIND_LAST) if (reason < UNWIND_FIRST || reason > UNWIND_LAST)
{ {
PyErr_SetString (PyExc_ValueError, PyErr_SetString (PyExc_ValueError,
_("Invalid frame stop reason.")); _("Invalid frame stop reason."));
return NULL; return NULL;
} }

View File

@ -39,7 +39,7 @@ convert_values_to_python (int argc, struct value **argv)
{ {
int i; int i;
PyObject *result = PyTuple_New (argc); PyObject *result = PyTuple_New (argc);
if (! result) if (! result)
return NULL; return NULL;

View File

@ -274,7 +274,7 @@ delete_thread_object (struct thread_info *tp, int ignore)
struct cleanup *cleanup; struct cleanup *cleanup;
inferior_object *inf_obj; inferior_object *inf_obj;
struct threadlist_entry **entry, *tmp; struct threadlist_entry **entry, *tmp;
if (!gdb_python_initialized) if (!gdb_python_initialized)
return; return;
@ -559,9 +559,9 @@ get_buffer (PyObject *self, Py_buffer *buf, int flags)
{ {
membuf_object *membuf_obj = (membuf_object *) self; membuf_object *membuf_obj = (membuf_object *) self;
int ret; int ret;
ret = PyBuffer_FillInfo (buf, self, membuf_obj->buffer, ret = PyBuffer_FillInfo (buf, self, membuf_obj->buffer,
membuf_obj->length, 0, membuf_obj->length, 0,
PyBUF_CONTIG); PyBUF_CONTIG);
buf->format = "c"; buf->format = "c";
@ -647,7 +647,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
pattern_size = pybuf.len; pattern_size = pybuf.len;
#else #else
PyObject *pattern; PyObject *pattern;
if (! PyArg_ParseTupleAndKeywords (args, kw, "OOO", keywords, if (! PyArg_ParseTupleAndKeywords (args, kw, "OOO", keywords,
&start_addr_obj, &length_obj, &start_addr_obj, &length_obj,
&pattern)) &pattern))
@ -667,7 +667,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
if (get_addr_from_python (start_addr_obj, &start_addr) < 0) if (get_addr_from_python (start_addr_obj, &start_addr) < 0)
goto fail; goto fail;
if (get_addr_from_python (length_obj, &length) < 0) if (get_addr_from_python (length_obj, &length) < 0)
goto fail; goto fail;

View File

@ -95,7 +95,7 @@ thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore)
if (newvalue == NULL) if (newvalue == NULL)
{ {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
_("Cannot delete `name' attribute.")); _("Cannot delete `name' attribute."));
return -1; return -1;
} }

View File

@ -134,7 +134,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
&& (self->type == var_filename && (self->type == var_filename
|| value != Py_None)) || value != Py_None))
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("String required for filename.")); _("String required for filename."));
return -1; return -1;
@ -167,7 +167,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
if (! gdbpy_is_string (value)) if (! gdbpy_is_string (value))
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("ENUM arguments must be a string.")); _("ENUM arguments must be a string."));
return -1; return -1;
} }
@ -192,12 +192,12 @@ set_parameter_value (parmpy_object *self, PyObject *value)
case var_boolean: case var_boolean:
if (! PyBool_Check (value)) if (! PyBool_Check (value))
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("A boolean argument is required.")); _("A boolean argument is required."));
return -1; return -1;
} }
cmp = PyObject_IsTrue (value); cmp = PyObject_IsTrue (value);
if (cmp < 0) if (cmp < 0)
return -1; return -1;
self->value.intval = cmp; self->value.intval = cmp;
break; break;
@ -216,10 +216,10 @@ set_parameter_value (parmpy_object *self, PyObject *value)
{ {
cmp = PyObject_IsTrue (value); cmp = PyObject_IsTrue (value);
if (cmp < 0 ) if (cmp < 0 )
return -1; return -1;
if (cmp == 1) if (cmp == 1)
self->value.autoboolval = AUTO_BOOLEAN_TRUE; self->value.autoboolval = AUTO_BOOLEAN_TRUE;
else else
self->value.autoboolval = AUTO_BOOLEAN_FALSE; self->value.autoboolval = AUTO_BOOLEAN_FALSE;
} }
break; break;
@ -233,7 +233,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
if (! PyInt_Check (value)) if (! PyInt_Check (value))
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("The value must be integer.")); _("The value must be integer."));
return -1; return -1;
} }
@ -258,7 +258,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
if (! ok) if (! ok)
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Range exceeded.")); _("Range exceeded."));
return -1; return -1;
} }
@ -268,7 +268,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
} }
default: default:
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Unhandled type in parameter value.")); _("Unhandled type in parameter value."));
return -1; return -1;
} }
@ -580,7 +580,7 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values)
if (! PySequence_Check (enum_values)) if (! PySequence_Check (enum_values))
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("The enumeration is not a sequence.")); _("The enumeration is not a sequence."));
return 0; return 0;
} }
@ -590,7 +590,7 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values)
return 0; return 0;
if (size == 0) if (size == 0)
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("The enumeration is empty.")); _("The enumeration is empty."));
return 0; return 0;
} }
@ -612,7 +612,7 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values)
{ {
Py_DECREF (item); Py_DECREF (item);
do_cleanups (back_to); do_cleanups (back_to);
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("The enumeration item not a string.")); _("The enumeration item not a string."));
return 0; return 0;
} }

View File

@ -122,7 +122,7 @@ find_pretty_printer_from_objfiles (PyObject *value)
if (function != Py_None) if (function != Py_None)
return function; return function;
Py_DECREF (function); Py_DECREF (function);
} }
@ -225,7 +225,7 @@ pretty_print_one_value (PyObject *printer, struct value **out_value)
result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL); result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
if (result) if (result)
{ {
if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result) if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result)
&& result != Py_None) && result != Py_None)
{ {
*out_value = convert_value_from_python (result); *out_value = convert_value_from_python (result);
@ -549,7 +549,7 @@ print_children (PyObject *printer, const char *hint,
print_stack_unless_memory_error (stream); print_stack_unless_memory_error (stream);
/* Set a flag so we can know whether we printed all the /* Set a flag so we can know whether we printed all the
available elements. */ available elements. */
else else
done_flag = 1; done_flag = 1;
break; break;
} }
@ -729,7 +729,7 @@ apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
val_obj = value_to_value_object (value); val_obj = value_to_value_object (value);
if (! val_obj) if (! val_obj)
goto done; goto done;
/* Find the constructor. */ /* Find the constructor. */
printer = find_pretty_printer (val_obj); printer = find_pretty_printer (val_obj);
Py_DECREF (val_obj); Py_DECREF (val_obj);
@ -790,7 +790,7 @@ apply_varobj_pretty_printer (PyObject *printer_obj,
/* Find a pretty-printer object for the varobj module. Returns a new /* Find a pretty-printer object for the varobj module. Returns a new
reference to the object if successful; returns NULL if not. VALUE reference to the object if successful; returns NULL if not. VALUE
is the value for which a printer tests to determine if it is the value for which a printer tests to determine if it
can pretty-print the value. */ can pretty-print the value. */
PyObject * PyObject *
gdbpy_get_varobj_pretty_printer (struct value *value) gdbpy_get_varobj_pretty_printer (struct value *value)
@ -804,7 +804,7 @@ gdbpy_get_varobj_pretty_printer (struct value *value)
value = value_copy (value); value = value_copy (value);
} }
GDB_PY_HANDLE_EXCEPTION (except); GDB_PY_HANDLE_EXCEPTION (except);
val_obj = value_to_value_object (value); val_obj = value_to_value_object (value);
if (! val_obj) if (! val_obj)
return NULL; return NULL;
@ -830,7 +830,7 @@ gdbpy_default_visualizer (PyObject *self, PyObject *args)
value = value_object_to_value (val_obj); value = value_object_to_value (val_obj);
if (! value) if (! value)
{ {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
_("Argument must be a gdb.Value.")); _("Argument must be a gdb.Value."));
return NULL; return NULL;
} }

View File

@ -270,7 +270,7 @@ sympy_value (PyObject *self, PyObject *args)
if (frame_info == NULL) if (frame_info == NULL)
error (_("invalid frame")); error (_("invalid frame"));
} }
if (symbol_read_needs_frame (symbol) && frame_info == NULL) if (symbol_read_needs_frame (symbol) && frame_info == NULL)
error (_("symbol requires a frame to compute its value")); error (_("symbol requires a frame to compute its value"));

View File

@ -303,7 +303,7 @@ make_fielditem (struct type *type, int i, enum gdbpy_iter_kind kind)
gdb_assert_not_reached ("invalid gdbpy_iter_kind"); gdb_assert_not_reached ("invalid gdbpy_iter_kind");
} }
return item; return item;
fail: fail:
Py_XDECREF (key); Py_XDECREF (key);
Py_XDECREF (value); Py_XDECREF (value);
@ -356,7 +356,7 @@ typy_values (PyObject *self, PyObject *args)
} }
/* Return a sequence of all fields. Each field is a gdb.Field object. /* Return a sequence of all fields. Each field is a gdb.Field object.
This method is similar to typy_values, except where the supplied This method is similar to typy_values, except where the supplied
gdb.Type is an array, in which case it returns a list of one entry gdb.Type is an array, in which case it returns a list of one entry
which is a gdb.Field object for a range (the array bounds). */ which is a gdb.Field object for a range (the array bounds). */
@ -365,7 +365,7 @@ typy_fields (PyObject *self, PyObject *args)
{ {
struct type *type = ((type_object *) self)->type; struct type *type = ((type_object *) self)->type;
PyObject *r, *rl; PyObject *r, *rl;
if (TYPE_CODE (type) != TYPE_CODE_ARRAY) if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
return typy_fields_items (self, iter_values); return typy_fields_items (self, iter_values);
@ -375,7 +375,7 @@ typy_fields (PyObject *self, PyObject *args)
r = convert_field (type, 0); r = convert_field (type, 0);
if (r == NULL) if (r == NULL)
return NULL; return NULL;
rl = Py_BuildValue ("[O]", r); rl = Py_BuildValue ("[O]", r);
Py_DECREF (r); Py_DECREF (r);
@ -390,7 +390,7 @@ typy_field_names (PyObject *self, PyObject *args)
return typy_fields_items (self, iter_keys); return typy_fields_items (self, iter_keys);
} }
/* Return a sequence of all (name, fields) pairs. Each field is a /* Return a sequence of all (name, fields) pairs. Each field is a
gdb.Field object. */ gdb.Field object. */
static PyObject * static PyObject *
@ -450,7 +450,7 @@ typy_get_composite (struct type *type)
/* If this is not a struct, union, or enum type, raise TypeError /* If this is not a struct, union, or enum type, raise TypeError
exception. */ exception. */
if (TYPE_CODE (type) != TYPE_CODE_STRUCT if (TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_UNION && TYPE_CODE (type) != TYPE_CODE_UNION
&& TYPE_CODE (type) != TYPE_CODE_ENUM) && TYPE_CODE (type) != TYPE_CODE_ENUM)
{ {
@ -458,7 +458,7 @@ typy_get_composite (struct type *type)
"Type is not a structure, union, or enum type."); "Type is not a structure, union, or enum type.");
return NULL; return NULL;
} }
return type; return type;
} }
@ -602,7 +602,7 @@ typy_range (PyObject *self, PyObject *args)
return NULL; return NULL;
} }
return result; return result;
failarg: failarg:
Py_XDECREF (high_bound); Py_XDECREF (high_bound);
Py_XDECREF (low_bound); Py_XDECREF (low_bound);
@ -633,7 +633,7 @@ typy_target (PyObject *self, PyObject *args)
if (!TYPE_TARGET_TYPE (type)) if (!TYPE_TARGET_TYPE (type))
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Type does not have a target.")); _("Type does not have a target."));
return NULL; return NULL;
} }
@ -774,12 +774,12 @@ typy_lookup_type (struct demangle_component *demangled,
} }
GDB_PY_HANDLE_EXCEPTION (except); GDB_PY_HANDLE_EXCEPTION (except);
} }
/* If we have a type from the switch statement above, just return /* If we have a type from the switch statement above, just return
that. */ that. */
if (rtype) if (rtype)
return rtype; return rtype;
/* We don't have a type, so lookup the type. */ /* We don't have a type, so lookup the type. */
type_name = cp_comp_to_string (demangled, 10); type_name = cp_comp_to_string (demangled, 10);
type = typy_lookup_typename (type_name, block); type = typy_lookup_typename (type_name, block);
@ -1088,7 +1088,7 @@ typy_length (PyObject *self)
} }
/* Implements boolean evaluation of gdb.Type. Handle this like other /* Implements boolean evaluation of gdb.Type. Handle this like other
Python objects that don't have a meaningful truth value -- all Python objects that don't have a meaningful truth value -- all
values are true. */ values are true. */
static int static int
@ -1110,14 +1110,14 @@ typy_getitem (PyObject *self, PyObject *key)
if (field == NULL) if (field == NULL)
return NULL; return NULL;
/* We want just fields of this type, not of base types, so instead of /* We want just fields of this type, not of base types, so instead of
using lookup_struct_elt_type, portions of that function are using lookup_struct_elt_type, portions of that function are
copied here. */ copied here. */
type = typy_get_composite (type); type = typy_get_composite (type);
if (type == NULL) if (type == NULL)
return NULL; return NULL;
for (i = 0; i < TYPE_NFIELDS (type); i++) for (i = 0; i < TYPE_NFIELDS (type); i++)
{ {
const char *t_field_name = TYPE_FIELD_NAME (type, i); const char *t_field_name = TYPE_FIELD_NAME (type, i);
@ -1131,7 +1131,7 @@ typy_getitem (PyObject *self, PyObject *key)
return NULL; return NULL;
} }
/* Implement the "get" method on the type object. This is the /* Implement the "get" method on the type object. This is the
same as getitem if the key is present, but returns the supplied same as getitem if the key is present, but returns the supplied
default value or None if the key is not found. */ default value or None if the key is not found. */
@ -1139,20 +1139,20 @@ static PyObject *
typy_get (PyObject *self, PyObject *args) typy_get (PyObject *self, PyObject *args)
{ {
PyObject *key, *defval = Py_None, *result; PyObject *key, *defval = Py_None, *result;
if (!PyArg_UnpackTuple (args, "get", 1, 2, &key, &defval)) if (!PyArg_UnpackTuple (args, "get", 1, 2, &key, &defval))
return NULL; return NULL;
result = typy_getitem (self, key); result = typy_getitem (self, key);
if (result != NULL) if (result != NULL)
return result; return result;
/* typy_getitem returned error status. If the exception is /* typy_getitem returned error status. If the exception is
KeyError, clear the exception status and return the defval KeyError, clear the exception status and return the defval
instead. Otherwise return the exception unchanged. */ instead. Otherwise return the exception unchanged. */
if (!PyErr_ExceptionMatches (PyExc_KeyError)) if (!PyErr_ExceptionMatches (PyExc_KeyError))
return NULL; return NULL;
PyErr_Clear (); PyErr_Clear ();
Py_INCREF (defval); Py_INCREF (defval);
return defval; return defval;
@ -1170,7 +1170,7 @@ typy_has_key (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "s", &field)) if (!PyArg_ParseTuple (args, "s", &field))
return NULL; return NULL;
/* We want just fields of this type, not of base types, so instead of /* We want just fields of this type, not of base types, so instead of
using lookup_struct_elt_type, portions of that function are using lookup_struct_elt_type, portions of that function are
copied here. */ copied here. */
@ -1198,7 +1198,7 @@ typy_make_iter (PyObject *self, enum gdbpy_iter_kind kind)
/* Check that "self" is a structure or union type. */ /* Check that "self" is a structure or union type. */
if (typy_get_composite (((type_object *) self)->type) == NULL) if (typy_get_composite (((type_object *) self)->type) == NULL)
return NULL; return NULL;
typy_iter_obj = PyObject_New (typy_iterator_object, typy_iter_obj = PyObject_New (typy_iterator_object,
&type_iterator_object_type); &type_iterator_object_type);
if (typy_iter_obj == NULL) if (typy_iter_obj == NULL)
@ -1263,7 +1263,7 @@ typy_iterator_iternext (PyObject *self)
typy_iterator_object *iter_obj = (typy_iterator_object *) self; typy_iterator_object *iter_obj = (typy_iterator_object *) self;
struct type *type = iter_obj->source->type; struct type *type = iter_obj->source->type;
PyObject *result; PyObject *result;
if (iter_obj->field < TYPE_NFIELDS (type)) if (iter_obj->field < TYPE_NFIELDS (type))
{ {
result = make_fielditem (type, iter_obj->field, iter_obj->kind); result = make_fielditem (type, iter_obj->field, iter_obj->kind);

View File

@ -71,7 +71,7 @@ make_cleanup_py_xdecref (PyObject *py)
As an added bonus, the functions accepts a unicode string and returns it As an added bonus, the functions accepts a unicode string and returns it
right away, so callers don't need to check which kind of string they've right away, so callers don't need to check which kind of string they've
got. In Python 3, all strings are Unicode so this case is always the got. In Python 3, all strings are Unicode so this case is always the
one that applies. one that applies.
If the given object is not one of the mentioned string types, NULL is If the given object is not one of the mentioned string types, NULL is
@ -216,7 +216,7 @@ python_string_to_host_string (PyObject *obj)
if (str == NULL) if (str == NULL)
return NULL; return NULL;
result = unicode_to_encoded_string (str, host_charset ()); result = unicode_to_encoded_string (str, host_charset ());
Py_DECREF (str); Py_DECREF (str);
return result; return result;
} }
@ -288,7 +288,7 @@ gdbpy_exception_to_string (PyObject *ptype, PyObject *pvalue)
} }
/* Convert a GDB exception to the appropriate Python exception. /* Convert a GDB exception to the appropriate Python exception.
This sets the Python error indicator. */ This sets the Python error indicator. */
void void

View File

@ -437,7 +437,7 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
type = type_object_to_type (type_obj); type = type_object_to_type (type_obj);
if (! type) if (! type)
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Argument must be a type.")); _("Argument must be a type."));
return NULL; return NULL;
} }
@ -510,7 +510,7 @@ valpy_getitem (PyObject *self, PyObject *key)
PyObject *result = NULL; PyObject *result = NULL;
if (gdbpy_is_string (key)) if (gdbpy_is_string (key))
{ {
field = python_string_to_host_string (key); field = python_string_to_host_string (key);
if (field == NULL) if (field == NULL)
return NULL; return NULL;
@ -723,7 +723,7 @@ valpy_fetch_lazy (PyObject *self, PyObject *args)
/* Calculate and return the address of the PyObject as the value of /* Calculate and return the address of the PyObject as the value of
the builtin __hash__ call. */ the builtin __hash__ call. */
static long static long
valpy_hash (PyObject *self) valpy_hash (PyObject *self)
{ {
return (long) (intptr_t) self; return (long) (intptr_t) self;
@ -1248,7 +1248,7 @@ convert_value_from_python (PyObject *obj)
TRY_CATCH (except, RETURN_MASK_ALL) TRY_CATCH (except, RETURN_MASK_ALL)
{ {
if (PyBool_Check (obj)) if (PyBool_Check (obj))
{ {
cmp = PyObject_IsTrue (obj); cmp = PyObject_IsTrue (obj);
if (cmp >= 0) if (cmp >= 0)
@ -1431,7 +1431,7 @@ Return a lazy string representation of the value." },
{ "string", (PyCFunction) valpy_string, METH_VARARGS | METH_KEYWORDS, { "string", (PyCFunction) valpy_string, METH_VARARGS | METH_KEYWORDS,
"string ([encoding] [, errors] [, length]) -> string\n\ "string ([encoding] [, errors] [, length]) -> string\n\
Return Unicode string representation of the value." }, Return Unicode string representation of the value." },
{ "fetch_lazy", valpy_fetch_lazy, METH_NOARGS, { "fetch_lazy", valpy_fetch_lazy, METH_NOARGS,
"Fetches the value from the inferior, if it was lazy." }, "Fetches the value from the inferior, if it was lazy." },
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };

View File

@ -185,7 +185,7 @@ gdb_Py_DECREF (void *op) /* ARI: editCase function */
#undef Py_DECREF #undef Py_DECREF
#define Py_DECREF(op) gdb_Py_DECREF (op) #define Py_DECREF(op) gdb_Py_DECREF (op)
/* In order to be able to parse symtab_and_line_to_sal_object function /* In order to be able to parse symtab_and_line_to_sal_object function
a real symtab_and_line structure is needed. */ a real symtab_and_line structure is needed. */
#include "symtab.h" #include "symtab.h"
@ -449,7 +449,7 @@ char *gdbpy_exception_to_string (PyObject *ptype, PyObject *pvalue);
int gdbpy_is_lazy_string (PyObject *result); int gdbpy_is_lazy_string (PyObject *result);
void gdbpy_extract_lazy_string (PyObject *string, CORE_ADDR *addr, void gdbpy_extract_lazy_string (PyObject *string, CORE_ADDR *addr,
struct type **str_type, struct type **str_type,
long *length, char **encoding); long *length, char **encoding);
int gdbpy_is_value_object (PyObject *obj); int gdbpy_is_value_object (PyObject *obj);

View File

@ -163,7 +163,7 @@ ensure_python_env (struct gdbarch *gdbarch,
/* Save it and ensure ! PyErr_Occurred () afterwards. */ /* Save it and ensure ! PyErr_Occurred () afterwards. */
PyErr_Fetch (&env->error_type, &env->error_value, &env->error_traceback); PyErr_Fetch (&env->error_type, &env->error_value, &env->error_traceback);
return make_cleanup (restore_python_env, env); return make_cleanup (restore_python_env, env);
} }
@ -302,7 +302,7 @@ python_run_simple_file (FILE *file, const char *filename)
gdbpy_print_stack (); gdbpy_print_stack ();
error (_("Error while opening file: %s"), full_path); error (_("Error while opening file: %s"), full_path);
} }
make_cleanup_py_decref (python_file); make_cleanup_py_decref (python_file);
PyRun_SimpleFile (PyFile_AsFile (python_file), filename); PyRun_SimpleFile (PyFile_AsFile (python_file), filename);
do_cleanups (cleanup); do_cleanups (cleanup);
@ -453,7 +453,7 @@ gdbpy_parameter_value (enum var_types type, void *var)
} }
} }
return PyErr_Format (PyExc_RuntimeError, return PyErr_Format (PyExc_RuntimeError,
_("Programmer error: unhandled type.")); _("Programmer error: unhandled type."));
} }
@ -485,7 +485,7 @@ gdbpy_parameter (PyObject *self, PyObject *args)
_("Could not find parameter `%s'."), arg); _("Could not find parameter `%s'."), arg);
if (! cmd->var) if (! cmd->var)
return PyErr_Format (PyExc_RuntimeError, return PyErr_Format (PyExc_RuntimeError,
_("`%s' is not a parameter."), arg); _("`%s' is not a parameter."), arg);
return gdbpy_parameter_value (cmd->var_type, cmd->var); return gdbpy_parameter_value (cmd->var_type, cmd->var);
} }
@ -855,7 +855,7 @@ gdbpy_post_event (PyObject *self, PyObject *args)
if (!PyCallable_Check (func)) if (!PyCallable_Check (func))
{ {
PyErr_SetString (PyExc_RuntimeError, PyErr_SetString (PyExc_RuntimeError,
_("Posted event is not callable")); _("Posted event is not callable"));
return NULL; return NULL;
} }
@ -991,7 +991,7 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
static char *keywords[] = {"text", "stream", NULL }; static char *keywords[] = {"text", "stream", NULL };
int stream_type = 0; int stream_type = 0;
volatile struct gdb_exception except; volatile struct gdb_exception except;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg, if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg,
&stream_type)) &stream_type))
return NULL; return NULL;
@ -1015,7 +1015,7 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
} }
} }
GDB_PY_HANDLE_EXCEPTION (except); GDB_PY_HANDLE_EXCEPTION (except);
Py_RETURN_NONE; Py_RETURN_NONE;
} }
@ -1028,7 +1028,7 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw)
{ {
static char *keywords[] = {"stream", NULL }; static char *keywords[] = {"stream", NULL };
int stream_type = 0; int stream_type = 0;
if (! PyArg_ParseTupleAndKeywords (args, kw, "|i", keywords, if (! PyArg_ParseTupleAndKeywords (args, kw, "|i", keywords,
&stream_type)) &stream_type))
return NULL; return NULL;
@ -1048,7 +1048,7 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw)
default: default:
gdb_flush (gdb_stdout); gdb_flush (gdb_stdout);
} }
Py_RETURN_NONE; Py_RETURN_NONE;
} }
@ -1762,7 +1762,7 @@ finish_python_initialization (void)
#endif #endif
sys_path = PySys_GetObject ("path"); sys_path = PySys_GetObject ("path");
} }
if (sys_path && PyList_Check (sys_path)) if (sys_path && PyList_Check (sys_path))
{ {
PyObject *pythondir; PyObject *pythondir;
int err; int err;
@ -1930,7 +1930,7 @@ static struct PyModuleDef GdbModuleDef =
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"_gdb", "_gdb",
NULL, NULL,
-1, -1,
GdbMethods, GdbMethods,
NULL, NULL,
NULL, NULL,