From 3b4efeaa2da94f19becde56d8c8f9693367acafc Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Thu, 19 Sep 2002 01:34:51 +0000 Subject: 2002-09-18 Michael Snyder 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. --- gdb/parse.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gdb/parse.c') diff --git a/gdb/parse.c b/gdb/parse.c index c5de0af..8ae53d8 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -867,6 +867,11 @@ 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; @@ -898,6 +903,8 @@ 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); @@ -936,6 +943,7 @@ length_of_subexp (register struct expression *expr, register int endpos) /* C++ */ case OP_THIS: + case OP_SELF: oplen = 2; break; @@ -1004,6 +1012,11 @@ 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; @@ -1034,6 +1047,8 @@ 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); @@ -1072,6 +1087,7 @@ prefixify_subexp (register struct expression *inexpr, /* C++ */ case OP_THIS: + case OP_SELF: oplen = 2; break; -- cgit v1.1