From 61d8f2758f5881aa0138e31b45105515e98eb715 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sat, 23 May 2009 15:34:36 +0000 Subject: [PATCH] gdb/ Remove already unreachable code. * varobj.c (varobj_get_handle): Fix comment when error is called. All callers updated. --- gdb/ChangeLog | 6 ++++++ gdb/mi/mi-cmd-var.c | 28 ---------------------------- gdb/varobj.c | 4 ++-- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cebb2a2be10..da506329b8d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-05-23 Jan Kratochvil + + Remove already unreachable code. + * varobj.c (varobj_get_handle): Fix comment when error is called. + All callers updated. + 2009-05-23 Eli Zaretskii * README (`configure' options): Document GDB-specific options to diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 143074b0522..9de8d3d005d 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -185,9 +185,6 @@ mi_cmd_var_delete (char *command, char **argv, int argc) var = varobj_get_handle (name); - if (var == NULL) - error (_("mi_cmd_var_delete: Variable object not found.")); - numdel = varobj_delete (var, NULL, children_only_p); ui_out_field_int (uiout, "ndeleted", numdel); @@ -233,9 +230,6 @@ mi_cmd_var_set_format (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("mi_cmd_var_set_format: Variable object not found")); - format = mi_parse_format (argv[1]); /* Set the format of VAR to given format */ @@ -258,8 +252,6 @@ mi_cmd_var_set_frozen (char *command, char **argv, int argc) error (_("-var-set-format: Usage: NAME FROZEN_FLAG.")); var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("Variable object not found")); if (strcmp (argv[1], "0") == 0) frozen = 0; @@ -287,8 +279,6 @@ mi_cmd_var_show_format (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("mi_cmd_var_show_format: Variable object not found")); format = varobj_get_display_format (var); @@ -306,8 +296,6 @@ mi_cmd_var_info_num_children (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("mi_cmd_var_info_num_children: Variable object not found")); ui_out_field_int (uiout, "numchild", varobj_get_num_children (var)); } @@ -378,8 +366,6 @@ mi_cmd_var_list_children (char *command, char **argv, int argc) var = varobj_get_handle (argv[0]); else var = varobj_get_handle (argv[1]); - if (var == NULL) - error (_("Variable object not found")); children = varobj_list_children (var); ui_out_field_int (uiout, "numchild", VEC_length (varobj_p, children)); @@ -415,8 +401,6 @@ mi_cmd_var_info_type (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("mi_cmd_var_info_type: Variable object not found")); ui_out_field_string (uiout, "type", varobj_get_type (var)); } @@ -432,8 +416,6 @@ mi_cmd_var_info_path_expression (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified. */ var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("Variable object not found")); path_expr = varobj_get_path_expr (var); @@ -451,8 +433,6 @@ mi_cmd_var_info_expression (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("mi_cmd_var_info_expression: Variable object not found")); lang = varobj_get_language (var); @@ -472,8 +452,6 @@ mi_cmd_var_show_attributes (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("mi_cmd_var_show_attributes: Variable object not found")); attr = varobj_get_attributes (var); /* FIXME: define masks for attributes */ @@ -534,8 +512,6 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (argv[optind]); - if (var == NULL) - error (_("Variable object not found")); if (formatFound) ui_out_field_string (uiout, "value", varobj_get_formatted_value (var, format)); @@ -554,8 +530,6 @@ mi_cmd_var_assign (char *command, char **argv, int argc) /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (argv[0]); - if (var == NULL) - error (_("mi_cmd_var_assign: Variable object not found")); if (!varobj_editable_p (var)) error (_("mi_cmd_var_assign: Variable object is not editable")); @@ -634,8 +608,6 @@ mi_cmd_var_update (char *command, char **argv, int argc) { /* Get varobj handle, if a valid var obj name was specified */ var = varobj_get_handle (name); - if (var == NULL) - error (_("mi_cmd_var_update: Variable object not found")); if (mi_version (uiout) <= 1) cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist"); diff --git a/gdb/varobj.c b/gdb/varobj.c index d36e46d8cee..54c2a02efdf 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -591,8 +591,8 @@ varobj_gen_name (void) return obj_name; } -/* Given an "objname", returns the pointer to the corresponding varobj - or NULL if not found */ +/* Given an OBJNAME, returns the pointer to the corresponding varobj. Call + error if OBJNAME cannot be found. */ struct varobj * varobj_get_handle (char *objname) -- 2.30.2