diff options
author | Michael Snyder <msnyder@vmware.com> | 2002-09-19 01:34:51 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2002-09-19 01:34:51 +0000 |
commit | 3b4efeaa2da94f19becde56d8c8f9693367acafc (patch) | |
tree | 317d932941134a8b5cb49e89a4f86179519f429f /gdb/valops.c | |
parent | b9caf5053f5684f063a33357b6483cd2b62de0ec (diff) | |
download | gdb-3b4efeaa2da94f19becde56d8c8f9693367acafc.zip gdb-3b4efeaa2da94f19becde56d8c8f9693367acafc.tar.gz gdb-3b4efeaa2da94f19becde56d8c8f9693367acafc.tar.bz2 |
2002-09-18 Michael Snyder <msnyder@redhat.com>
Preliminary support for Objective-C:
* defs.h (language_objc): New enum value.
(puts_filtered_tabular): Declaration only, exported from utils.c.
(skip_quoted): Delete, declared in completer.h.
* c-exp.y: Include completer.h.
* p-exp.y: Ditto.
* jv-exp.y: Ditto.
* expression.h (OP_MSGCALL, OP_SELECTOR, OP_SELF, OP_NSSTRING):
New operator enum values.
* language.h (CAST_IS_CONVERSION): Test for language_objc.
* language.c (binop_result_type): Handle language_objc case.
(integral_type, character_type, string_type, boolean_type,
structured_type, binop_type_check): Ditto.
* symtab.h (SYMBOL_OBJC_DEMANGLED_NAME): Define.
(struct objc_specific): Add to general_symbol_info.
(SYMBOL_INIT_LANGUAGE_SPECIFIC): Add objc initialization.
(SYMBOL_DEMANGLED_NAME): Handle objc case.
* parser-defs.h (struct objc_class_str): New struct type.
(start_msglist, end_msglist, add_msglist): Declaration only,
exported from objc-lang.c.
* value.h (value_of_local, value_nsstring,
call_function_by_hand_expecting_type): Exported from valops.c.
* valops.c (find_function_addr): Export.
(call_function_by_hand_expecting_type): New function.
(value_of_local): New function.
* symfile.c (init_filename_language_table): Add ".m" extension
for Objective-C.
* utils.c (puts_filtered_tabular): New function.
(fprintf_symbol_filtered): Add objc demangling support (disabled).
(set/show demangle): Extend help-string to refer to ObjC.
* elfread.c (elf_symtab_read): Skip Objective-C special symbols.
* stabsread.c (symbol_reference_defined): Objective-C symbols
may contain colons: make allowances when scanning stabs strings
for colons.
(objc_find_colon): New function.
* printcmd.c (address_info): If language == objc then print
"self" instead of "this".
* parse.c (length_of_subexp): Handle new operators OP_MSGCALL,
OP_NSSTRING, and OP_SELF.
(prefixify_subexp): Ditto.
* source.c (print_source_lines): Mention objc in comment.
* breakpoint.c (parse_breakpoint_sals): Recognize Objective-C
method names.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index eaf4295..3de3409 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -48,10 +48,8 @@ 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, @@ -91,7 +89,6 @@ int overload_resolution = 0; int unwind_on_signal_p = 0; - /* Find the address of function name NAME in the inferior. */ struct value * @@ -1219,7 +1216,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. */ -static CORE_ADDR +CORE_ADDR find_function_addr (struct value *function, struct type **retval_type) { register struct type *ftype = check_typedef (VALUE_TYPE (function)); @@ -1889,6 +1886,23 @@ 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."); + } +} @@ -3303,21 +3317,17 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop, return new_val; } - - - -/* C++: return the value of the class instance variable, if one exists. +/* Return the value of the local 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) +value_of_local (const char *name, int complain) { struct symbol *func, *sym; struct block *b; int i; - static const char funny_this[] = "this"; - struct value *this; + struct value * ret; if (selected_frame == 0) { @@ -3331,7 +3341,7 @@ value_of_this (int complain) if (!func) { if (complain) - error ("no `this' in nameless context"); + error ("no %s in nameless context", name); else return 0; } @@ -3341,26 +3351,39 @@ value_of_this (int complain) if (i <= 0) { if (complain) - error ("no args, no `this'"); + error ("no args, no %s", name); 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, funny_this, NULL, VAR_NAMESPACE); + sym = lookup_block_symbol (b, name, NULL, VAR_NAMESPACE); if (sym == NULL) { if (complain) - error ("current stack frame not in method"); + error ("current stack frame does not contain a variable named \"%s\"", name); else return NULL; } - this = read_var_value (sym, selected_frame); - if (this == 0 && complain) - error ("`this' argument at unknown address"); - return this; + 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); } /* Create a slice (sub-string, sub-array) of ARRAY, that is LENGTH elements |