1 /* Objective-C language support routines for GDB, the GNU debugger.
3 Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
5 Contributed by Apple Computer, Inc.
6 Written by Michael Snyder.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA. */
28 #include "expression.h"
29 #include "parser-defs.h"
32 #include "objc-lang.h"
33 #include "exceptions.h"
34 #include "complaints.h"
38 #include "gdb_string.h" /* for strchr */
39 #include "target.h" /* for target_has_execution */
43 #include "gdb_regex.h"
48 #include "gdb_assert.h"
58 CORE_ADDR super_class
;
80 /* Lookup a structure type named "struct NAME", visible in lexical
81 block BLOCK. If NOERR is nonzero, return zero if NAME is not
85 lookup_struct_typedef (char *name
, struct block
*block
, int noerr
)
89 sym
= lookup_symbol (name
, block
, STRUCT_DOMAIN
, 0,
90 (struct symtab
**) NULL
);
97 error (_("No struct type named %s."), name
);
99 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
104 error (_("This context has class, union or enum %s, not a struct."),
111 lookup_objc_class (char *classname
)
113 struct value
* function
, *classval
;
115 if (! target_has_execution
)
117 /* Can't call into inferior to lookup class. */
121 if (lookup_minimal_symbol("objc_lookUpClass", 0, 0))
122 function
= find_function_in_inferior("objc_lookUpClass");
123 else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0))
124 function
= find_function_in_inferior("objc_lookup_class");
127 complaint (&symfile_complaints
, _("no way to lookup Objective-C classes"));
131 classval
= value_string (classname
, strlen (classname
) + 1);
132 classval
= value_coerce_array (classval
);
133 return (CORE_ADDR
) value_as_long (call_function_by_hand (function
,
138 lookup_child_selector (char *selname
)
140 struct value
* function
, *selstring
;
142 if (! target_has_execution
)
144 /* Can't call into inferior to lookup selector. */
148 if (lookup_minimal_symbol("sel_getUid", 0, 0))
149 function
= find_function_in_inferior("sel_getUid");
150 else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0))
151 function
= find_function_in_inferior("sel_get_any_uid");
154 complaint (&symfile_complaints
, _("no way to lookup Objective-C selectors"));
158 selstring
= value_coerce_array (value_string (selname
,
159 strlen (selname
) + 1));
160 return value_as_long (call_function_by_hand (function
, 1, &selstring
));
164 value_nsstring (char *ptr
, int len
)
166 struct value
*stringValue
[3];
167 struct value
*function
, *nsstringValue
;
171 if (!target_has_execution
)
172 return 0; /* Can't call into inferior to create NSString. */
174 sym
= lookup_struct_typedef("NSString", 0, 1);
176 sym
= lookup_struct_typedef("NXString", 0, 1);
178 type
= lookup_pointer_type(builtin_type_void
);
180 type
= lookup_pointer_type(SYMBOL_TYPE (sym
));
182 stringValue
[2] = value_string(ptr
, len
);
183 stringValue
[2] = value_coerce_array(stringValue
[2]);
184 /* _NSNewStringFromCString replaces "istr" after Lantern2A. */
185 if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0))
187 function
= find_function_in_inferior("_NSNewStringFromCString");
188 nsstringValue
= call_function_by_hand(function
, 1, &stringValue
[2]);
190 else if (lookup_minimal_symbol("istr", 0, 0))
192 function
= find_function_in_inferior("istr");
193 nsstringValue
= call_function_by_hand(function
, 1, &stringValue
[2]);
195 else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0))
197 function
= find_function_in_inferior("+[NSString stringWithCString:]");
198 stringValue
[0] = value_from_longest
199 (builtin_type_long
, lookup_objc_class ("NSString"));
200 stringValue
[1] = value_from_longest
201 (builtin_type_long
, lookup_child_selector ("stringWithCString:"));
202 nsstringValue
= call_function_by_hand(function
, 3, &stringValue
[0]);
205 error (_("NSString: internal error -- no way to create new NSString"));
207 deprecated_set_value_type (nsstringValue
, type
);
208 return nsstringValue
;
211 /* Objective-C name demangling. */
214 objc_demangle (const char *mangled
, int options
)
216 char *demangled
, *cp
;
218 if (mangled
[0] == '_' &&
219 (mangled
[1] == 'i' || mangled
[1] == 'c') &&
222 cp
= demangled
= xmalloc(strlen(mangled
) + 2);
224 if (mangled
[1] == 'i')
225 *cp
++ = '-'; /* for instance method */
227 *cp
++ = '+'; /* for class method */
229 *cp
++ = '['; /* opening left brace */
230 strcpy(cp
, mangled
+3); /* tack on the rest of the mangled name */
232 while (*cp
&& *cp
== '_')
233 cp
++; /* skip any initial underbars in class name */
235 cp
= strchr(cp
, '_');
236 if (!cp
) /* find first non-initial underbar */
238 xfree(demangled
); /* not mangled name */
241 if (cp
[1] == '_') { /* easy case: no category name */
242 *cp
++ = ' '; /* replace two '_' with one ' ' */
243 strcpy(cp
, mangled
+ (cp
- demangled
) + 2);
246 *cp
++ = '('; /* less easy case: category name */
247 cp
= strchr(cp
, '_');
250 xfree(demangled
); /* not mangled name */
254 *cp
++ = ' '; /* overwriting 1st char of method name... */
255 strcpy(cp
, mangled
+ (cp
- demangled
)); /* get it back */
258 while (*cp
&& *cp
== '_')
259 cp
++; /* skip any initial underbars in method name */
263 *cp
= ':'; /* replace remaining '_' with ':' */
265 *cp
++ = ']'; /* closing right brace */
266 *cp
++ = 0; /* string terminator */
270 return NULL
; /* Not an objc mangled name. */
273 /* Print the character C on STREAM as part of the contents of a
274 literal string whose delimiter is QUOTER. Note that that format
275 for printing characters and strings is language specific. */
278 objc_emit_char (int c
, struct ui_file
*stream
, int quoter
)
281 c
&= 0xFF; /* Avoid sign bit follies. */
283 if (PRINT_LITERAL_FORM (c
))
285 if (c
== '\\' || c
== quoter
)
287 fputs_filtered ("\\", stream
);
289 fprintf_filtered (stream
, "%c", c
);
296 fputs_filtered ("\\n", stream
);
299 fputs_filtered ("\\b", stream
);
302 fputs_filtered ("\\t", stream
);
305 fputs_filtered ("\\f", stream
);
308 fputs_filtered ("\\r", stream
);
311 fputs_filtered ("\\e", stream
);
314 fputs_filtered ("\\a", stream
);
317 fprintf_filtered (stream
, "\\%.3o", (unsigned int) c
);
324 objc_printchar (int c
, struct ui_file
*stream
)
326 fputs_filtered ("'", stream
);
327 objc_emit_char (c
, stream
, '\'');
328 fputs_filtered ("'", stream
);
331 /* Print the character string STRING, printing at most LENGTH
332 characters. Printing stops early if the number hits print_max;
333 repeat counts are printed as appropriate. Print ellipses at the
334 end if we had to stop before printing LENGTH characters, or if
338 objc_printstr (struct ui_file
*stream
, const gdb_byte
*string
,
339 unsigned int length
, int width
, int force_ellipses
)
342 unsigned int things_printed
= 0;
346 /* If the string was not truncated due to `set print elements', and
347 the last byte of it is a null, we don't print that, in
348 traditional C style. */
349 if ((!force_ellipses
) && length
> 0 && string
[length
-1] == '\0')
354 fputs_filtered ("\"\"", stream
);
358 for (i
= 0; i
< length
&& things_printed
< print_max
; ++i
)
360 /* Position of the character we are examining to see whether it
363 /* Number of repetitions we have detected so far. */
370 fputs_filtered (", ", stream
);
376 while (rep1
< length
&& string
[rep1
] == string
[i
])
382 if (reps
> repeat_count_threshold
)
387 fputs_filtered ("\\\", ", stream
);
389 fputs_filtered ("\", ", stream
);
392 objc_printchar (string
[i
], stream
);
393 fprintf_filtered (stream
, " <repeats %u times>", reps
);
395 things_printed
+= repeat_count_threshold
;
403 fputs_filtered ("\\\"", stream
);
405 fputs_filtered ("\"", stream
);
408 objc_emit_char (string
[i
], stream
, '"');
413 /* Terminate the quotes if necessary. */
417 fputs_filtered ("\\\"", stream
);
419 fputs_filtered ("\"", stream
);
422 if (force_ellipses
|| i
< length
)
423 fputs_filtered ("...", stream
);
426 /* Create a fundamental C type using default reasonable for the
429 Some object/debugging file formats (DWARF version 1, COFF, etc) do
430 not define fundamental types such as "int" or "double". Others
431 (stabs or DWARF version 2, etc) do define fundamental types. For
432 the formats which don't provide fundamental types, gdb can create
433 such types using this function.
435 FIXME: Some compilers distinguish explicitly signed integral types
436 (signed short, signed int, signed long) from "regular" integral
437 types (short, int, long) in the debugging information. There is
438 some disagreement as to how useful this feature is. In particular,
439 gcc does not support this. Also, only some debugging formats allow
440 the distinction to be passed on to a debugger. For now, we always
441 just use "short", "int", or "long" as the type name, for both the
442 implicit and explicitly signed types. This also makes life easier
443 for the gdb test suite since we don't have to account for the
444 differences in output depending upon what the compiler and
445 debugging format support. We will probably have to re-examine the
446 issue when gdb starts taking it's fundamental type information
447 directly from the debugging information supplied by the compiler.
451 objc_create_fundamental_type (struct objfile
*objfile
, int typeid)
453 struct type
*type
= NULL
;
458 /* FIXME: For now, if we are asked to produce a type not in
459 this language, create the equivalent of a C integer type
460 with the name "<?type?>". When all the dust settles from
461 the type reconstruction work, this should probably become
463 type
= init_type (TYPE_CODE_INT
,
464 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
465 0, "<?type?>", objfile
);
466 warning (_("internal error: no C/C++ fundamental type %d"), typeid);
469 type
= init_type (TYPE_CODE_VOID
,
470 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
474 type
= init_type (TYPE_CODE_INT
,
475 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
479 type
= init_type (TYPE_CODE_INT
,
480 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
481 0, "signed char", objfile
);
483 case FT_UNSIGNED_CHAR
:
484 type
= init_type (TYPE_CODE_INT
,
485 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
486 TYPE_FLAG_UNSIGNED
, "unsigned char", objfile
);
489 type
= init_type (TYPE_CODE_INT
,
490 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
491 0, "short", objfile
);
493 case FT_SIGNED_SHORT
:
494 type
= init_type (TYPE_CODE_INT
,
495 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
496 0, "short", objfile
); /* FIXME-fnf */
498 case FT_UNSIGNED_SHORT
:
499 type
= init_type (TYPE_CODE_INT
,
500 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
501 TYPE_FLAG_UNSIGNED
, "unsigned short", objfile
);
504 type
= init_type (TYPE_CODE_INT
,
505 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
508 case FT_SIGNED_INTEGER
:
509 type
= init_type (TYPE_CODE_INT
,
510 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
511 0, "int", objfile
); /* FIXME -fnf */
513 case FT_UNSIGNED_INTEGER
:
514 type
= init_type (TYPE_CODE_INT
,
515 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
516 TYPE_FLAG_UNSIGNED
, "unsigned int", objfile
);
519 type
= init_type (TYPE_CODE_INT
,
520 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
524 type
= init_type (TYPE_CODE_INT
,
525 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
526 0, "long", objfile
); /* FIXME -fnf */
528 case FT_UNSIGNED_LONG
:
529 type
= init_type (TYPE_CODE_INT
,
530 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
531 TYPE_FLAG_UNSIGNED
, "unsigned long", objfile
);
534 type
= init_type (TYPE_CODE_INT
,
535 gdbarch_long_long_bit (current_gdbarch
)
537 0, "long long", objfile
);
539 case FT_SIGNED_LONG_LONG
:
540 type
= init_type (TYPE_CODE_INT
,
541 gdbarch_long_long_bit (current_gdbarch
)
543 0, "signed long long", objfile
);
545 case FT_UNSIGNED_LONG_LONG
:
546 type
= init_type (TYPE_CODE_INT
,
547 gdbarch_long_long_bit (current_gdbarch
)
549 TYPE_FLAG_UNSIGNED
, "unsigned long long", objfile
);
552 type
= init_type (TYPE_CODE_FLT
,
553 gdbarch_float_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
554 0, "float", objfile
);
556 case FT_DBL_PREC_FLOAT
:
557 type
= init_type (TYPE_CODE_FLT
,
558 gdbarch_double_bit (current_gdbarch
)
560 0, "double", objfile
);
562 case FT_EXT_PREC_FLOAT
:
563 type
= init_type (TYPE_CODE_FLT
,
564 gdbarch_long_double_bit (current_gdbarch
)
566 0, "long double", objfile
);
572 /* Determine if we are currently in the Objective-C dispatch function.
573 If so, get the address of the method function that the dispatcher
574 would call and use that as the function to step into instead. Also
575 skip over the trampoline for the function (if any). This is better
576 for the user since they are only interested in stepping into the
577 method function anyway. */
579 objc_skip_trampoline (CORE_ADDR stop_pc
)
581 CORE_ADDR real_stop_pc
;
582 CORE_ADDR method_stop_pc
;
584 real_stop_pc
= gdbarch_skip_trampoline_code (current_gdbarch
, stop_pc
);
586 if (real_stop_pc
!= 0)
587 find_objc_msgcall (real_stop_pc
, &method_stop_pc
);
589 find_objc_msgcall (stop_pc
, &method_stop_pc
);
593 real_stop_pc
= gdbarch_skip_trampoline_code
594 (current_gdbarch
, method_stop_pc
);
595 if (real_stop_pc
== 0)
596 real_stop_pc
= method_stop_pc
;
603 /* Table mapping opcodes into strings for printing operators
604 and precedences of the operators. */
606 static const struct op_print objc_op_print_tab
[] =
608 {",", BINOP_COMMA
, PREC_COMMA
, 0},
609 {"=", BINOP_ASSIGN
, PREC_ASSIGN
, 1},
610 {"||", BINOP_LOGICAL_OR
, PREC_LOGICAL_OR
, 0},
611 {"&&", BINOP_LOGICAL_AND
, PREC_LOGICAL_AND
, 0},
612 {"|", BINOP_BITWISE_IOR
, PREC_BITWISE_IOR
, 0},
613 {"^", BINOP_BITWISE_XOR
, PREC_BITWISE_XOR
, 0},
614 {"&", BINOP_BITWISE_AND
, PREC_BITWISE_AND
, 0},
615 {"==", BINOP_EQUAL
, PREC_EQUAL
, 0},
616 {"!=", BINOP_NOTEQUAL
, PREC_EQUAL
, 0},
617 {"<=", BINOP_LEQ
, PREC_ORDER
, 0},
618 {">=", BINOP_GEQ
, PREC_ORDER
, 0},
619 {">", BINOP_GTR
, PREC_ORDER
, 0},
620 {"<", BINOP_LESS
, PREC_ORDER
, 0},
621 {">>", BINOP_RSH
, PREC_SHIFT
, 0},
622 {"<<", BINOP_LSH
, PREC_SHIFT
, 0},
623 {"+", BINOP_ADD
, PREC_ADD
, 0},
624 {"-", BINOP_SUB
, PREC_ADD
, 0},
625 {"*", BINOP_MUL
, PREC_MUL
, 0},
626 {"/", BINOP_DIV
, PREC_MUL
, 0},
627 {"%", BINOP_REM
, PREC_MUL
, 0},
628 {"@", BINOP_REPEAT
, PREC_REPEAT
, 0},
629 {"-", UNOP_NEG
, PREC_PREFIX
, 0},
630 {"!", UNOP_LOGICAL_NOT
, PREC_PREFIX
, 0},
631 {"~", UNOP_COMPLEMENT
, PREC_PREFIX
, 0},
632 {"*", UNOP_IND
, PREC_PREFIX
, 0},
633 {"&", UNOP_ADDR
, PREC_PREFIX
, 0},
634 {"sizeof ", UNOP_SIZEOF
, PREC_PREFIX
, 0},
635 {"++", UNOP_PREINCREMENT
, PREC_PREFIX
, 0},
636 {"--", UNOP_PREDECREMENT
, PREC_PREFIX
, 0},
637 {NULL
, OP_NULL
, PREC_NULL
, 0}
640 struct type
** const (objc_builtin_types
[]) =
647 &builtin_type_double
,
649 &builtin_type_long_long
,
650 &builtin_type_signed_char
,
651 &builtin_type_unsigned_char
,
652 &builtin_type_unsigned_short
,
653 &builtin_type_unsigned_int
,
654 &builtin_type_unsigned_long
,
655 &builtin_type_unsigned_long_long
,
656 &builtin_type_long_double
,
657 &builtin_type_complex
,
658 &builtin_type_double_complex
,
662 const struct language_defn objc_language_defn
= {
663 "objective-c", /* Language name */
670 &exp_descriptor_standard
,
674 objc_printchar
, /* Print a character constant */
675 objc_printstr
, /* Function to print string constant */
677 objc_create_fundamental_type
, /* Create fundamental type in this language */
678 c_print_type
, /* Print a type using appropriate syntax */
679 c_val_print
, /* Print a value using appropriate syntax */
680 c_value_print
, /* Print a top-level value */
681 objc_skip_trampoline
, /* Language specific skip_trampoline */
682 value_of_this
, /* value_of_this */
683 basic_lookup_symbol_nonlocal
, /* lookup_symbol_nonlocal */
684 basic_lookup_transparent_type
,/* lookup_transparent_type */
685 objc_demangle
, /* Language specific symbol demangler */
686 NULL
, /* Language specific class_name_from_physname */
687 objc_op_print_tab
, /* Expression operators for printing */
688 1, /* C-style arrays */
689 0, /* String lower bound */
690 &builtin_type_char
, /* Type of string elements */
691 default_word_break_characters
,
692 NULL
, /* FIXME: la_language_arch_info. */
693 default_print_array_index
,
699 * Following functions help construct Objective-C message calls
702 struct selname
/* For parsing Objective-C. */
704 struct selname
*next
;
709 static int msglist_len
;
710 static struct selname
*selname_chain
;
711 static char *msglist_sel
;
716 struct selname
*new =
717 (struct selname
*) xmalloc (sizeof (struct selname
));
719 new->next
= selname_chain
;
720 new->msglist_len
= msglist_len
;
721 new->msglist_sel
= msglist_sel
;
723 msglist_sel
= (char *)xmalloc(1);
729 add_msglist(struct stoken
*str
, int addcolon
)
734 if (str
== 0) { /* Unnamed arg, or... */
735 if (addcolon
== 0) { /* variable number of args. */
745 len
= plen
+ strlen(msglist_sel
) + 2;
746 s
= (char *)xmalloc(len
);
747 strcpy(s
, msglist_sel
);
762 int val
= msglist_len
;
763 struct selname
*sel
= selname_chain
;
764 char *p
= msglist_sel
;
767 selname_chain
= sel
->next
;
768 msglist_len
= sel
->msglist_len
;
769 msglist_sel
= sel
->msglist_sel
;
770 selid
= lookup_child_selector(p
);
772 error (_("Can't find selector \"%s\""), p
);
773 write_exp_elt_longcst (selid
);
775 write_exp_elt_longcst (val
); /* Number of args */
782 * Function: specialcmp (char *a, char *b)
784 * Special strcmp: treats ']' and ' ' as end-of-string.
785 * Used for qsorting lists of objc methods (either by class or selector).
789 specialcmp (char *a
, char *b
)
791 while (*a
&& *a
!= ' ' && *a
!= ']' && *b
&& *b
!= ' ' && *b
!= ']')
797 if (*a
&& *a
!= ' ' && *a
!= ']')
798 return 1; /* a is longer therefore greater */
799 if (*b
&& *b
!= ' ' && *b
!= ']')
800 return -1; /* a is shorter therefore lesser */
801 return 0; /* a and b are identical */
805 * Function: compare_selectors (const void *, const void *)
807 * Comparison function for use with qsort. Arguments are symbols or
808 * msymbols Compares selector part of objc method name alphabetically.
812 compare_selectors (const void *a
, const void *b
)
816 aname
= SYMBOL_PRINT_NAME (*(struct symbol
**) a
);
817 bname
= SYMBOL_PRINT_NAME (*(struct symbol
**) b
);
818 if (aname
== NULL
|| bname
== NULL
)
819 error (_("internal: compare_selectors(1)"));
821 aname
= strchr(aname
, ' ');
822 bname
= strchr(bname
, ' ');
823 if (aname
== NULL
|| bname
== NULL
)
824 error (_("internal: compare_selectors(2)"));
826 return specialcmp (aname
+1, bname
+1);
830 * Function: selectors_info (regexp, from_tty)
832 * Implements the "Info selectors" command. Takes an optional regexp
833 * arg. Lists all objective c selectors that match the regexp. Works
834 * by grepping thru all symbols for objective c methods. Output list
835 * is sorted and uniqued.
839 selectors_info (char *regexp
, int from_tty
)
841 struct objfile
*objfile
;
842 struct minimal_symbol
*msymbol
;
850 struct symbol
**sym_arr
;
854 strcpy(myregexp
, ".*]"); /* Null input, match all objc methods. */
857 if (*regexp
== '+' || *regexp
== '-')
858 { /* User wants only class methods or only instance methods. */
859 plusminus
= *regexp
++;
860 while (*regexp
== ' ' || *regexp
== '\t')
864 strcpy(myregexp
, ".*]");
867 strcpy(myregexp
, regexp
);
868 if (myregexp
[strlen(myregexp
) - 1] == '$') /* end of selector */
869 myregexp
[strlen(myregexp
) - 1] = ']'; /* end of method name */
871 strcat(myregexp
, ".*]");
877 val
= re_comp (myregexp
);
879 error (_("Invalid regexp (%s): %s"), val
, regexp
);
882 /* First time thru is JUST to get max length and count. */
883 ALL_MSYMBOLS (objfile
, msymbol
)
886 name
= SYMBOL_NATURAL_NAME (msymbol
);
888 (name
[0] == '-' || name
[0] == '+') &&
889 name
[1] == '[') /* Got a method name. */
891 /* Filter for class/instance methods. */
892 if (plusminus
&& name
[0] != plusminus
)
894 /* Find selector part. */
895 name
= (char *) strchr(name
+2, ' ');
896 if (regexp
== NULL
|| re_exec(++name
) != 0)
898 char *mystart
= name
;
899 char *myend
= (char *) strchr(mystart
, ']');
901 if (myend
&& (myend
- mystart
> maxlen
))
902 maxlen
= myend
- mystart
; /* Get longest selector. */
909 printf_filtered (_("Selectors matching \"%s\":\n\n"),
910 regexp
? regexp
: "*");
912 sym_arr
= alloca (matches
* sizeof (struct symbol
*));
914 ALL_MSYMBOLS (objfile
, msymbol
)
917 name
= SYMBOL_NATURAL_NAME (msymbol
);
919 (name
[0] == '-' || name
[0] == '+') &&
920 name
[1] == '[') /* Got a method name. */
922 /* Filter for class/instance methods. */
923 if (plusminus
&& name
[0] != plusminus
)
925 /* Find selector part. */
926 name
= (char *) strchr(name
+2, ' ');
927 if (regexp
== NULL
|| re_exec(++name
) != 0)
928 sym_arr
[matches
++] = (struct symbol
*) msymbol
;
932 qsort (sym_arr
, matches
, sizeof (struct minimal_symbol
*),
934 /* Prevent compare on first iteration. */
936 for (ix
= 0; ix
< matches
; ix
++) /* Now do the output. */
941 name
= SYMBOL_NATURAL_NAME (sym_arr
[ix
]);
942 name
= strchr (name
, ' ') + 1;
943 if (p
[0] && specialcmp(name
, p
) == 0)
944 continue; /* Seen this one already (not unique). */
946 /* Copy selector part. */
947 while (*name
&& *name
!= ']')
950 /* Print in columns. */
951 puts_filtered_tabular(asel
, maxlen
+ 1, 0);
956 printf_filtered (_("No selectors matching \"%s\"\n"), regexp
? regexp
: "*");
960 * Function: compare_classes (const void *, const void *)
962 * Comparison function for use with qsort. Arguments are symbols or
963 * msymbols Compares class part of objc method name alphabetically.
967 compare_classes (const void *a
, const void *b
)
971 aname
= SYMBOL_PRINT_NAME (*(struct symbol
**) a
);
972 bname
= SYMBOL_PRINT_NAME (*(struct symbol
**) b
);
973 if (aname
== NULL
|| bname
== NULL
)
974 error (_("internal: compare_classes(1)"));
976 return specialcmp (aname
+1, bname
+1);
980 * Function: classes_info(regexp, from_tty)
982 * Implements the "info classes" command for objective c classes.
983 * Lists all objective c classes that match the optional regexp.
984 * Works by grepping thru the list of objective c methods. List will
985 * be sorted and uniqued (since one class may have many methods).
986 * BUGS: will not list a class that has no methods.
990 classes_info (char *regexp
, int from_tty
)
992 struct objfile
*objfile
;
993 struct minimal_symbol
*msymbol
;
1001 struct symbol
**sym_arr
;
1004 strcpy(myregexp
, ".* "); /* Null input: match all objc classes. */
1007 strcpy(myregexp
, regexp
);
1008 if (myregexp
[strlen(myregexp
) - 1] == '$')
1009 /* In the method name, the end of the class name is marked by ' '. */
1010 myregexp
[strlen(myregexp
) - 1] = ' ';
1012 strcat(myregexp
, ".* ");
1017 val
= re_comp (myregexp
);
1019 error (_("Invalid regexp (%s): %s"), val
, regexp
);
1022 /* First time thru is JUST to get max length and count. */
1023 ALL_MSYMBOLS (objfile
, msymbol
)
1026 name
= SYMBOL_NATURAL_NAME (msymbol
);
1028 (name
[0] == '-' || name
[0] == '+') &&
1029 name
[1] == '[') /* Got a method name. */
1030 if (regexp
== NULL
|| re_exec(name
+2) != 0)
1032 /* Compute length of classname part. */
1033 char *mystart
= name
+ 2;
1034 char *myend
= (char *) strchr(mystart
, ' ');
1036 if (myend
&& (myend
- mystart
> maxlen
))
1037 maxlen
= myend
- mystart
;
1043 printf_filtered (_("Classes matching \"%s\":\n\n"),
1044 regexp
? regexp
: "*");
1045 sym_arr
= alloca (matches
* sizeof (struct symbol
*));
1047 ALL_MSYMBOLS (objfile
, msymbol
)
1050 name
= SYMBOL_NATURAL_NAME (msymbol
);
1052 (name
[0] == '-' || name
[0] == '+') &&
1053 name
[1] == '[') /* Got a method name. */
1054 if (regexp
== NULL
|| re_exec(name
+2) != 0)
1055 sym_arr
[matches
++] = (struct symbol
*) msymbol
;
1058 qsort (sym_arr
, matches
, sizeof (struct minimal_symbol
*),
1060 /* Prevent compare on first iteration. */
1062 for (ix
= 0; ix
< matches
; ix
++) /* Now do the output. */
1067 name
= SYMBOL_NATURAL_NAME (sym_arr
[ix
]);
1069 if (p
[0] && specialcmp(name
, p
) == 0)
1070 continue; /* Seen this one already (not unique). */
1072 /* Copy class part of method name. */
1073 while (*name
&& *name
!= ' ')
1076 /* Print in columns. */
1077 puts_filtered_tabular(aclass
, maxlen
+ 1, 0);
1082 printf_filtered (_("No classes matching \"%s\"\n"), regexp
? regexp
: "*");
1086 * Function: find_imps (char *selector, struct symbol **sym_arr)
1088 * Input: a string representing a selector
1089 * a pointer to an array of symbol pointers
1090 * possibly a pointer to a symbol found by the caller.
1092 * Output: number of methods that implement that selector. Side
1093 * effects: The array of symbol pointers is filled with matching syms.
1095 * By analogy with function "find_methods" (symtab.c), builds a list
1096 * of symbols matching the ambiguous input, so that "decode_line_2"
1097 * (symtab.c) can list them and ask the user to choose one or more.
1098 * In this case the matches are objective c methods
1099 * ("implementations") matching an objective c selector.
1101 * Note that it is possible for a normal (c-style) function to have
1102 * the same name as an objective c selector. To prevent the selector
1103 * from eclipsing the function, we allow the caller (decode_line_1) to
1104 * search for such a function first, and if it finds one, pass it in
1105 * to us. We will then integrate it into the list. We also search
1106 * for one here, among the minsyms.
1108 * NOTE: if NUM_DEBUGGABLE is non-zero, the sym_arr will be divided
1109 * into two parts: debuggable (struct symbol) syms, and
1110 * non_debuggable (struct minimal_symbol) syms. The debuggable
1111 * ones will come first, before NUM_DEBUGGABLE (which will thus
1112 * be the index of the first non-debuggable one).
1116 * Function: total_number_of_imps (char *selector);
1118 * Input: a string representing a selector
1119 * Output: number of methods that implement that selector.
1121 * By analogy with function "total_number_of_methods", this allows
1122 * decode_line_1 (symtab.c) to detect if there are objective c methods
1123 * matching the input, and to allocate an array of pointers to them
1124 * which can be manipulated by "decode_line_2" (also in symtab.c).
1128 parse_selector (char *method
, char **selector
)
1132 int found_quote
= 0;
1134 char *nselector
= NULL
;
1136 gdb_assert (selector
!= NULL
);
1140 while (isspace (*s1
))
1147 while (isspace (*s1
))
1154 if (isalnum (*s2
) || (*s2
== '_') || (*s2
== ':'))
1156 else if (isspace (*s2
))
1158 else if ((*s2
== '\0') || (*s2
== '\''))
1166 while (isspace (*s2
))
1172 while (isspace (*s2
))
1176 if (selector
!= NULL
)
1177 *selector
= nselector
;
1183 parse_method (char *method
, char *type
, char **class,
1184 char **category
, char **selector
)
1188 int found_quote
= 0;
1191 char *nclass
= NULL
;
1192 char *ncategory
= NULL
;
1193 char *nselector
= NULL
;
1195 gdb_assert (type
!= NULL
);
1196 gdb_assert (class != NULL
);
1197 gdb_assert (category
!= NULL
);
1198 gdb_assert (selector
!= NULL
);
1202 while (isspace (*s1
))
1209 while (isspace (*s1
))
1212 if ((s1
[0] == '+') || (s1
[0] == '-'))
1215 while (isspace (*s1
))
1223 while (isalnum (*s1
) || (*s1
== '_'))
1227 while (isspace (*s2
))
1233 while (isspace (*s2
))
1236 while (isalnum (*s2
) || (*s2
== '_'))
1241 /* Truncate the class name now that we're not using the open paren. */
1248 if (isalnum (*s2
) || (*s2
== '_') || (*s2
== ':'))
1250 else if (isspace (*s2
))
1252 else if (*s2
== ']')
1261 while (isspace (*s2
))
1268 while (isspace (*s2
))
1276 if (category
!= NULL
)
1277 *category
= ncategory
;
1278 if (selector
!= NULL
)
1279 *selector
= nselector
;
1285 find_methods (struct symtab
*symtab
, char type
,
1286 const char *class, const char *category
,
1287 const char *selector
, struct symbol
**syms
,
1288 unsigned int *nsym
, unsigned int *ndebug
)
1290 struct objfile
*objfile
= NULL
;
1291 struct minimal_symbol
*msymbol
= NULL
;
1292 struct block
*block
= NULL
;
1293 struct symbol
*sym
= NULL
;
1295 char *symname
= NULL
;
1298 char *nclass
= NULL
;
1299 char *ncategory
= NULL
;
1300 char *nselector
= NULL
;
1302 unsigned int csym
= 0;
1303 unsigned int cdebug
= 0;
1305 static char *tmp
= NULL
;
1306 static unsigned int tmplen
= 0;
1308 gdb_assert (nsym
!= NULL
);
1309 gdb_assert (ndebug
!= NULL
);
1312 block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab
), STATIC_BLOCK
);
1314 ALL_MSYMBOLS (objfile
, msymbol
)
1318 if ((msymbol
->type
!= mst_text
) && (msymbol
->type
!= mst_file_text
))
1319 /* Not a function or method. */
1323 if ((SYMBOL_VALUE_ADDRESS (msymbol
) < BLOCK_START (block
)) ||
1324 (SYMBOL_VALUE_ADDRESS (msymbol
) >= BLOCK_END (block
)))
1325 /* Not in the specified symtab. */
1328 symname
= SYMBOL_NATURAL_NAME (msymbol
);
1329 if (symname
== NULL
)
1332 if ((symname
[0] != '-' && symname
[0] != '+') || (symname
[1] != '['))
1333 /* Not a method name. */
1336 while ((strlen (symname
) + 1) >= tmplen
)
1338 tmplen
= (tmplen
== 0) ? 1024 : tmplen
* 2;
1339 tmp
= xrealloc (tmp
, tmplen
);
1341 strcpy (tmp
, symname
);
1343 if (parse_method (tmp
, &ntype
, &nclass
, &ncategory
, &nselector
) == NULL
)
1346 if ((type
!= '\0') && (ntype
!= type
))
1350 && ((nclass
== NULL
) || (strcmp (class, nclass
) != 0)))
1353 if ((category
!= NULL
) &&
1354 ((ncategory
== NULL
) || (strcmp (category
, ncategory
) != 0)))
1357 if ((selector
!= NULL
) &&
1358 ((nselector
== NULL
) || (strcmp (selector
, nselector
) != 0)))
1361 sym
= find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol
));
1364 const char *newsymname
= SYMBOL_NATURAL_NAME (sym
);
1366 if (strcmp (symname
, newsymname
) == 0)
1368 /* Found a high-level method sym: swap it into the
1369 lower part of sym_arr (below num_debuggable). */
1372 syms
[csym
] = syms
[cdebug
];
1381 "debugging symbol \"%s\" does not match minimal symbol (\"%s\"); ignoring",
1382 newsymname
, symname
);
1384 syms
[csym
] = (struct symbol
*) msymbol
;
1390 /* Found a non-debuggable method symbol. */
1392 syms
[csym
] = (struct symbol
*) msymbol
;
1403 char *find_imps (struct symtab
*symtab
, struct block
*block
,
1404 char *method
, struct symbol
**syms
,
1405 unsigned int *nsym
, unsigned int *ndebug
)
1409 char *category
= NULL
;
1410 char *selector
= NULL
;
1412 unsigned int csym
= 0;
1413 unsigned int cdebug
= 0;
1415 unsigned int ncsym
= 0;
1416 unsigned int ncdebug
= 0;
1421 gdb_assert (nsym
!= NULL
);
1422 gdb_assert (ndebug
!= NULL
);
1429 buf
= (char *) alloca (strlen (method
) + 1);
1430 strcpy (buf
, method
);
1431 tmp
= parse_method (buf
, &type
, &class, &category
, &selector
);
1435 struct symbol
*sym
= NULL
;
1436 struct minimal_symbol
*msym
= NULL
;
1438 strcpy (buf
, method
);
1439 tmp
= parse_selector (buf
, &selector
);
1444 sym
= lookup_symbol (selector
, block
, VAR_DOMAIN
, 0, NULL
);
1454 msym
= lookup_minimal_symbol (selector
, 0, 0);
1459 syms
[csym
] = (struct symbol
*)msym
;
1465 find_methods (symtab
, type
, class, category
, selector
,
1466 syms
+ csym
, &ncsym
, &ncdebug
);
1468 find_methods (symtab
, type
, class, category
, selector
,
1469 NULL
, &ncsym
, &ncdebug
);
1471 /* If we didn't find any methods, just return. */
1472 if (ncsym
== 0 && ncdebug
== 0)
1475 /* Take debug symbols from the second batch of symbols and swap them
1476 * with debug symbols from the first batch. Repeat until either the
1477 * second section is out of debug symbols or the first section is
1478 * full of debug symbols. Either way we have all debug symbols
1479 * packed to the beginning of the buffer.
1484 while ((cdebug
< csym
) && (ncdebug
> 0))
1486 struct symbol
*s
= NULL
;
1487 /* First non-debugging symbol. */
1488 unsigned int i
= cdebug
;
1489 /* Last of second batch of debug symbols. */
1490 unsigned int j
= csym
+ ncdebug
- 1;
1496 /* We've moved a symbol from the second debug section to the
1512 return method
+ (tmp
- buf
);
1516 /* Sort debuggable symbols. */
1518 qsort (syms
, cdebug
, sizeof (struct minimal_symbol
*),
1521 /* Sort minimal_symbols. */
1522 if ((csym
- cdebug
) > 1)
1523 qsort (&syms
[cdebug
], csym
- cdebug
,
1524 sizeof (struct minimal_symbol
*), compare_classes
);
1526 /* Terminate the sym_arr list. */
1529 return method
+ (tmp
- buf
);
1533 print_object_command (char *args
, int from_tty
)
1535 struct value
*object
, *function
, *description
;
1536 CORE_ADDR string_addr
, object_addr
;
1540 if (!args
|| !*args
)
1542 "The 'print-object' command requires an argument (an Objective-C object)");
1545 struct expression
*expr
= parse_expression (args
);
1546 struct cleanup
*old_chain
=
1547 make_cleanup (free_current_contents
, &expr
);
1550 object
= expr
->language_defn
->la_exp_desc
->evaluate_exp
1551 (builtin_type_void_data_ptr
, expr
, &pc
, EVAL_NORMAL
);
1552 do_cleanups (old_chain
);
1555 /* Validate the address for sanity. */
1556 object_addr
= value_as_long (object
);
1557 read_memory (object_addr
, &c
, 1);
1559 function
= find_function_in_inferior ("_NSPrintForDebugger");
1560 if (function
== NULL
)
1561 error (_("Unable to locate _NSPrintForDebugger in child process"));
1563 description
= call_function_by_hand (function
, 1, &object
);
1565 string_addr
= value_as_long (description
);
1566 if (string_addr
== 0)
1567 error (_("object returns null description"));
1569 read_memory (string_addr
+ i
++, &c
, 1);
1572 { /* Read and print characters up to EOS. */
1574 printf_filtered ("%c", c
);
1575 read_memory (string_addr
+ i
++, &c
, 1);
1578 printf_filtered(_("<object returns empty description>"));
1579 printf_filtered ("\n");
1582 /* The data structure 'methcalls' is used to detect method calls (thru
1583 * ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.),
1584 * and ultimately find the method being called.
1587 struct objc_methcall
{
1589 /* Return instance method to be called. */
1590 int (*stop_at
) (CORE_ADDR
, CORE_ADDR
*);
1591 /* Start of pc range corresponding to method invocation. */
1593 /* End of pc range corresponding to method invocation. */
1597 static int resolve_msgsend (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1598 static int resolve_msgsend_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1599 static int resolve_msgsend_super (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1600 static int resolve_msgsend_super_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1602 static struct objc_methcall methcalls
[] = {
1603 { "_objc_msgSend", resolve_msgsend
, 0, 0},
1604 { "_objc_msgSend_stret", resolve_msgsend_stret
, 0, 0},
1605 { "_objc_msgSendSuper", resolve_msgsend_super
, 0, 0},
1606 { "_objc_msgSendSuper_stret", resolve_msgsend_super_stret
, 0, 0},
1607 { "_objc_getClass", NULL
, 0, 0},
1608 { "_objc_getMetaClass", NULL
, 0, 0}
1611 #define nmethcalls (sizeof (methcalls) / sizeof (methcalls[0]))
1613 /* The following function, "find_objc_msgsend", fills in the data
1614 * structure "objc_msgs" by finding the addresses of each of the
1615 * (currently four) functions that it holds (of which objc_msgSend is
1616 * the first). This must be called each time symbols are loaded, in
1617 * case the functions have moved for some reason.
1621 find_objc_msgsend (void)
1624 for (i
= 0; i
< nmethcalls
; i
++) {
1626 struct minimal_symbol
*func
;
1628 /* Try both with and without underscore. */
1629 func
= lookup_minimal_symbol (methcalls
[i
].name
, NULL
, NULL
);
1630 if ((func
== NULL
) && (methcalls
[i
].name
[0] == '_')) {
1631 func
= lookup_minimal_symbol (methcalls
[i
].name
+ 1, NULL
, NULL
);
1634 methcalls
[i
].begin
= 0;
1635 methcalls
[i
].end
= 0;
1639 methcalls
[i
].begin
= SYMBOL_VALUE_ADDRESS (func
);
1641 methcalls
[i
].end
= SYMBOL_VALUE_ADDRESS (++func
);
1642 } while (methcalls
[i
].begin
== methcalls
[i
].end
);
1646 /* find_objc_msgcall (replaces pc_off_limits)
1648 * ALL that this function now does is to determine whether the input
1649 * address ("pc") is the address of one of the Objective-C message
1650 * dispatch functions (mainly objc_msgSend or objc_msgSendSuper), and
1651 * if so, it returns the address of the method that will be called.
1653 * The old function "pc_off_limits" used to do a lot of other things
1654 * in addition, such as detecting shared library jump stubs and
1655 * returning the address of the shlib function that would be called.
1656 * That functionality has been moved into the gdbarch_skip_trampoline_code and
1657 * IN_SOLIB_TRAMPOLINE macros, which are resolved in the target-
1658 * dependent modules.
1661 struct objc_submethod_helper_data
{
1662 int (*f
) (CORE_ADDR
, CORE_ADDR
*);
1668 find_objc_msgcall_submethod_helper (void * arg
)
1670 struct objc_submethod_helper_data
*s
=
1671 (struct objc_submethod_helper_data
*) arg
;
1673 if (s
->f (s
->pc
, s
->new_pc
) == 0)
1680 find_objc_msgcall_submethod (int (*f
) (CORE_ADDR
, CORE_ADDR
*),
1684 struct objc_submethod_helper_data s
;
1690 if (catch_errors (find_objc_msgcall_submethod_helper
,
1692 "Unable to determine target of Objective-C method call (ignoring):\n",
1693 RETURN_MASK_ALL
) == 0)
1700 find_objc_msgcall (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1704 find_objc_msgsend ();
1710 for (i
= 0; i
< nmethcalls
; i
++)
1711 if ((pc
>= methcalls
[i
].begin
) && (pc
< methcalls
[i
].end
))
1713 if (methcalls
[i
].stop_at
!= NULL
)
1714 return find_objc_msgcall_submethod (methcalls
[i
].stop_at
,
1723 extern initialize_file_ftype _initialize_objc_language
; /* -Wmissing-prototypes */
1726 _initialize_objc_language (void)
1728 add_language (&objc_language_defn
);
1729 add_info ("selectors", selectors_info
, /* INFO SELECTORS command. */
1730 _("All Objective-C selectors, or those matching REGEXP."));
1731 add_info ("classes", classes_info
, /* INFO CLASSES command. */
1732 _("All Objective-C classes, or those matching REGEXP."));
1733 add_com ("print-object", class_vars
, print_object_command
,
1734 _("Ask an Objective-C object to print itself."));
1735 add_com_alias ("po", "print-object", class_vars
, 1);
1739 read_objc_method (CORE_ADDR addr
, struct objc_method
*method
)
1741 method
->name
= read_memory_unsigned_integer (addr
+ 0, 4);
1742 method
->types
= read_memory_unsigned_integer (addr
+ 4, 4);
1743 method
->imp
= read_memory_unsigned_integer (addr
+ 8, 4);
1747 unsigned long read_objc_methlist_nmethods (CORE_ADDR addr
)
1749 return read_memory_unsigned_integer (addr
+ 4, 4);
1753 read_objc_methlist_method (CORE_ADDR addr
, unsigned long num
,
1754 struct objc_method
*method
)
1756 gdb_assert (num
< read_objc_methlist_nmethods (addr
));
1757 read_objc_method (addr
+ 8 + (12 * num
), method
);
1761 read_objc_object (CORE_ADDR addr
, struct objc_object
*object
)
1763 object
->isa
= read_memory_unsigned_integer (addr
, 4);
1767 read_objc_super (CORE_ADDR addr
, struct objc_super
*super
)
1769 super
->receiver
= read_memory_unsigned_integer (addr
, 4);
1770 super
->class = read_memory_unsigned_integer (addr
+ 4, 4);
1774 read_objc_class (CORE_ADDR addr
, struct objc_class
*class)
1776 class->isa
= read_memory_unsigned_integer (addr
, 4);
1777 class->super_class
= read_memory_unsigned_integer (addr
+ 4, 4);
1778 class->name
= read_memory_unsigned_integer (addr
+ 8, 4);
1779 class->version
= read_memory_unsigned_integer (addr
+ 12, 4);
1780 class->info
= read_memory_unsigned_integer (addr
+ 16, 4);
1781 class->instance_size
= read_memory_unsigned_integer (addr
+ 18, 4);
1782 class->ivars
= read_memory_unsigned_integer (addr
+ 24, 4);
1783 class->methods
= read_memory_unsigned_integer (addr
+ 28, 4);
1784 class->cache
= read_memory_unsigned_integer (addr
+ 32, 4);
1785 class->protocols
= read_memory_unsigned_integer (addr
+ 36, 4);
1789 find_implementation_from_class (CORE_ADDR
class, CORE_ADDR sel
)
1791 CORE_ADDR subclass
= class;
1793 while (subclass
!= 0)
1796 struct objc_class class_str
;
1797 unsigned mlistnum
= 0;
1799 read_objc_class (subclass
, &class_str
);
1804 unsigned long nmethods
;
1807 mlist
= read_memory_unsigned_integer (class_str
.methods
+
1812 nmethods
= read_objc_methlist_nmethods (mlist
);
1814 for (i
= 0; i
< nmethods
; i
++)
1816 struct objc_method meth_str
;
1817 read_objc_methlist_method (mlist
, i
, &meth_str
);
1821 "checking method 0x%lx against selector 0x%lx\n",
1822 meth_str
.name
, sel
);
1825 if (meth_str
.name
== sel
)
1826 /* FIXME: hppa arch was doing a pointer dereference
1827 here. There needs to be a better way to do that. */
1828 return meth_str
.imp
;
1832 subclass
= class_str
.super_class
;
1839 find_implementation (CORE_ADDR object
, CORE_ADDR sel
)
1841 struct objc_object ostr
;
1845 read_objc_object (object
, &ostr
);
1849 return find_implementation_from_class (ostr
.isa
, sel
);
1852 #define OBJC_FETCH_POINTER_ARGUMENT(argi) \
1853 gdbarch_fetch_pointer_argument (current_gdbarch, get_current_frame (), \
1854 argi, builtin_type_void_func_ptr)
1857 resolve_msgsend (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1863 object
= OBJC_FETCH_POINTER_ARGUMENT (0);
1864 sel
= OBJC_FETCH_POINTER_ARGUMENT (1);
1866 res
= find_implementation (object
, sel
);
1875 resolve_msgsend_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1881 object
= OBJC_FETCH_POINTER_ARGUMENT (1);
1882 sel
= OBJC_FETCH_POINTER_ARGUMENT (2);
1884 res
= find_implementation (object
, sel
);
1893 resolve_msgsend_super (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1895 struct objc_super sstr
;
1901 super
= OBJC_FETCH_POINTER_ARGUMENT (0);
1902 sel
= OBJC_FETCH_POINTER_ARGUMENT (1);
1904 read_objc_super (super
, &sstr
);
1905 if (sstr
.class == 0)
1908 res
= find_implementation_from_class (sstr
.class, sel
);
1917 resolve_msgsend_super_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1919 struct objc_super sstr
;
1925 super
= OBJC_FETCH_POINTER_ARGUMENT (1);
1926 sel
= OBJC_FETCH_POINTER_ARGUMENT (2);
1928 read_objc_super (super
, &sstr
);
1929 if (sstr
.class == 0)
1932 res
= find_implementation_from_class (sstr
.class, sel
);