From 044c0f87fe79cbb4061927b594490235c5b0a948 Mon Sep 17 00:00:00 2001 From: Phil Muldoon Date: Wed, 14 Apr 2010 13:18:55 +0000 Subject: 2010-04-14 Phil Muldoon * python/py-block.c (gdbpy_block_for_pc): Use i8n to encompass error/warning messages. Capitalize and use complete sentences. (blpy_block_syms_iternext): Likewise. * python/py-cmd.c (parse_command_name, cmdpy_init): Likewise. * python/py-frame.c (FRAPY_REQUIRE_VALID, frapy_block) (frame_info_to_frame_object, frapy_read_var) (gdbpy_frame_stop_reason_string): Likewise. * python/py-lazy-string.c (stpy_convert_to_value) (gdbpy_create_lazy_string_object): Likewise. * python/py-objfile.c (objfpy_set_printers): Likewise. * python/py-prettyprint.c (gdbpy_default_visualizer): Likewise. * python/python.c (parameter_to_python): Likewise. * python/py-type.c (typy_range, typy_target): Likewise. * python/py-value.c (valpy_cast, valpy_length, valpy_getitem) (valpy_richcompare, valpy_int, valpy_long, valpy_float): Likewise. --- gdb/ChangeLog | 19 +++++++++++++++++++ gdb/python/py-block.c | 4 ++-- gdb/python/py-cmd.c | 12 ++++++------ gdb/python/py-frame.c | 14 ++++++++------ gdb/python/py-lazy-string.c | 4 ++-- gdb/python/py-objfile.c | 4 ++-- gdb/python/py-prettyprint.c | 3 ++- gdb/python/py-type.c | 5 +++-- gdb/python/py-value.c | 22 +++++++++++++--------- gdb/python/python.c | 8 +++++--- gdb/testsuite/gdb.python/py-frame.exp | 2 +- 11 files changed, 63 insertions(+), 34 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a9c8f2d..6eb4a09 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,24 @@ 2010-04-14 Phil Muldoon + * python/py-block.c (gdbpy_block_for_pc): Use i8n to encompass + error/warning messages. Capitalize and use complete sentences. + (blpy_block_syms_iternext): Likewise. + * python/py-cmd.c (parse_command_name, cmdpy_init): Likewise. + * python/py-frame.c (FRAPY_REQUIRE_VALID, frapy_block) + (frame_info_to_frame_object, frapy_read_var) + (gdbpy_frame_stop_reason_string): Likewise. + * python/py-lazy-string.c (stpy_convert_to_value) + (gdbpy_create_lazy_string_object): Likewise. + * python/py-objfile.c (objfpy_set_printers): Likewise. + * python/py-prettyprint.c (gdbpy_default_visualizer): Likewise. + * python/python.c (parameter_to_python): Likewise. + * python/py-type.c (typy_range, typy_target): Likewise. + * python/py-value.c (valpy_cast, valpy_length, valpy_getitem) + (valpy_richcompare, valpy_int, valpy_long, valpy_float): Likewise. + + +2010-04-14 Phil Muldoon + PR python/11381 * python/py-prettyprint.c (pretty_print_one_value): Test for diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c index 3523664..d017030 100644 --- a/gdb/python/py-block.c +++ b/gdb/python/py-block.c @@ -248,7 +248,7 @@ blpy_block_syms_iternext (PyObject *self) if (sym == NULL) { - PyErr_SetString (PyExc_StopIteration, "Symbol is null."); + PyErr_SetString (PyExc_StopIteration, _("Symbol is null.")); return NULL; } @@ -281,7 +281,7 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args) if (!symtab || symtab->objfile == NULL) { PyErr_SetString (PyExc_RuntimeError, - "Cannot locate object file for block."); + _("Cannot locate object file for block.")); return NULL; } diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index ae462d9..d187d16 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -279,7 +279,7 @@ parse_command_name (char *text, struct cmd_list_element ***base_list) ; if (i < 0) { - PyErr_SetString (PyExc_RuntimeError, _("no command name found")); + PyErr_SetString (PyExc_RuntimeError, _("No command name found.")); return NULL; } lastchar = i; @@ -311,7 +311,7 @@ parse_command_name (char *text, struct cmd_list_element ***base_list) elt = lookup_cmd_1 (&text, cmdlist, NULL, 1); if (!elt || elt == (struct cmd_list_element *) -1) { - PyErr_Format (PyExc_RuntimeError, _("could not find command prefix %s"), + PyErr_Format (PyExc_RuntimeError, _("Could not find command prefix %s."), prefix_text); xfree (prefix_text); xfree (result); @@ -325,7 +325,7 @@ parse_command_name (char *text, struct cmd_list_element ***base_list) return result; } - PyErr_Format (PyExc_RuntimeError, _("'%s' is not a prefix command"), + PyErr_Format (PyExc_RuntimeError, _("'%s' is not a prefix command."), prefix_text); xfree (prefix_text); xfree (result); @@ -374,7 +374,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw) /* Note: this is apparently not documented in Python. We return 0 for success, -1 for failure. */ PyErr_Format (PyExc_RuntimeError, - _("command object already initialized")); + _("Command object already initialized.")); return -1; } @@ -389,13 +389,13 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw) && cmdtype != class_trace && cmdtype != class_obscure && cmdtype != class_maintenance) { - PyErr_Format (PyExc_RuntimeError, _("invalid command class argument")); + PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument.")); return -1; } if (completetype < -1 || completetype >= (int) N_COMPLETERS) { - PyErr_Format (PyExc_RuntimeError, _("invalid completion type argument")); + PyErr_Format (PyExc_RuntimeError, _("Invalid completion type argument.")); return -1; } diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 3b5320c..e930ae2 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -51,7 +51,7 @@ typedef struct { do { \ frame = frame_object_to_frame_info (frame_obj); \ if (frame == NULL) \ - error ("Frame is invalid."); \ + error (_("Frame is invalid.")); \ } while (0) static PyTypeObject frame_object_type; @@ -227,7 +227,7 @@ frapy_block (PyObject *self, PyObject *args) if (!sal.symtab || !sal.symtab->objfile) { PyErr_SetString (PyExc_RuntimeError, - "Cannot locate object file for block."); + _("Cannot locate object file for block.")); return NULL; } @@ -273,7 +273,8 @@ frame_info_to_frame_object (struct frame_info *frame) frame_obj = PyObject_New (frame_object, &frame_object_type); if (frame_obj == NULL) { - PyErr_SetString (PyExc_MemoryError, "Could not allocate frame object."); + PyErr_SetString (PyExc_MemoryError, + _("Could not allocate frame object.")); return NULL; } @@ -436,7 +437,7 @@ frapy_read_var (PyObject *self, PyObject *args) if (!var) { PyErr_Format (PyExc_ValueError, - _("variable '%s' not found"), var_name); + _("Variable '%s' not found."), var_name); do_cleanups (cleanup); return NULL; @@ -447,7 +448,7 @@ frapy_read_var (PyObject *self, PyObject *args) else { PyErr_SetString (PyExc_TypeError, - _("argument must be a symbol or string")); + _("Argument must be a symbol or string.")); return NULL; } @@ -524,7 +525,8 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args) if (reason < 0 || reason > UNWIND_NO_SAVED_PC) { - PyErr_SetString (PyExc_ValueError, "Invalid frame stop reason."); + PyErr_SetString (PyExc_ValueError, + _("Invalid frame stop reason.")); return NULL; } diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c index ebe0a99..d28aae2 100644 --- a/gdb/python/py-lazy-string.c +++ b/gdb/python/py-lazy-string.c @@ -97,7 +97,7 @@ stpy_convert_to_value (PyObject *self, PyObject *args) if (self_string->address == 0) { PyErr_SetString (PyExc_MemoryError, - _("Cannot create a value from NULL")); + _("Cannot create a value from NULL.")); return NULL; } @@ -129,7 +129,7 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length, if (!type) { PyErr_SetString (PyExc_RuntimeError, - "A lazy string's type cannot be NULL."); + _("A lazy string's type cannot be NULL.")); return NULL; } diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index 1b924d5..23655c6 100644 --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -93,14 +93,14 @@ objfpy_set_printers (PyObject *o, PyObject *value, void *ignore) if (! value) { PyErr_SetString (PyExc_TypeError, - "cannot delete the pretty_printers attribute"); + _("Cannot delete the pretty_printers attribute.")); return -1; } if (! PyList_Check (value)) { PyErr_SetString (PyExc_TypeError, - "the pretty_printers attribute must be a list"); + _("The pretty_printers attribute must be a list.")); return -1; } diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 5c3757c..9f9fea1 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -663,7 +663,8 @@ gdbpy_default_visualizer (PyObject *self, PyObject *args) value = value_object_to_value (val_obj); if (! value) { - PyErr_SetString (PyExc_TypeError, "argument must be a gdb.Value"); + PyErr_SetString (PyExc_TypeError, + _("Argument must be a gdb.Value.")); return NULL; } diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index ae12b58..238b84a 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -290,7 +290,7 @@ typy_range (PyObject *self, PyObject *args) && TYPE_CODE (type) != TYPE_CODE_RANGE) { PyErr_SetString (PyExc_RuntimeError, - "This type does not have a range."); + _("This type does not have a range.")); return NULL; } @@ -362,7 +362,8 @@ typy_target (PyObject *self, PyObject *args) if (!TYPE_TARGET_TYPE (type)) { - PyErr_SetString (PyExc_RuntimeError, "type does not have a target"); + PyErr_SetString (PyExc_RuntimeError, + _("Type does not have a target.")); return NULL; } diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index a792819..7672b5d 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -304,7 +304,8 @@ valpy_cast (PyObject *self, PyObject *args) type = type_object_to_type (type_obj); if (! type) { - PyErr_SetString (PyExc_RuntimeError, "argument must be a Type"); + PyErr_SetString (PyExc_RuntimeError, + _("Argument must be a type.")); return NULL; } @@ -322,7 +323,7 @@ valpy_length (PyObject *self) { /* We don't support getting the number of elements in a struct / class. */ PyErr_SetString (PyExc_NotImplementedError, - "Invalid operation on gdb.Value."); + _("Invalid operation on gdb.Value.")); return -1; } @@ -364,7 +365,7 @@ valpy_getitem (PyObject *self, PyObject *key) type = check_typedef (value_type (tmp)); if (TYPE_CODE (type) != TYPE_CODE_ARRAY && TYPE_CODE (type) != TYPE_CODE_PTR) - error( _("Cannot subscript requested type")); + error( _("Cannot subscript requested type.")); else res_val = value_subscript (tmp, value_as_long (idx)); } @@ -728,7 +729,7 @@ valpy_richcompare (PyObject *self, PyObject *other, int op) default: /* Can't happen. */ PyErr_SetString (PyExc_NotImplementedError, - "Invalid operation on gdb.Value."); + _("Invalid operation on gdb.Value.")); return NULL; } @@ -765,7 +766,7 @@ valpy_richcompare (PyObject *self, PyObject *other, int op) default: /* Can't happen. */ PyErr_SetString (PyExc_NotImplementedError, - "Invalid operation on gdb.Value."); + _("Invalid operation on gdb.Value.")); result = -1; break; } @@ -806,7 +807,8 @@ valpy_int (PyObject *self) CHECK_TYPEDEF (type); if (!is_intlike (type, 0)) { - PyErr_SetString (PyExc_RuntimeError, "cannot convert value to int"); + PyErr_SetString (PyExc_RuntimeError, + _("Cannot convert value to int.")); return NULL; } @@ -837,7 +839,8 @@ valpy_long (PyObject *self) if (!is_intlike (type, 1)) { - PyErr_SetString (PyExc_RuntimeError, "cannot convert value to long"); + PyErr_SetString (PyExc_RuntimeError, + _("Cannot convert value to long.")); return NULL; } @@ -866,7 +869,8 @@ valpy_float (PyObject *self) CHECK_TYPEDEF (type); if (TYPE_CODE (type) != TYPE_CODE_FLT) { - PyErr_SetString (PyExc_RuntimeError, "cannot convert value to float"); + PyErr_SetString (PyExc_RuntimeError, + _("Cannot convert value to float.")); return NULL; } @@ -977,7 +981,7 @@ convert_value_from_python (PyObject *obj) value = value_copy (((value_object *) result)->value); } else - PyErr_Format (PyExc_TypeError, _("Could not convert Python object: %s"), + PyErr_Format (PyExc_TypeError, _("Could not convert Python object: %s."), PyString_AsString (PyObject_Str (obj))); } if (except.reason < 0) diff --git a/gdb/python/python.c b/gdb/python/python.c index 9cf4520..41a9443 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -249,7 +249,8 @@ parameter_to_python (struct cmd_list_element *cmd) } } - return PyErr_Format (PyExc_RuntimeError, "programmer error: unhandled type"); + return PyErr_Format (PyExc_RuntimeError, + _("Programmer error: unhandled type.")); } /* A Python function which returns a gdb parameter's value as a Python @@ -276,10 +277,11 @@ gdbpy_parameter (PyObject *self, PyObject *args) GDB_PY_HANDLE_EXCEPTION (except); if (!found) return PyErr_Format (PyExc_RuntimeError, - "could not find parameter `%s'", arg); + _("Could not find parameter `%s'."), arg); if (! cmd->var) - return PyErr_Format (PyExc_RuntimeError, "`%s' is not a parameter", arg); + return PyErr_Format (PyExc_RuntimeError, + _("`%s' is not a parameter."), arg); return parameter_to_python (cmd); } diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp index 150e737..baa080d 100644 --- a/gdb/testsuite/gdb.python/py-frame.exp +++ b/gdb/testsuite/gdb.python/py-frame.exp @@ -100,7 +100,7 @@ gdb_test "python print 'result =', f0.pc ()" " = \[0-9\]+" "test Frame.pc" gdb_test "python print 'result =', f0.older () == f1" " = True" "test Frame.older" gdb_test "python print 'result =', f1.newer () == f0" " = True" "test Frame.newer" gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_exist')" \ - "ValueError: variable 'variable_which_surely_doesnt_exist' not found.*Error while executing Python code." \ + "ValueError: Variable 'variable_which_surely_doesnt_exist' not found.*Error while executing Python code." \ "test Frame.read_var - error" gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success" -- cgit v1.1