From 389e51db103b5c811f1849228c2c5e9e71062f5a Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 19 Sep 2002 03:58:41 +0000 Subject: [PATCH] Revert previous change. Not obvious. --- gdb/ChangeLog | 7 +++++ gdb/breakpoint.c | 7 ++--- gdb/c-exp.y | 1 - gdb/defs.h | 5 ++- gdb/elfread.c | 8 +---- gdb/expression.h | 24 +++----------- gdb/jv-exp.y | 1 - gdb/language.c | 7 ----- gdb/language.h | 3 +- gdb/p-exp.y | 1 - gdb/parse.c | 16 ---------- gdb/parser-defs.h | 13 -------- gdb/printcmd.c | 6 +--- gdb/source.c | 5 ++- gdb/stabsread.c | 29 ++--------------- gdb/symfile.c | 1 - gdb/symtab.h | 16 +--------- gdb/utils.c | 79 ++++++++--------------------------------------- gdb/valops.c | 61 ++++++++++++------------------------ gdb/value.h | 12 ------- 20 files changed, 55 insertions(+), 247 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 02741993419..5cb7e23529d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2002-09-18 Andrew Cagney + + * breakpoint.c, c-exp.y, defs.h, elfread.c, expression.h, + jv-exp.y, language.c, language.h, p-exp.y, parse.c, parser-defs.h, + printcmd.c, source.c, stabsread.c, symfile.c, symtab.h, utils.c, + valops.c, value.h: Revert previous change. + 2002-09-18 Michael Snyder Preliminary support for Objective-C: diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 54cd2d92615..2998671bbf1 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4618,16 +4618,13 @@ parse_breakpoint_sals (char **address, current_source_symtab (which is decode_line_1's default). This should produce the results we want almost all of the time while leaving default_breakpoint_* alone. */ - /* Also ignore objc method name. FIXME better comment? */ if (default_breakpoint_valid && (!current_source_symtab - || ((strchr ("+-", (*address)[0]) != NULL) - && ((*address)[1] != '[')))) + || (strchr ("+-", (*address)[0]) != NULL))) *sals = decode_line_1 (address, 1, default_breakpoint_symtab, default_breakpoint_line, addr_string); else - *sals = decode_line_1 (address, 1, (struct symtab *) NULL, - 0, addr_string); + *sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0, addr_string); } /* For any SAL that didn't have a canonical string, fill one in. */ if (sals->nelts > 0 && *addr_string == NULL) diff --git a/gdb/c-exp.y b/gdb/c-exp.y index b130a9c115f..c6fc52c63a5 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -49,7 +49,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" /* Required by objfiles.h. */ #include "symfile.h" /* Required by objfiles.h. */ #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ -#include "completer.h" /* For skip_quoted(). */ /* Flag indicating we're dealing with HP-compiled objects */ extern int hp_som_som_object_present; diff --git a/gdb/defs.h b/gdb/defs.h index fffa610626d..235d285238a 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -208,7 +208,6 @@ enum language language_auto, /* Placeholder for automatic setting */ language_c, /* C */ language_cplus, /* C++ */ - language_objc, /* Objective-C */ language_java, /* Java */ /* OBSOLETE language_chill, */ /* Chill */ language_fortran, /* Fortran */ @@ -446,8 +445,6 @@ extern void puts_filtered (const char *); extern void puts_unfiltered (const char *); -extern void puts_filtered_tabular (char *string, int width, int right); - extern void puts_debug (char *prefix, char *string, char *suffix); extern void vprintf_filtered (const char *, va_list) ATTR_FORMAT (printf, 1, 0); @@ -534,6 +531,8 @@ extern void print_transfer_performance (struct ui_file *stream, typedef void initialize_file_ftype (void); +extern char *skip_quoted (char *); + extern char *gdb_readline (char *); extern char *gdb_readline_wrapper (char *); diff --git a/gdb/elfread.c b/gdb/elfread.c index 33ea394ac24..7d37297c5f4 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -349,13 +349,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic) } else if (sym->section->flags & SEC_CODE) { - if (sym->name[0] == '.' - && (strncmp (sym->name + 1, "objc_", 4) == 0)) - { - /* Looks like an Objective-C special symbol */ - continue; - } - else if (sym->flags & BSF_GLOBAL) + if (sym->flags & BSF_GLOBAL) { ms_type = mst_text; } diff --git a/gdb/expression.h b/gdb/expression.h index c1f36a1d36e..34e002f3a28 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -181,12 +181,6 @@ enum exp_opcode making three exp_elements. */ OP_FUNCALL, - /* OP_MSGCALL is followed by a string in the next exp_element and then an - integer. The string is the selector string. The integer is the number - of arguments to the message call. That many plus one values are used, - the first one being the object pointer. This is an Objective C message */ - OP_MSGCALL, - /* This is EXACTLY like OP_FUNCALL but is semantically different. In F77, array subscript expressions, substring expressions and function calls are all exactly the same syntactically. They may @@ -279,18 +273,11 @@ enum exp_opcode STRUCTOP_STRUCT, STRUCTOP_PTR, - /* C++: - OP_THIS is just a placeholder for the class instance variable. + /* C++ */ + /* OP_THIS is just a placeholder for the class instance variable. It just comes in a tight (OP_THIS, OP_THIS) pair. */ OP_THIS, - /* Objective C: "@selector" pseudo-operator */ - OP_SELECTOR, - - /* Objective C: OP_SELF is just a placeholder for the class instance - variable. It just comes in a tight (OP_SELF, OP_SELF) pair. */ - OP_SELF, - /* OP_SCOPE surrounds a type name and a field name. The type name is encoded as one element, but the field name stays as a string, which, of course, is variable length. */ @@ -318,10 +305,7 @@ enum exp_opcode OP_NAME, /* An unparsed expression. Used for Scheme (for now at least) */ - OP_EXPRSTRING, - - /* An Objective C Foundation Class NSString constant */ - OP_NSSTRING + OP_EXPRSTRING }; union exp_element @@ -366,7 +350,7 @@ extern struct block *innermost_block; /* From eval.c */ -/* Values of NOSIDE argument to evaluate_subexp. */ +/* Values of NOSIDE argument to eval_subexp. */ enum noside { diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index 6c75df221ba..70c228b9575 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -48,7 +48,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" /* Required by objfiles.h. */ #include "symfile.h" /* Required by objfiles.h. */ #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ -#include "completer.h" /* For skip_quoted(). */ /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), as well as gratuitiously global symbol names, so we can have multiple diff --git a/gdb/language.c b/gdb/language.c index 8eee8f6d4a5..dc94ebdd8c3 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -549,7 +549,6 @@ binop_result_type (struct value *v1, struct value *v2) { case language_c: case language_cplus: - case language_objc: if (TYPE_CODE (t1) == TYPE_CODE_FLT) return TYPE_CODE (t2) == TYPE_CODE_FLT && l2 > l1 ? VALUE_TYPE (v2) : VALUE_TYPE (v1); @@ -787,7 +786,6 @@ integral_type (struct type *type) { case language_c: case language_cplus: - case language_objc: return (TYPE_CODE (type) != TYPE_CODE_INT) && (TYPE_CODE (type) != TYPE_CODE_ENUM) ? 0 : 1; case language_m2: @@ -830,7 +828,6 @@ character_type (struct type *type) case language_c: case language_cplus: - case language_objc: return (TYPE_CODE (type) == TYPE_CODE_INT) && TYPE_LENGTH (type) == sizeof (char) ? 1 : 0; @@ -853,7 +850,6 @@ string_type (struct type *type) case language_c: case language_cplus: - case language_objc: /* C does not have distinct string type. */ return (0); default: @@ -872,7 +868,6 @@ boolean_type (struct type *type) { case language_c: case language_cplus: - case language_objc: /* Might be more cleanly handled by having a TYPE_CODE_INT_NOT_BOOL for (OBSOLETE) CHILL and such languages, or a TYPE_CODE_INT_OR_BOOL for C. */ @@ -909,7 +904,6 @@ structured_type (struct type *type) { case language_c: case language_cplus: - case language_objc: return (TYPE_CODE (type) == TYPE_CODE_STRUCT) || (TYPE_CODE (type) == TYPE_CODE_UNION) || (TYPE_CODE (type) == TYPE_CODE_ARRAY); @@ -1130,7 +1124,6 @@ binop_type_check (struct value *arg1, struct value *arg2, int op) #ifdef _LANG_c case language_c: case language_cplus: - case language_objc: switch (op) { case BINOP_DIV: diff --git a/gdb/language.h b/gdb/language.h index b15544fead9..67a8ff26afe 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -288,8 +288,7 @@ language_mode; /* "cast" really means conversion */ /* FIXME -- should be a setting in language_defn */ #define CAST_IS_CONVERSION (current_language->la_language == language_c || \ - current_language->la_language == language_cplus || \ - current_language->la_language == language_objc) + current_language->la_language == language_cplus) extern void language_info (int); diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 713524b547a..f0939e7bbbf 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -56,7 +56,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" /* Required by objfiles.h. */ #include "symfile.h" /* Required by objfiles.h. */ #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ -#include "completer.h" /* For skip_quoted(). */ /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), as well as gratuitiously global symbol names, so we can have multiple diff --git a/gdb/parse.c b/gdb/parse.c index 8ae53d83d99..c5de0af3334 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -867,11 +867,6 @@ length_of_subexp (register struct expression *expr, register int endpos) args = 1 + longest_to_int (expr->elts[endpos - 2].longconst); break; - case OP_MSGCALL: /* Objective C message (method) call */ - oplen = 4; - args = 1 + longest_to_int (expr->elts[endpos - 2].longconst); - break; - case UNOP_MAX: case UNOP_MIN: oplen = 3; @@ -903,8 +898,6 @@ length_of_subexp (register struct expression *expr, register int endpos) /* fall through */ case OP_M2_STRING: case OP_STRING: - case OP_NSSTRING: /* Objective C Foundation Class NSString constant */ - case OP_SELECTOR: /* Objective C "@selector" pseudo-op */ case OP_NAME: case OP_EXPRSTRING: oplen = longest_to_int (expr->elts[endpos - 2].longconst); @@ -943,7 +936,6 @@ length_of_subexp (register struct expression *expr, register int endpos) /* C++ */ case OP_THIS: - case OP_SELF: oplen = 2; break; @@ -1012,11 +1004,6 @@ prefixify_subexp (register struct expression *inexpr, args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst); break; - case OP_MSGCALL: /* Objective C message (method) call */ - oplen = 4; - args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst); - break; - case UNOP_MIN: case UNOP_MAX: oplen = 3; @@ -1047,8 +1034,6 @@ prefixify_subexp (register struct expression *inexpr, /* fall through */ case OP_M2_STRING: case OP_STRING: - case OP_NSSTRING: /* Objective C Foundation Class NSString constant */ - case OP_SELECTOR: /* Objective C "@selector" pseudo-op */ case OP_NAME: case OP_EXPRSTRING: oplen = longest_to_int (inexpr->elts[inend - 2].longconst); @@ -1087,7 +1072,6 @@ prefixify_subexp (register struct expression *inexpr, /* C++ */ case OP_THIS: - case OP_SELF: oplen = 2; break; diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index ba13fb70945..748208ae6d1 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -79,14 +79,6 @@ struct symtoken int is_a_field_of_this; }; -struct objc_class_str - { - struct stoken stoken; - struct type *type; - int class; - }; - - /* For parsing of complicated types. An array should be preceded in the list by the size of the array. */ enum type_pieces @@ -224,11 +216,6 @@ struct op_print extern int target_map_name_to_register (char *, int); -/* for parsing Objective C */ -extern void start_msglist (void); -extern void add_msglist (struct stoken *str, int addcolon); -extern int end_msglist (void); - /* Function used to avoid direct calls to fprintf in the code generated by the bison parser. */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index c5487a2b677..8542b8a9a5b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1104,11 +1104,7 @@ address_info (char *exp, int from_tty) printf_filtered ("Symbol \""); fprintf_symbol_filtered (gdb_stdout, exp, current_language->la_language, DMGL_ANSI); - printf_filtered ("\" is a field of the local class variable "); - if (current_language->la_language == language_objc) - printf_filtered ("'self'\n"); /* ObjC equivalent of "this" */ - else - printf_filtered ("'this'\n"); + printf_filtered ("\" is a field of the local class variable `this'\n"); return; } diff --git a/gdb/source.c b/gdb/source.c index 5c3f08ccf28..c7c1ce2f5d2 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1114,9 +1114,8 @@ print_source_lines (struct symtab *s, int line, int stopline, int noerror) /* Print a list of files and line numbers which a user may choose from in order to list a function which was specified ambiguously (as with - `list classname::overloadedfuncname', or 'list objectiveCSelector:). - The vector in SALS provides the filenames and line numbers. - NOTE: some of the SALS may have no filename or line information! */ + `list classname::overloadedfuncname', for example). The vector in + SALS provides the filenames and line numbers. */ static void ambiguous_line_spec (struct symtabs_and_lines *sals) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 0263e9e4c7b..4697b4067e7 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1267,37 +1267,13 @@ symbol_reference_defined (char **string) } } -static char * -objc_find_colon (name) - char *name; -{ - char *s = name; - if (s[0] == '-' || *s == '+') - { - if (s[1] != '[') - { - error ("invalid symbol name \"%s\"", name); - } - s = strchr (s, ']'); - if (s == NULL) - { - error ("invalid symbol name \"%s\"", name); - } - return strchr (s, ':'); - } - else - { - return strchr (s, ':'); - } -} - /* ARGSUSED */ struct symbol * define_symbol (CORE_ADDR valu, char *string, int desc, int type, struct objfile *objfile) { register struct symbol *sym; - char *p = (char *) objc_find_colon (string); + char *p = (char *) strchr (string, ':'); int deftype; int synonym = 0; register int i; @@ -2030,8 +2006,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, a typedef for "foo". Unfortunately, cfront never makes the typedef when translating C++ into C. We make the typedef here so that "ptype foo" works as expected for cfront translated code. */ - else if ((current_subfile->language == language_cplus) - || (current_subfile->language == language_objc)) + else if (current_subfile->language == language_cplus) synonym = 1; SYMBOL_TYPE (sym) = read_type (&p, objfile); diff --git a/gdb/symfile.c b/gdb/symfile.c index 1fddc69900d..3165f33b4b2 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1951,7 +1951,6 @@ init_filename_language_table (void) /* OBSOLETE add_filename_language (".ch", language_chill); */ /* OBSOLETE add_filename_language (".c186", language_chill); */ /* OBSOLETE add_filename_language (".c286", language_chill); */ - add_filename_language (".m", language_objc); add_filename_language (".f", language_fortran); add_filename_language (".F", language_fortran); add_filename_language (".s", language_asm); diff --git a/gdb/symtab.h b/gdb/symtab.h index 61622568948..ba04a987ed7 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -89,11 +89,6 @@ struct general_symbol_info char *demangled_name; } cplus_specific; - struct objc_specific - { - char *demangled_name; - } - objc_specific; #if 0 /* OBSOLETE struct chill_specific *//* For Chill */ /* OBSOLETE { */ @@ -151,10 +146,6 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *); { \ SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \ } \ - else if (SYMBOL_LANGUAGE (symbol) == language_objc) \ - { \ - SYMBOL_OBJC_DEMANGLED_NAME (symbol) = NULL; \ - } \ /* OBSOLETE else if (SYMBOL_LANGUAGE (symbol) == language_chill) */ \ /* OBSOLETE { */ \ /* OBSOLETE SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; */ \ @@ -179,18 +170,13 @@ extern void symbol_init_demangled_name (struct general_symbol_info *symbol, (SYMBOL_LANGUAGE (symbol) == language_cplus \ || SYMBOL_LANGUAGE (symbol) == language_java \ ? SYMBOL_CPLUS_DEMANGLED_NAME (symbol) \ - : (SYMBOL_LANGUAGE (symbol) == language_objc \ - ? SYMBOL_OBJC_DEMANGLED_NAME (symbol) \ : /* OBSOLETE (SYMBOL_LANGUAGE (symbol) == language_chill */ \ /* OBSOLETE ? SYMBOL_CHILL_DEMANGLED_NAME (symbol) */ \ - NULL)) + NULL) /* OBSOLETE #define SYMBOL_CHILL_DEMANGLED_NAME(symbol) */ /* OBSOLETE (symbol)->ginfo.language_specific.chill_specific.demangled_name */ -#define SYMBOL_OBJC_DEMANGLED_NAME(symbol) \ - (symbol)->ginfo.language_specific.objc_specific.demangled_name - /* Macro that returns the "natural source name" of a symbol. In C++ this is the "demangled" form of the name if demangle is on and the "mangled" form of the name if demangle is off. In other languages this is just the diff --git a/gdb/utils.c b/gdb/utils.c index 0b151264403..92c097a7f88 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -152,13 +152,13 @@ int quit_flag; int immediate_quit; -/* Nonzero means that encoded C++/ObjC names should be printed out in their - C++/ObjC form rather than raw. */ +/* Nonzero means that encoded C++ names should be printed out in their + C++ form rather than raw. */ int demangle = 1; -/* Nonzero means that encoded C++/ObjC names should be printed out in their - C++/ObjC form even in assembler language displays. If this is set, but +/* Nonzero means that encoded C++ names should be printed out in their + C++ form even in assembler language displays. If this is set, but DEMANGLE is zero, names are printed raw, i.e. DEMANGLE controls. */ int asm_demangle = 0; @@ -276,7 +276,7 @@ make_my_cleanup (struct cleanup **pmy_chain, make_cleanup_ftype *function, void *arg) { register struct cleanup *new - = (struct cleanup *) xmalloc (sizeof (struct cleanup)); + = (struct cleanup *) xmalloc (sizeof (struct cleanup)); register struct cleanup *old_chain = *pmy_chain; new->next = *pmy_chain; @@ -1776,51 +1776,6 @@ wrap_here (char *indent) } } -/* Print input string to gdb_stdout, filtered, with wrap, - arranging strings in columns of n chars. String can be - right or left justified in the column. Never prints - trailing spaces. String should never be longer than - width. FIXME: this could be useful for the EXAMINE - command, which currently doesn't tabulate very well. */ - -void -puts_filtered_tabular (char *string, int width, int right) -{ - int spaces = 0; - int stringlen; - char *spacebuf; - - gdb_assert (chars_per_line > 0); - if (chars_per_line == UINT_MAX) - { - fputs_filtered (string, gdb_stdout); - fputs_filtered ("\n", gdb_stdout); - return; - } - - if (((chars_printed - 1) / width + 2) * width >= chars_per_line) - fputs_filtered ("\n", gdb_stdout); - - if (width >= chars_per_line) - width = chars_per_line - 1; - - stringlen = strlen (string); - - if (chars_printed > 0) - spaces = width - (chars_printed - 1) % width - 1; - if (right) - spaces += width - stringlen; - - spacebuf = alloca (spaces + 1); - spacebuf[spaces] = '\0'; - while (spaces--) - spacebuf[spaces] = ' '; - - fputs_filtered (spacebuf, gdb_stdout); - fputs_filtered (string, gdb_stdout); -} - - /* Ensure that whatever gets printed next, using the filtered output commands, starts at the beginning of the line. I.E. if there is any pending output for the current line, flush it and start a new @@ -2248,18 +2203,15 @@ print_spaces_filtered (int n, struct ui_file *stream) fputs_filtered (n_spaces (n), stream); } -/* C++/ObjC demangler stuff. */ +/* C++ demangler stuff. */ -/* fprintf_symbol_filtered attempts to demangle NAME, a symbol in - language LANG, using demangling args ARG_MODE, and print it - filtered to STREAM. If the name is not mangled, or the language - for the name is unknown, or demangling is off, the name is printed - in its "raw" form. */ +/* fprintf_symbol_filtered attempts to demangle NAME, a symbol in language + LANG, using demangling args ARG_MODE, and print it filtered to STREAM. + If the name is not mangled, or the language for the name is unknown, or + demangling is off, the name is printed in its "raw" form. */ void -fprintf_symbol_filtered (struct ui_file *stream, - char *name, - enum language lang, +fprintf_symbol_filtered (struct ui_file *stream, char *name, enum language lang, int arg_mode) { char *demangled; @@ -2281,11 +2233,6 @@ fprintf_symbol_filtered (struct ui_file *stream, case language_java: demangled = cplus_demangle (name, arg_mode | DMGL_JAVA); break; -#if 0 /* Enable once objective-c support is turned on. */ - case language_objc: - demangled = objc_demangle (name); - break; -#endif #if 0 /* OBSOLETE case language_chill: */ /* OBSOLETE demangled = chill_demangle (name); */ @@ -2405,7 +2352,7 @@ initialize_utils (void) add_show_from_set (add_set_cmd ("demangle", class_support, var_boolean, (char *) &demangle, - "Set demangling of encoded C++/ObjC names when displaying symbols.", + "Set demangling of encoded C++ names when displaying symbols.", &setprintlist), &showprintlist); @@ -2433,7 +2380,7 @@ initialize_utils (void) add_show_from_set (add_set_cmd ("asm-demangle", class_support, var_boolean, (char *) &asm_demangle, - "Set demangling of C++/ObjC names in disassembly listings.", + "Set demangling of C++ names in disassembly listings.", &setprintlist), &showprintlist); } diff --git a/gdb/valops.c b/gdb/valops.c index 3de3409b3b9..eaf42953108 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -48,8 +48,10 @@ extern int overload_debug; static int typecmp (int staticp, int varargs, int nargs, struct field t1[], struct value *t2[]); +static CORE_ADDR find_function_addr (struct value *, struct type **); static struct value *value_arg_coerce (struct value *, struct type *, int); + static CORE_ADDR value_push (CORE_ADDR, struct value *); static struct value *search_struct_field (char *, struct value *, int, @@ -89,6 +91,7 @@ int overload_resolution = 0; int unwind_on_signal_p = 0; + /* Find the address of function name NAME in the inferior. */ struct value * @@ -1216,7 +1219,7 @@ value_arg_coerce (struct value *arg, struct type *param_type, /* Determine a function's address and its return type from its value. Calls error() if the function is not valid for calling. */ -CORE_ADDR +static CORE_ADDR find_function_addr (struct value *function, struct type **retval_type) { register struct type *ftype = check_typedef (VALUE_TYPE (function)); @@ -1886,23 +1889,6 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) error ("Cannot invoke functions on this machine."); } } - -struct value * -call_function_by_hand_expecting_type (struct value *function, - struct type *expect_type, - int nargs, struct value **args, - int restore_frame) -{ - if (CALL_DUMMY_P) - { - /* FIXME: Changes to func not implemented yet */ - return hand_function_call (function, nargs, args); - } - else - { - error ("Cannot invoke functions on this machine."); - } -} @@ -3317,17 +3303,21 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop, return new_val; } -/* Return the value of the local variable, if one exists. + + + +/* C++: return the value of the class instance variable, if one exists. Flag COMPLAIN signals an error if the request is made in an inappropriate context. */ struct value * -value_of_local (const char *name, int complain) +value_of_this (int complain) { struct symbol *func, *sym; struct block *b; int i; - struct value * ret; + static const char funny_this[] = "this"; + struct value *this; if (selected_frame == 0) { @@ -3341,7 +3331,7 @@ value_of_local (const char *name, int complain) if (!func) { if (complain) - error ("no %s in nameless context", name); + error ("no `this' in nameless context"); else return 0; } @@ -3351,39 +3341,26 @@ value_of_local (const char *name, int complain) if (i <= 0) { if (complain) - error ("no args, no %s", name); + error ("no args, no `this'"); else return 0; } /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER symbol instead of the LOC_ARG one (if both exist). */ - sym = lookup_block_symbol (b, name, NULL, VAR_NAMESPACE); + sym = lookup_block_symbol (b, funny_this, NULL, VAR_NAMESPACE); if (sym == NULL) { if (complain) - error ("current stack frame does not contain a variable named \"%s\"", name); + error ("current stack frame not in method"); else return NULL; } - ret = read_var_value (sym, selected_frame); - if (ret == 0 && complain) - error ("%s argument unreadable", name); - return ret; -} - -/* C++/Objective-C: return the value of the class instance variable, - if one exists. Flag COMPLAIN signals an error if the request is - made in an inappropriate context. */ - -struct value * -value_of_this (int complain) -{ - if (current_language->la_language == language_objc) - return value_of_local ("self", complain); - else - return value_of_local ("this", complain); + this = read_var_value (sym, selected_frame); + if (this == 0 && complain) + error ("`this' argument at unknown address"); + return this; } /* Create a slice (sub-string, sub-array) of ARRAY, that is LENGTH elements diff --git a/gdb/value.h b/gdb/value.h index 7fa4edc50f1..efabecb8806 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -535,12 +535,6 @@ extern void clear_value_history (void); extern void clear_internalvars (void); -/* Objective-C */ - -extern struct value *value_of_local (const char *name, int complain); - -extern struct value *value_nsstring (char *ptr, int len); - /* From values.c */ extern struct value *value_copy (struct value *); @@ -554,10 +548,6 @@ extern struct value *value_slice (struct value *, int, int); extern struct value *call_function_by_hand (struct value *, int, struct value **); -extern struct value *call_function_by_hand_expecting_type (struct value *, - struct type *, int, - struct value **, int); - extern int default_coerce_float_to_double (struct type *, struct type *); extern int standard_coerce_float_to_double (struct type *, struct type *); @@ -576,6 +566,4 @@ extern CORE_ADDR default_push_arguments (int nargs, struct value ** args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); -extern CORE_ADDR find_function_addr (struct value *, struct type **); - #endif /* !defined (VALUE_H) */ -- 2.30.2