X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fobjc-lang.c;h=43d83da0ba772e806f3cb3d04c5aa1160bb7a197;hb=ec8f76882145c71bef81a9cadf0bf51ff9fa5b35;hp=34f90e872eac1fb16a9c189f8cf5661fc7752268;hpb=b3f11165aad39586cca0352ed5fe32b721699c76;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 34f90e872e..43d83da0ba 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -281,6 +281,15 @@ objc_demangle (const char *mangled, int options) return NULL; /* Not an objc mangled name. */ } +/* la_sniff_from_mangled_name for ObjC. */ + +static int +objc_sniff_from_mangled_name (const char *mangled, char **demangled) +{ + *demangled = objc_demangle (mangled, 0); + return *demangled != NULL; +} + /* Determine if we are currently in the Objective-C dispatch function. If so, get the address of the method function that the dispatcher would call and use that as the function to step into instead. Also @@ -350,6 +359,11 @@ static const struct op_print objc_op_print_tab[] = {NULL, OP_NULL, PREC_NULL, 0} }; +static const char *objc_extensions[] = +{ + ".m", NULL +}; + const struct language_defn objc_language_defn = { "objective-c", /* Language name */ "Objective-C", @@ -358,6 +372,7 @@ const struct language_defn objc_language_defn = { case_sensitive_on, array_row_major, macro_expansion_c, + objc_extensions, &exp_descriptor_standard, c_parse, c_yyerror, @@ -375,6 +390,7 @@ const struct language_defn objc_language_defn = { basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ basic_lookup_transparent_type,/* lookup_transparent_type */ objc_demangle, /* Language specific symbol demangler */ + objc_sniff_from_mangled_name, NULL, /* Language specific class_name_from_physname */ objc_op_print_tab, /* Expression operators for printing */ @@ -1177,14 +1193,11 @@ print_object_command (char *args, int from_tty) "The 'print-object' command requires an argument (an Objective-C object)"); { - struct expression *expr = parse_expression (args); - struct cleanup *old_chain = - make_cleanup (free_current_contents, &expr); + expression_up expr = parse_expression (args); int pc = 0; object = evaluate_subexp (builtin_type (expr->gdbarch)->builtin_data_ptr, - expr, &pc, EVAL_NORMAL); - do_cleanups (old_chain); + expr.get (), &pc, EVAL_NORMAL); } /* Validate the address for sanity. */