diff options
author | Doug Evans <xdje42@gmail.com> | 2013-11-29 12:00:47 -0800 |
---|---|---|
committer | Doug Evans <xdje42@gmail.com> | 2013-11-29 12:00:47 -0800 |
commit | 256458bc0ed6b39c34afefb60d2b1009603fd62a (patch) | |
tree | de6071fd88ee670a6228a55bca2d954e0aa62694 /gdb | |
parent | c9ae340d17015d64f6959ea63ca80a26af5540be (diff) | |
download | gdb-256458bc0ed6b39c34afefb60d2b1009603fd62a.zip gdb-256458bc0ed6b39c34afefb60d2b1009603fd62a.tar.gz gdb-256458bc0ed6b39c34afefb60d2b1009603fd62a.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 20 | ||||
-rw-r--r-- | gdb/python/py-breakpoint.c | 40 | ||||
-rw-r--r-- | gdb/python/py-cmd.c | 10 | ||||
-rw-r--r-- | gdb/python/py-evts.c | 2 | ||||
-rw-r--r-- | gdb/python/py-finishbreakpoint.c | 16 | ||||
-rw-r--r-- | gdb/python/py-frame.c | 4 | ||||
-rw-r--r-- | gdb/python/py-function.c | 2 | ||||
-rw-r--r-- | gdb/python/py-inferior.c | 10 | ||||
-rw-r--r-- | gdb/python/py-infthread.c | 2 | ||||
-rw-r--r-- | gdb/python/py-param.c | 24 | ||||
-rw-r--r-- | gdb/python/py-prettyprint.c | 14 | ||||
-rw-r--r-- | gdb/python/py-symbol.c | 2 | ||||
-rw-r--r-- | gdb/python/py-type.c | 44 | ||||
-rw-r--r-- | gdb/python/py-utils.c | 6 | ||||
-rw-r--r-- | gdb/python/py-value.c | 10 | ||||
-rw-r--r-- | gdb/python/python-internal.h | 4 | ||||
-rw-r--r-- | gdb/python/python.c | 22 |
17 files changed, 126 insertions, 106 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e02284..28e06f9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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> * unwind_stop_reasons.def (UNWIND_NULL_ID): Update comment. diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 82e067e..1085588 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -121,7 +121,7 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure) if (newvalue == NULL) { - PyErr_SetString (PyExc_TypeError, + PyErr_SetString (PyExc_TypeError, _("Cannot delete `enabled' attribute.")); return -1; @@ -160,7 +160,7 @@ bppy_set_silent (PyObject *self, PyObject *newvalue, void *closure) if (newvalue == NULL) { - PyErr_SetString (PyExc_TypeError, + PyErr_SetString (PyExc_TypeError, _("Cannot delete `silent' attribute.")); return -1; } @@ -191,7 +191,7 @@ bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure) if (newvalue == NULL) { - PyErr_SetString (PyExc_TypeError, + PyErr_SetString (PyExc_TypeError, _("Cannot delete `thread' attribute.")); return -1; } @@ -202,7 +202,7 @@ bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure) if (! valid_thread_id (id)) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("Invalid thread ID.")); return -1; } @@ -234,7 +234,7 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure) if (newvalue == NULL) { - PyErr_SetString (PyExc_TypeError, + PyErr_SetString (PyExc_TypeError, _("Cannot delete `task' attribute.")); return -1; } @@ -251,7 +251,7 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure) if (! valid_id) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("Invalid task ID.")); return -1; } @@ -341,7 +341,7 @@ bppy_set_hit_count (PyObject *self, PyObject *newvalue, void *closure) if (newvalue == NULL) { - PyErr_SetString (PyExc_TypeError, + PyErr_SetString (PyExc_TypeError, _("Cannot delete `hit_count' attribute.")); return -1; } @@ -436,7 +436,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure) if (newvalue == NULL) { - PyErr_SetString (PyExc_TypeError, + PyErr_SetString (PyExc_TypeError, _("Cannot delete `condition' attribute.")); return -1; } @@ -644,7 +644,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) bppy_pending_object = (gdbpy_breakpoint_object *) self; bppy_pending_object->number = -1; bppy_pending_object->bp = NULL; - + TRY_CATCH (except, RETURN_MASK_ALL) { 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 : get_current_arch (); struct cleanup *cleanup = ensure_python_env (garch, current_language); - + if (py_bp != NULL) 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) return; - if (bp->type != bp_breakpoint + if (bp->type != bp_breakpoint && bp->type != bp_watchpoint - && bp->type != bp_hardware_watchpoint + && bp->type != bp_hardware_watchpoint && bp->type != bp_read_watchpoint && bp->type != bp_access_watchpoint) return; @@ -937,31 +937,31 @@ gdbpy_initialize_breakpoints (void) PyObject_GenericSetAttr to allow extra validation of the attribute being set. */ -static int +static int 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); - + if (attr == NULL) return -1; - + /* If the attribute trying to be set is the "stop" method, but we already have a condition set in the CLI, disallow this operation. */ if (strcmp (attr, stop_func) == 0 && obj->bp->cond_string) { xfree (attr); - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("Cannot set 'stop' method. There is an " \ "existing GDB condition attached to the " \ "breakpoint.")); return -1; } - + xfree (attr); - - return PyObject_GenericSetAttr ((PyObject *)self, name, v); + + return PyObject_GenericSetAttr ((PyObject *)self, name, v); } static PyGetSetDef breakpoint_object_getset[] = { diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 56321fa..c0e9d96 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -308,14 +308,14 @@ cmdpy_completer (struct cmd_list_element *command, /* Helper for cmdpy_init which locates the command list to use and pulls out the command name. - + 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 commands. *BASE_LIST is set to the final prefix command's list of *sub-commands. - + START_LIST is the list in which the search starts. 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; pfx_name = NULL; - if (is_prefix != NULL) + if (is_prefix != NULL) { cmp = PyObject_IsTrue (is_prefix); if (cmp == 1) { int i, out; - + /* Make a normalized form of the command name. */ pfx_name = xmalloc (strlen (name) + 2); - + i = 0; out = 0; while (name[i]) diff --git a/gdb/python/py-evts.c b/gdb/python/py-evts.c index 971c520..1ff3022 100644 --- a/gdb/python/py-evts.c +++ b/gdb/python/py-evts.c @@ -26,7 +26,7 @@ static struct PyModuleDef EventModuleDef = PyModuleDef_HEAD_INIT, "gdb.events", NULL, - -1, + -1, NULL, NULL, NULL, diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index fa157d0..394ac1e 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -185,7 +185,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) if (frame == NULL) { - PyErr_SetString (PyExc_ValueError, + PyErr_SetString (PyExc_ValueError, _("Invalid ID for the `frame' object.")); } else @@ -232,9 +232,9 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) if (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.")); return -1; } @@ -303,10 +303,10 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) 0, 1, internal_bp, 0); } GDB_PY_SET_HANDLE_EXCEPTION (except); - + self_bpfinish->py_bp.bp->frame_id = frame_id; self_bpfinish->py_bp.is_finish_bp = 1; - + /* Bind the breakpoint with the 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; PyObject *py_bp = (PyObject *) b->py_bp_object; struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch (); - + /* Trigger out_of_scope if this is a FinishBreakpoint and its frame is not anymore in the current callstack. */ 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) return -1; - + if (gdb_pymodule_addobject (gdb_module, "FinishBreakpoint", (PyObject *) &finish_breakpoint_object_type) < 0) return -1; - + observer_attach_normal_stop (bpfinishpy_handle_stop); observer_attach_inferior_exit (bpfinishpy_handle_exit); diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 0d024eb..0f189f0 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -61,7 +61,7 @@ typedef struct { struct frame_info * 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; 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) { - PyErr_SetString (PyExc_ValueError, + PyErr_SetString (PyExc_ValueError, _("Invalid frame stop reason.")); return NULL; } diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c index fc0d4dd..843ad30 100644 --- a/gdb/python/py-function.c +++ b/gdb/python/py-function.c @@ -39,7 +39,7 @@ convert_values_to_python (int argc, struct value **argv) { int i; PyObject *result = PyTuple_New (argc); - + if (! result) return NULL; diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index ed49290..1a1b774 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -274,7 +274,7 @@ delete_thread_object (struct thread_info *tp, int ignore) struct cleanup *cleanup; inferior_object *inf_obj; struct threadlist_entry **entry, *tmp; - + if (!gdb_python_initialized) return; @@ -559,9 +559,9 @@ get_buffer (PyObject *self, Py_buffer *buf, int flags) { membuf_object *membuf_obj = (membuf_object *) self; int ret; - + ret = PyBuffer_FillInfo (buf, self, membuf_obj->buffer, - membuf_obj->length, 0, + membuf_obj->length, 0, PyBUF_CONTIG); buf->format = "c"; @@ -647,7 +647,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw) pattern_size = pybuf.len; #else PyObject *pattern; - + if (! PyArg_ParseTupleAndKeywords (args, kw, "OOO", keywords, &start_addr_obj, &length_obj, &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) goto fail; - + if (get_addr_from_python (length_obj, &length) < 0) goto fail; diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c index 053995f..2b1da22 100644 --- a/gdb/python/py-infthread.c +++ b/gdb/python/py-infthread.c @@ -95,7 +95,7 @@ thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore) if (newvalue == NULL) { - PyErr_SetString (PyExc_TypeError, + PyErr_SetString (PyExc_TypeError, _("Cannot delete `name' attribute.")); return -1; } diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c index 9f56c3a..e767128 100644 --- a/gdb/python/py-param.c +++ b/gdb/python/py-param.c @@ -134,7 +134,7 @@ set_parameter_value (parmpy_object *self, PyObject *value) && (self->type == var_filename || value != Py_None)) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("String required for filename.")); return -1; @@ -167,7 +167,7 @@ set_parameter_value (parmpy_object *self, PyObject *value) if (! gdbpy_is_string (value)) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("ENUM arguments must be a string.")); return -1; } @@ -192,12 +192,12 @@ set_parameter_value (parmpy_object *self, PyObject *value) case var_boolean: if (! PyBool_Check (value)) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("A boolean argument is required.")); return -1; } cmp = PyObject_IsTrue (value); - if (cmp < 0) + if (cmp < 0) return -1; self->value.intval = cmp; break; @@ -216,10 +216,10 @@ set_parameter_value (parmpy_object *self, PyObject *value) { cmp = PyObject_IsTrue (value); if (cmp < 0 ) - return -1; + return -1; if (cmp == 1) self->value.autoboolval = AUTO_BOOLEAN_TRUE; - else + else self->value.autoboolval = AUTO_BOOLEAN_FALSE; } break; @@ -233,7 +233,7 @@ set_parameter_value (parmpy_object *self, PyObject *value) if (! PyInt_Check (value)) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("The value must be integer.")); return -1; } @@ -258,7 +258,7 @@ set_parameter_value (parmpy_object *self, PyObject *value) if (! ok) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("Range exceeded.")); return -1; } @@ -268,7 +268,7 @@ set_parameter_value (parmpy_object *self, PyObject *value) } default: - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("Unhandled type in parameter value.")); return -1; } @@ -580,7 +580,7 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values) if (! PySequence_Check (enum_values)) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("The enumeration is not a sequence.")); return 0; } @@ -590,7 +590,7 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values) return 0; if (size == 0) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("The enumeration is empty.")); return 0; } @@ -612,7 +612,7 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values) { Py_DECREF (item); do_cleanups (back_to); - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("The enumeration item not a string.")); return 0; } diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 2825582..a09a09b 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -122,7 +122,7 @@ find_pretty_printer_from_objfiles (PyObject *value) if (function != Py_None) return 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); 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) { *out_value = convert_value_from_python (result); @@ -549,7 +549,7 @@ print_children (PyObject *printer, const char *hint, print_stack_unless_memory_error (stream); /* Set a flag so we can know whether we printed all the available elements. */ - else + else done_flag = 1; break; } @@ -729,7 +729,7 @@ apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, val_obj = value_to_value_object (value); if (! val_obj) goto done; - + /* Find the constructor. */ printer = find_pretty_printer (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 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. */ PyObject * gdbpy_get_varobj_pretty_printer (struct value *value) @@ -804,7 +804,7 @@ gdbpy_get_varobj_pretty_printer (struct value *value) value = value_copy (value); } GDB_PY_HANDLE_EXCEPTION (except); - + val_obj = value_to_value_object (value); if (! val_obj) return NULL; @@ -830,7 +830,7 @@ gdbpy_default_visualizer (PyObject *self, PyObject *args) value = value_object_to_value (val_obj); if (! value) { - PyErr_SetString (PyExc_TypeError, + PyErr_SetString (PyExc_TypeError, _("Argument must be a gdb.Value.")); return NULL; } diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index 8afe52d..f0948e9 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -270,7 +270,7 @@ sympy_value (PyObject *self, PyObject *args) if (frame_info == NULL) error (_("invalid frame")); } - + if (symbol_read_needs_frame (symbol) && frame_info == NULL) error (_("symbol requires a frame to compute its value")); diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 628a764..9aeb92c 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -303,7 +303,7 @@ make_fielditem (struct type *type, int i, enum gdbpy_iter_kind kind) gdb_assert_not_reached ("invalid gdbpy_iter_kind"); } return item; - + fail: Py_XDECREF (key); 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. - 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 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; PyObject *r, *rl; - + if (TYPE_CODE (type) != TYPE_CODE_ARRAY) return typy_fields_items (self, iter_values); @@ -375,7 +375,7 @@ typy_fields (PyObject *self, PyObject *args) r = convert_field (type, 0); if (r == NULL) return NULL; - + rl = Py_BuildValue ("[O]", r); Py_DECREF (r); @@ -390,7 +390,7 @@ typy_field_names (PyObject *self, PyObject *args) 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. */ static PyObject * @@ -450,7 +450,7 @@ typy_get_composite (struct type *type) /* If this is not a struct, union, or enum type, raise TypeError 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_ENUM) { @@ -458,7 +458,7 @@ typy_get_composite (struct type *type) "Type is not a structure, union, or enum type."); return NULL; } - + return type; } @@ -602,7 +602,7 @@ typy_range (PyObject *self, PyObject *args) return NULL; } return result; - + failarg: Py_XDECREF (high_bound); Py_XDECREF (low_bound); @@ -633,7 +633,7 @@ typy_target (PyObject *self, PyObject *args) if (!TYPE_TARGET_TYPE (type)) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("Type does not have a target.")); return NULL; } @@ -774,12 +774,12 @@ typy_lookup_type (struct demangle_component *demangled, } GDB_PY_HANDLE_EXCEPTION (except); } - + /* If we have a type from the switch statement above, just return that. */ if (rtype) return rtype; - + /* We don't have a type, so lookup the type. */ type_name = cp_comp_to_string (demangled, 10); 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 - 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. */ static int @@ -1110,14 +1110,14 @@ typy_getitem (PyObject *self, PyObject *key) if (field == 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 copied here. */ type = typy_get_composite (type); if (type == NULL) return NULL; - + for (i = 0; i < TYPE_NFIELDS (type); i++) { const char *t_field_name = TYPE_FIELD_NAME (type, i); @@ -1131,7 +1131,7 @@ typy_getitem (PyObject *self, PyObject *key) 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 default value or None if the key is not found. */ @@ -1139,20 +1139,20 @@ static PyObject * typy_get (PyObject *self, PyObject *args) { PyObject *key, *defval = Py_None, *result; - + if (!PyArg_UnpackTuple (args, "get", 1, 2, &key, &defval)) return NULL; - + result = typy_getitem (self, key); if (result != NULL) return result; - + /* typy_getitem returned error status. If the exception is KeyError, clear the exception status and return the defval instead. Otherwise return the exception unchanged. */ if (!PyErr_ExceptionMatches (PyExc_KeyError)) return NULL; - + PyErr_Clear (); Py_INCREF (defval); return defval; @@ -1170,7 +1170,7 @@ typy_has_key (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &field)) 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 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. */ if (typy_get_composite (((type_object *) self)->type) == NULL) return NULL; - + typy_iter_obj = PyObject_New (typy_iterator_object, &type_iterator_object_type); if (typy_iter_obj == NULL) @@ -1263,7 +1263,7 @@ typy_iterator_iternext (PyObject *self) typy_iterator_object *iter_obj = (typy_iterator_object *) self; struct type *type = iter_obj->source->type; PyObject *result; - + if (iter_obj->field < TYPE_NFIELDS (type)) { result = make_fielditem (type, iter_obj->field, iter_obj->kind); diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c index bbbdef4..4dcd168 100644 --- a/gdb/python/py-utils.c +++ b/gdb/python/py-utils.c @@ -71,7 +71,7 @@ make_cleanup_py_xdecref (PyObject *py) 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 - 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. 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) return NULL; - result = unicode_to_encoded_string (str, host_charset ()); + result = unicode_to_encoded_string (str, host_charset ()); Py_DECREF (str); return result; } @@ -288,7 +288,7 @@ gdbpy_exception_to_string (PyObject *ptype, PyObject *pvalue) } /* Convert a GDB exception to the appropriate Python exception. - + This sets the Python error indicator. */ void diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 4054808..40254b9 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -437,7 +437,7 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op) type = type_object_to_type (type_obj); if (! type) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("Argument must be a type.")); return NULL; } @@ -510,7 +510,7 @@ valpy_getitem (PyObject *self, PyObject *key) PyObject *result = NULL; if (gdbpy_is_string (key)) - { + { field = python_string_to_host_string (key); if (field == 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 the builtin __hash__ call. */ -static long +static long valpy_hash (PyObject *self) { return (long) (intptr_t) self; @@ -1248,7 +1248,7 @@ convert_value_from_python (PyObject *obj) TRY_CATCH (except, RETURN_MASK_ALL) { - if (PyBool_Check (obj)) + if (PyBool_Check (obj)) { cmp = PyObject_IsTrue (obj); if (cmp >= 0) @@ -1431,7 +1431,7 @@ Return a lazy string representation of the value." }, { "string", (PyCFunction) valpy_string, METH_VARARGS | METH_KEYWORDS, "string ([encoding] [, errors] [, length]) -> string\n\ 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." }, {NULL} /* Sentinel */ }; diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 16214ef..125670e 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -185,7 +185,7 @@ gdb_Py_DECREF (void *op) /* ARI: editCase function */ #undef Py_DECREF #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. */ #include "symtab.h" @@ -449,7 +449,7 @@ char *gdbpy_exception_to_string (PyObject *ptype, PyObject *pvalue); int gdbpy_is_lazy_string (PyObject *result); void gdbpy_extract_lazy_string (PyObject *string, CORE_ADDR *addr, - struct type **str_type, + struct type **str_type, long *length, char **encoding); int gdbpy_is_value_object (PyObject *obj); diff --git a/gdb/python/python.c b/gdb/python/python.c index 1dfe0ac..1873936 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -163,7 +163,7 @@ ensure_python_env (struct gdbarch *gdbarch, /* Save it and ensure ! PyErr_Occurred () afterwards. */ PyErr_Fetch (&env->error_type, &env->error_value, &env->error_traceback); - + return make_cleanup (restore_python_env, env); } @@ -302,7 +302,7 @@ python_run_simple_file (FILE *file, const char *filename) gdbpy_print_stack (); error (_("Error while opening file: %s"), full_path); } - + make_cleanup_py_decref (python_file); PyRun_SimpleFile (PyFile_AsFile (python_file), filename); 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.")); } @@ -485,7 +485,7 @@ gdbpy_parameter (PyObject *self, PyObject *args) _("Could not find parameter `%s'."), arg); if (! cmd->var) - return PyErr_Format (PyExc_RuntimeError, + return PyErr_Format (PyExc_RuntimeError, _("`%s' is not a parameter."), arg); return gdbpy_parameter_value (cmd->var_type, cmd->var); } @@ -855,7 +855,7 @@ gdbpy_post_event (PyObject *self, PyObject *args) if (!PyCallable_Check (func)) { - PyErr_SetString (PyExc_RuntimeError, + PyErr_SetString (PyExc_RuntimeError, _("Posted event is not callable")); return NULL; } @@ -991,7 +991,7 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw) static char *keywords[] = {"text", "stream", NULL }; int stream_type = 0; volatile struct gdb_exception except; - + if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg, &stream_type)) return NULL; @@ -1015,7 +1015,7 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw) } } GDB_PY_HANDLE_EXCEPTION (except); - + Py_RETURN_NONE; } @@ -1028,7 +1028,7 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw) { static char *keywords[] = {"stream", NULL }; int stream_type = 0; - + if (! PyArg_ParseTupleAndKeywords (args, kw, "|i", keywords, &stream_type)) return NULL; @@ -1048,7 +1048,7 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw) default: gdb_flush (gdb_stdout); } - + Py_RETURN_NONE; } @@ -1762,7 +1762,7 @@ finish_python_initialization (void) #endif sys_path = PySys_GetObject ("path"); } - if (sys_path && PyList_Check (sys_path)) + if (sys_path && PyList_Check (sys_path)) { PyObject *pythondir; int err; @@ -1930,7 +1930,7 @@ static struct PyModuleDef GdbModuleDef = PyModuleDef_HEAD_INIT, "_gdb", NULL, - -1, + -1, GdbMethods, NULL, NULL, |