1 /* Objective-C language support routines for GDB, the GNU debugger.
3 Copyright 2002, 2003 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., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
28 #include "expression.h"
29 #include "parser-defs.h"
32 #include "objc-lang.h"
33 #include "complaints.h"
37 #include "gdb_string.h" /* for strchr */
38 #include "target.h" /* for target_has_execution */
42 #include "gdb_regex.h"
47 #include "gdb_assert.h"
57 CORE_ADDR super_class
;
79 /* Lookup a structure type named "struct NAME", visible in lexical
80 block BLOCK. If NOERR is nonzero, return zero if NAME is not
84 lookup_struct_typedef (char *name
, struct block
*block
, int noerr
)
86 register struct symbol
*sym
;
88 sym
= lookup_symbol (name
, block
, STRUCT_DOMAIN
, 0,
89 (struct symtab
**) NULL
);
96 error ("No struct type named %s.", name
);
98 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
103 error ("This context has class, union or enum %s, not a struct.",
110 lookup_objc_class (char *classname
)
112 struct value
* function
, *classval
;
114 if (! target_has_execution
)
116 /* Can't call into inferior to lookup class. */
120 if (lookup_minimal_symbol("objc_lookUpClass", 0, 0))
121 function
= find_function_in_inferior("objc_lookUpClass");
122 else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0))
123 function
= find_function_in_inferior("objc_lookup_class");
126 complaint (&symfile_complaints
, "no way to lookup Objective-C classes");
130 classval
= value_string (classname
, strlen (classname
) + 1);
131 classval
= value_coerce_array (classval
);
132 return (CORE_ADDR
) value_as_long (call_function_by_hand (function
,
137 lookup_child_selector (char *selname
)
139 struct value
* function
, *selstring
;
141 if (! target_has_execution
)
143 /* Can't call into inferior to lookup selector. */
147 if (lookup_minimal_symbol("sel_getUid", 0, 0))
148 function
= find_function_in_inferior("sel_getUid");
149 else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0))
150 function
= find_function_in_inferior("sel_get_any_uid");
153 complaint (&symfile_complaints
, "no way to lookup Objective-C selectors");
157 selstring
= value_coerce_array (value_string (selname
,
158 strlen (selname
) + 1));
159 return value_as_long (call_function_by_hand (function
, 1, &selstring
));
163 value_nsstring (char *ptr
, int len
)
165 struct value
*stringValue
[3];
166 struct value
*function
, *nsstringValue
;
170 if (!target_has_execution
)
171 return 0; /* Can't call into inferior to create NSString. */
173 sym
= lookup_struct_typedef("NSString", 0, 1);
175 sym
= lookup_struct_typedef("NXString", 0, 1);
177 type
= lookup_pointer_type(builtin_type_void
);
179 type
= lookup_pointer_type(SYMBOL_TYPE (sym
));
181 stringValue
[2] = value_string(ptr
, len
);
182 stringValue
[2] = value_coerce_array(stringValue
[2]);
183 /* _NSNewStringFromCString replaces "istr" after Lantern2A. */
184 if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0))
186 function
= find_function_in_inferior("_NSNewStringFromCString");
187 nsstringValue
= call_function_by_hand(function
, 1, &stringValue
[2]);
189 else if (lookup_minimal_symbol("istr", 0, 0))
191 function
= find_function_in_inferior("istr");
192 nsstringValue
= call_function_by_hand(function
, 1, &stringValue
[2]);
194 else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0))
196 function
= find_function_in_inferior("+[NSString stringWithCString:]");
197 stringValue
[0] = value_from_longest
198 (builtin_type_long
, lookup_objc_class ("NSString"));
199 stringValue
[1] = value_from_longest
200 (builtin_type_long
, lookup_child_selector ("stringWithCString:"));
201 nsstringValue
= call_function_by_hand(function
, 3, &stringValue
[0]);
204 error ("NSString: internal error -- no way to create new NSString");
206 VALUE_TYPE(nsstringValue
) = type
;
207 return nsstringValue
;
210 /* Objective-C name demangling. */
213 objc_demangle (const char *mangled
, int options
)
215 char *demangled
, *cp
;
217 if (mangled
[0] == '_' &&
218 (mangled
[1] == 'i' || mangled
[1] == 'c') &&
221 cp
= demangled
= xmalloc(strlen(mangled
) + 2);
223 if (mangled
[1] == 'i')
224 *cp
++ = '-'; /* for instance method */
226 *cp
++ = '+'; /* for class method */
228 *cp
++ = '['; /* opening left brace */
229 strcpy(cp
, mangled
+3); /* tack on the rest of the mangled name */
231 while (*cp
&& *cp
== '_')
232 cp
++; /* skip any initial underbars in class name */
234 cp
= strchr(cp
, '_');
235 if (!cp
) /* find first non-initial underbar */
237 xfree(demangled
); /* not mangled name */
240 if (cp
[1] == '_') { /* easy case: no category name */
241 *cp
++ = ' '; /* replace two '_' with one ' ' */
242 strcpy(cp
, mangled
+ (cp
- demangled
) + 2);
245 *cp
++ = '('; /* less easy case: category name */
246 cp
= strchr(cp
, '_');
249 xfree(demangled
); /* not mangled name */
253 *cp
++ = ' '; /* overwriting 1st char of method name... */
254 strcpy(cp
, mangled
+ (cp
- demangled
)); /* get it back */
257 while (*cp
&& *cp
== '_')
258 cp
++; /* skip any initial underbars in method name */
262 *cp
= ':'; /* replace remaining '_' with ':' */
264 *cp
++ = ']'; /* closing right brace */
265 *cp
++ = 0; /* string terminator */
269 return NULL
; /* Not an objc mangled name. */
272 /* Print the character C on STREAM as part of the contents of a
273 literal string whose delimiter is QUOTER. Note that that format
274 for printing characters and strings is language specific. */
277 objc_emit_char (register int c
, struct ui_file
*stream
, int quoter
)
280 c
&= 0xFF; /* Avoid sign bit follies. */
282 if (PRINT_LITERAL_FORM (c
))
284 if (c
== '\\' || c
== quoter
)
286 fputs_filtered ("\\", stream
);
288 fprintf_filtered (stream
, "%c", c
);
295 fputs_filtered ("\\n", stream
);
298 fputs_filtered ("\\b", stream
);
301 fputs_filtered ("\\t", stream
);
304 fputs_filtered ("\\f", stream
);
307 fputs_filtered ("\\r", stream
);
310 fputs_filtered ("\\e", stream
);
313 fputs_filtered ("\\a", stream
);
316 fprintf_filtered (stream
, "\\%.3o", (unsigned int) c
);
323 objc_printchar (int c
, struct ui_file
*stream
)
325 fputs_filtered ("'", stream
);
326 objc_emit_char (c
, stream
, '\'');
327 fputs_filtered ("'", stream
);
330 /* Print the character string STRING, printing at most LENGTH
331 characters. Printing stops early if the number hits print_max;
332 repeat counts are printed as appropriate. Print ellipses at the
333 end if we had to stop before printing LENGTH characters, or if
337 objc_printstr (struct ui_file
*stream
, char *string
,
338 unsigned int length
, int width
, int force_ellipses
)
340 register unsigned int i
;
341 unsigned int things_printed
= 0;
345 /* If the string was not truncated due to `set print elements', and
346 the last byte of it is a null, we don't print that, in
347 traditional C style. */
348 if ((!force_ellipses
) && length
> 0 && string
[length
-1] == '\0')
353 fputs_filtered ("\"\"", stream
);
357 for (i
= 0; i
< length
&& things_printed
< print_max
; ++i
)
359 /* Position of the character we are examining to see whether it
362 /* Number of repetitions we have detected so far. */
369 fputs_filtered (", ", stream
);
375 while (rep1
< length
&& string
[rep1
] == string
[i
])
381 if (reps
> repeat_count_threshold
)
386 fputs_filtered ("\\\", ", stream
);
388 fputs_filtered ("\", ", stream
);
391 objc_printchar (string
[i
], stream
);
392 fprintf_filtered (stream
, " <repeats %u times>", reps
);
394 things_printed
+= repeat_count_threshold
;
402 fputs_filtered ("\\\"", stream
);
404 fputs_filtered ("\"", stream
);
407 objc_emit_char (string
[i
], stream
, '"');
412 /* Terminate the quotes if necessary. */
416 fputs_filtered ("\\\"", stream
);
418 fputs_filtered ("\"", stream
);
421 if (force_ellipses
|| i
< length
)
422 fputs_filtered ("...", stream
);
425 /* Create a fundamental C type using default reasonable for the
428 Some object/debugging file formats (DWARF version 1, COFF, etc) do
429 not define fundamental types such as "int" or "double". Others
430 (stabs or DWARF version 2, etc) do define fundamental types. For
431 the formats which don't provide fundamental types, gdb can create
432 such types using this function.
434 FIXME: Some compilers distinguish explicitly signed integral types
435 (signed short, signed int, signed long) from "regular" integral
436 types (short, int, long) in the debugging information. There is
437 some disagreement as to how useful this feature is. In particular,
438 gcc does not support this. Also, only some debugging formats allow
439 the distinction to be passed on to a debugger. For now, we always
440 just use "short", "int", or "long" as the type name, for both the
441 implicit and explicitly signed types. This also makes life easier
442 for the gdb test suite since we don't have to account for the
443 differences in output depending upon what the compiler and
444 debugging format support. We will probably have to re-examine the
445 issue when gdb starts taking it's fundamental type information
446 directly from the debugging information supplied by the compiler.
450 objc_create_fundamental_type (struct objfile
*objfile
, int typeid)
452 register struct type
*type
= NULL
;
457 /* FIXME: For now, if we are asked to produce a type not in
458 this language, create the equivalent of a C integer type
459 with the name "<?type?>". When all the dust settles from
460 the type reconstruction work, this should probably become
462 type
= init_type (TYPE_CODE_INT
,
463 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
464 0, "<?type?>", objfile
);
465 warning ("internal error: no C/C++ fundamental type %d", typeid);
468 type
= init_type (TYPE_CODE_VOID
,
469 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
473 type
= init_type (TYPE_CODE_INT
,
474 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
478 type
= init_type (TYPE_CODE_INT
,
479 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
480 0, "signed char", objfile
);
482 case FT_UNSIGNED_CHAR
:
483 type
= init_type (TYPE_CODE_INT
,
484 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
485 TYPE_FLAG_UNSIGNED
, "unsigned char", objfile
);
488 type
= init_type (TYPE_CODE_INT
,
489 TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
490 0, "short", objfile
);
492 case FT_SIGNED_SHORT
:
493 type
= init_type (TYPE_CODE_INT
,
494 TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
495 0, "short", objfile
); /* FIXME-fnf */
497 case FT_UNSIGNED_SHORT
:
498 type
= init_type (TYPE_CODE_INT
,
499 TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
,
500 TYPE_FLAG_UNSIGNED
, "unsigned short", objfile
);
503 type
= init_type (TYPE_CODE_INT
,
504 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
507 case FT_SIGNED_INTEGER
:
508 type
= init_type (TYPE_CODE_INT
,
509 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
510 0, "int", objfile
); /* FIXME -fnf */
512 case FT_UNSIGNED_INTEGER
:
513 type
= init_type (TYPE_CODE_INT
,
514 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
515 TYPE_FLAG_UNSIGNED
, "unsigned int", objfile
);
518 type
= init_type (TYPE_CODE_INT
,
519 TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
523 type
= init_type (TYPE_CODE_INT
,
524 TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
525 0, "long", objfile
); /* FIXME -fnf */
527 case FT_UNSIGNED_LONG
:
528 type
= init_type (TYPE_CODE_INT
,
529 TARGET_LONG_BIT
/ TARGET_CHAR_BIT
,
530 TYPE_FLAG_UNSIGNED
, "unsigned long", objfile
);
533 type
= init_type (TYPE_CODE_INT
,
534 TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
535 0, "long long", objfile
);
537 case FT_SIGNED_LONG_LONG
:
538 type
= init_type (TYPE_CODE_INT
,
539 TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
540 0, "signed long long", objfile
);
542 case FT_UNSIGNED_LONG_LONG
:
543 type
= init_type (TYPE_CODE_INT
,
544 TARGET_LONG_LONG_BIT
/ TARGET_CHAR_BIT
,
545 TYPE_FLAG_UNSIGNED
, "unsigned long long", objfile
);
548 type
= init_type (TYPE_CODE_FLT
,
549 TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
550 0, "float", objfile
);
552 case FT_DBL_PREC_FLOAT
:
553 type
= init_type (TYPE_CODE_FLT
,
554 TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
555 0, "double", objfile
);
557 case FT_EXT_PREC_FLOAT
:
558 type
= init_type (TYPE_CODE_FLT
,
559 TARGET_LONG_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
560 0, "long double", objfile
);
566 /* Determine if we are currently in the Objective-C dispatch function.
567 If so, get the address of the method function that the dispatcher
568 would call and use that as the function to step into instead. Also
569 skip over the trampoline for the function (if any). This is better
570 for the user since they are only interested in stepping into the
571 method function anyway. */
573 objc_skip_trampoline (CORE_ADDR stop_pc
)
575 CORE_ADDR real_stop_pc
;
576 CORE_ADDR method_stop_pc
;
578 real_stop_pc
= SKIP_TRAMPOLINE_CODE (stop_pc
);
580 if (real_stop_pc
!= 0)
581 find_objc_msgcall (real_stop_pc
, &method_stop_pc
);
583 find_objc_msgcall (stop_pc
, &method_stop_pc
);
587 real_stop_pc
= SKIP_TRAMPOLINE_CODE (method_stop_pc
);
588 if (real_stop_pc
== 0)
589 real_stop_pc
= method_stop_pc
;
596 /* Table mapping opcodes into strings for printing operators
597 and precedences of the operators. */
599 static const struct op_print objc_op_print_tab
[] =
601 {",", BINOP_COMMA
, PREC_COMMA
, 0},
602 {"=", BINOP_ASSIGN
, PREC_ASSIGN
, 1},
603 {"||", BINOP_LOGICAL_OR
, PREC_LOGICAL_OR
, 0},
604 {"&&", BINOP_LOGICAL_AND
, PREC_LOGICAL_AND
, 0},
605 {"|", BINOP_BITWISE_IOR
, PREC_BITWISE_IOR
, 0},
606 {"^", BINOP_BITWISE_XOR
, PREC_BITWISE_XOR
, 0},
607 {"&", BINOP_BITWISE_AND
, PREC_BITWISE_AND
, 0},
608 {"==", BINOP_EQUAL
, PREC_EQUAL
, 0},
609 {"!=", BINOP_NOTEQUAL
, PREC_EQUAL
, 0},
610 {"<=", BINOP_LEQ
, PREC_ORDER
, 0},
611 {">=", BINOP_GEQ
, PREC_ORDER
, 0},
612 {">", BINOP_GTR
, PREC_ORDER
, 0},
613 {"<", BINOP_LESS
, PREC_ORDER
, 0},
614 {">>", BINOP_RSH
, PREC_SHIFT
, 0},
615 {"<<", BINOP_LSH
, PREC_SHIFT
, 0},
616 {"+", BINOP_ADD
, PREC_ADD
, 0},
617 {"-", BINOP_SUB
, PREC_ADD
, 0},
618 {"*", BINOP_MUL
, PREC_MUL
, 0},
619 {"/", BINOP_DIV
, PREC_MUL
, 0},
620 {"%", BINOP_REM
, PREC_MUL
, 0},
621 {"@", BINOP_REPEAT
, PREC_REPEAT
, 0},
622 {"-", UNOP_NEG
, PREC_PREFIX
, 0},
623 {"!", UNOP_LOGICAL_NOT
, PREC_PREFIX
, 0},
624 {"~", UNOP_COMPLEMENT
, PREC_PREFIX
, 0},
625 {"*", UNOP_IND
, PREC_PREFIX
, 0},
626 {"&", UNOP_ADDR
, PREC_PREFIX
, 0},
627 {"sizeof ", UNOP_SIZEOF
, PREC_PREFIX
, 0},
628 {"++", UNOP_PREINCREMENT
, PREC_PREFIX
, 0},
629 {"--", UNOP_PREDECREMENT
, PREC_PREFIX
, 0},
630 {NULL
, OP_NULL
, PREC_NULL
, 0}
633 struct type
** const (objc_builtin_types
[]) =
640 &builtin_type_double
,
642 &builtin_type_long_long
,
643 &builtin_type_signed_char
,
644 &builtin_type_unsigned_char
,
645 &builtin_type_unsigned_short
,
646 &builtin_type_unsigned_int
,
647 &builtin_type_unsigned_long
,
648 &builtin_type_unsigned_long_long
,
649 &builtin_type_long_double
,
650 &builtin_type_complex
,
651 &builtin_type_double_complex
,
655 const struct language_defn objc_language_defn
= {
656 "objective-c", /* Language name */
664 evaluate_subexp_standard
,
665 objc_printchar
, /* Print a character constant */
666 objc_printstr
, /* Function to print string constant */
668 objc_create_fundamental_type
, /* Create fundamental type in this language */
669 c_print_type
, /* Print a type using appropriate syntax */
670 c_val_print
, /* Print a value using appropriate syntax */
671 c_value_print
, /* Print a top-level value */
672 objc_skip_trampoline
, /* Language specific skip_trampoline */
673 value_of_this
, /* value_of_this */
674 basic_lookup_symbol_nonlocal
, /* lookup_symbol_nonlocal */
675 objc_demangle
, /* Language specific symbol demangler */
676 {"", "", "", ""}, /* Binary format info */
677 {"0%lo", "0", "o", ""}, /* Octal format info */
678 {"%ld", "", "d", ""}, /* Decimal format info */
679 {"0x%lx", "0x", "x", ""}, /* Hex format info */
680 objc_op_print_tab
, /* Expression operators for printing */
681 1, /* C-style arrays */
682 0, /* String lower bound */
683 &builtin_type_char
, /* Type of string elements */
689 * Following functions help construct Objective-C message calls
692 struct selname
/* For parsing Objective-C. */
694 struct selname
*next
;
699 static int msglist_len
;
700 static struct selname
*selname_chain
;
701 static char *msglist_sel
;
706 register struct selname
*new =
707 (struct selname
*) xmalloc (sizeof (struct selname
));
709 new->next
= selname_chain
;
710 new->msglist_len
= msglist_len
;
711 new->msglist_sel
= msglist_sel
;
713 msglist_sel
= (char *)xmalloc(1);
719 add_msglist(struct stoken
*str
, int addcolon
)
724 if (str
== 0) { /* Unnamed arg, or... */
725 if (addcolon
== 0) { /* variable number of args. */
735 len
= plen
+ strlen(msglist_sel
) + 2;
736 s
= (char *)xmalloc(len
);
737 strcpy(s
, msglist_sel
);
752 register int val
= msglist_len
;
753 register struct selname
*sel
= selname_chain
;
754 register char *p
= msglist_sel
;
757 selname_chain
= sel
->next
;
758 msglist_len
= sel
->msglist_len
;
759 msglist_sel
= sel
->msglist_sel
;
760 selid
= lookup_child_selector(p
);
762 error("Can't find selector \"%s\"", p
);
763 write_exp_elt_longcst (selid
);
765 write_exp_elt_longcst (val
); /* Number of args */
772 * Function: specialcmp (char *a, char *b)
774 * Special strcmp: treats ']' and ' ' as end-of-string.
775 * Used for qsorting lists of objc methods (either by class or selector).
779 specialcmp (char *a
, char *b
)
781 while (*a
&& *a
!= ' ' && *a
!= ']' && *b
&& *b
!= ' ' && *b
!= ']')
787 if (*a
&& *a
!= ' ' && *a
!= ']')
788 return 1; /* a is longer therefore greater */
789 if (*b
&& *b
!= ' ' && *b
!= ']')
790 return -1; /* a is shorter therefore lesser */
791 return 0; /* a and b are identical */
795 * Function: compare_selectors (const void *, const void *)
797 * Comparison function for use with qsort. Arguments are symbols or
798 * msymbols Compares selector part of objc method name alphabetically.
802 compare_selectors (const void *a
, const void *b
)
806 aname
= SYMBOL_PRINT_NAME (*(struct symbol
**) a
);
807 bname
= SYMBOL_PRINT_NAME (*(struct symbol
**) b
);
808 if (aname
== NULL
|| bname
== NULL
)
809 error ("internal: compare_selectors(1)");
811 aname
= strchr(aname
, ' ');
812 bname
= strchr(bname
, ' ');
813 if (aname
== NULL
|| bname
== NULL
)
814 error ("internal: compare_selectors(2)");
816 return specialcmp (aname
+1, bname
+1);
820 * Function: selectors_info (regexp, from_tty)
822 * Implements the "Info selectors" command. Takes an optional regexp
823 * arg. Lists all objective c selectors that match the regexp. Works
824 * by grepping thru all symbols for objective c methods. Output list
825 * is sorted and uniqued.
829 selectors_info (char *regexp
, int from_tty
)
831 struct objfile
*objfile
;
832 struct minimal_symbol
*msymbol
;
840 struct symbol
**sym_arr
;
844 strcpy(myregexp
, ".*]"); /* Null input, match all objc methods. */
847 if (*regexp
== '+' || *regexp
== '-')
848 { /* User wants only class methods or only instance methods. */
849 plusminus
= *regexp
++;
850 while (*regexp
== ' ' || *regexp
== '\t')
854 strcpy(myregexp
, ".*]");
857 strcpy(myregexp
, regexp
);
858 if (myregexp
[strlen(myregexp
) - 1] == '$') /* end of selector */
859 myregexp
[strlen(myregexp
) - 1] = ']'; /* end of method name */
861 strcat(myregexp
, ".*]");
867 val
= re_comp (myregexp
);
869 error ("Invalid regexp (%s): %s", val
, regexp
);
872 /* First time thru is JUST to get max length and count. */
873 ALL_MSYMBOLS (objfile
, msymbol
)
876 name
= SYMBOL_NATURAL_NAME (msymbol
);
878 (name
[0] == '-' || name
[0] == '+') &&
879 name
[1] == '[') /* Got a method name. */
881 /* Filter for class/instance methods. */
882 if (plusminus
&& name
[0] != plusminus
)
884 /* Find selector part. */
885 name
= (char *) strchr(name
+2, ' ');
886 if (regexp
== NULL
|| re_exec(++name
) != 0)
888 char *mystart
= name
;
889 char *myend
= (char *) strchr(mystart
, ']');
891 if (myend
&& (myend
- mystart
> maxlen
))
892 maxlen
= myend
- mystart
; /* Get longest selector. */
899 printf_filtered ("Selectors matching \"%s\":\n\n",
900 regexp
? regexp
: "*");
902 sym_arr
= alloca (matches
* sizeof (struct symbol
*));
904 ALL_MSYMBOLS (objfile
, msymbol
)
907 name
= SYMBOL_NATURAL_NAME (msymbol
);
909 (name
[0] == '-' || name
[0] == '+') &&
910 name
[1] == '[') /* Got a method name. */
912 /* Filter for class/instance methods. */
913 if (plusminus
&& name
[0] != plusminus
)
915 /* Find selector part. */
916 name
= (char *) strchr(name
+2, ' ');
917 if (regexp
== NULL
|| re_exec(++name
) != 0)
918 sym_arr
[matches
++] = (struct symbol
*) msymbol
;
922 qsort (sym_arr
, matches
, sizeof (struct minimal_symbol
*),
924 /* Prevent compare on first iteration. */
926 for (ix
= 0; ix
< matches
; ix
++) /* Now do the output. */
931 name
= SYMBOL_NATURAL_NAME (sym_arr
[ix
]);
932 name
= strchr (name
, ' ') + 1;
933 if (p
[0] && specialcmp(name
, p
) == 0)
934 continue; /* Seen this one already (not unique). */
936 /* Copy selector part. */
937 while (*name
&& *name
!= ']')
940 /* Print in columns. */
941 puts_filtered_tabular(asel
, maxlen
+ 1, 0);
946 printf_filtered ("No selectors matching \"%s\"\n", regexp
? regexp
: "*");
950 * Function: compare_classes (const void *, const void *)
952 * Comparison function for use with qsort. Arguments are symbols or
953 * msymbols Compares class part of objc method name alphabetically.
957 compare_classes (const void *a
, const void *b
)
961 aname
= SYMBOL_PRINT_NAME (*(struct symbol
**) a
);
962 bname
= SYMBOL_PRINT_NAME (*(struct symbol
**) b
);
963 if (aname
== NULL
|| bname
== NULL
)
964 error ("internal: compare_classes(1)");
966 return specialcmp (aname
+1, bname
+1);
970 * Function: classes_info(regexp, from_tty)
972 * Implements the "info classes" command for objective c classes.
973 * Lists all objective c classes that match the optional regexp.
974 * Works by grepping thru the list of objective c methods. List will
975 * be sorted and uniqued (since one class may have many methods).
976 * BUGS: will not list a class that has no methods.
980 classes_info (char *regexp
, int from_tty
)
982 struct objfile
*objfile
;
983 struct minimal_symbol
*msymbol
;
991 struct symbol
**sym_arr
;
994 strcpy(myregexp
, ".* "); /* Null input: match all objc classes. */
997 strcpy(myregexp
, regexp
);
998 if (myregexp
[strlen(myregexp
) - 1] == '$')
999 /* In the method name, the end of the class name is marked by ' '. */
1000 myregexp
[strlen(myregexp
) - 1] = ' ';
1002 strcat(myregexp
, ".* ");
1007 val
= re_comp (myregexp
);
1009 error ("Invalid regexp (%s): %s", val
, regexp
);
1012 /* First time thru is JUST to get max length and count. */
1013 ALL_MSYMBOLS (objfile
, msymbol
)
1016 name
= SYMBOL_NATURAL_NAME (msymbol
);
1018 (name
[0] == '-' || name
[0] == '+') &&
1019 name
[1] == '[') /* Got a method name. */
1020 if (regexp
== NULL
|| re_exec(name
+2) != 0)
1022 /* Compute length of classname part. */
1023 char *mystart
= name
+ 2;
1024 char *myend
= (char *) strchr(mystart
, ' ');
1026 if (myend
&& (myend
- mystart
> maxlen
))
1027 maxlen
= myend
- mystart
;
1033 printf_filtered ("Classes matching \"%s\":\n\n",
1034 regexp
? regexp
: "*");
1035 sym_arr
= alloca (matches
* sizeof (struct symbol
*));
1037 ALL_MSYMBOLS (objfile
, msymbol
)
1040 name
= SYMBOL_NATURAL_NAME (msymbol
);
1042 (name
[0] == '-' || name
[0] == '+') &&
1043 name
[1] == '[') /* Got a method name. */
1044 if (regexp
== NULL
|| re_exec(name
+2) != 0)
1045 sym_arr
[matches
++] = (struct symbol
*) msymbol
;
1048 qsort (sym_arr
, matches
, sizeof (struct minimal_symbol
*),
1050 /* Prevent compare on first iteration. */
1052 for (ix
= 0; ix
< matches
; ix
++) /* Now do the output. */
1057 name
= SYMBOL_NATURAL_NAME (sym_arr
[ix
]);
1059 if (p
[0] && specialcmp(name
, p
) == 0)
1060 continue; /* Seen this one already (not unique). */
1062 /* Copy class part of method name. */
1063 while (*name
&& *name
!= ' ')
1066 /* Print in columns. */
1067 puts_filtered_tabular(aclass
, maxlen
+ 1, 0);
1072 printf_filtered ("No classes matching \"%s\"\n", regexp
? regexp
: "*");
1076 * Function: find_imps (char *selector, struct symbol **sym_arr)
1078 * Input: a string representing a selector
1079 * a pointer to an array of symbol pointers
1080 * possibly a pointer to a symbol found by the caller.
1082 * Output: number of methods that implement that selector. Side
1083 * effects: The array of symbol pointers is filled with matching syms.
1085 * By analogy with function "find_methods" (symtab.c), builds a list
1086 * of symbols matching the ambiguous input, so that "decode_line_2"
1087 * (symtab.c) can list them and ask the user to choose one or more.
1088 * In this case the matches are objective c methods
1089 * ("implementations") matching an objective c selector.
1091 * Note that it is possible for a normal (c-style) function to have
1092 * the same name as an objective c selector. To prevent the selector
1093 * from eclipsing the function, we allow the caller (decode_line_1) to
1094 * search for such a function first, and if it finds one, pass it in
1095 * to us. We will then integrate it into the list. We also search
1096 * for one here, among the minsyms.
1098 * NOTE: if NUM_DEBUGGABLE is non-zero, the sym_arr will be divided
1099 * into two parts: debuggable (struct symbol) syms, and
1100 * non_debuggable (struct minimal_symbol) syms. The debuggable
1101 * ones will come first, before NUM_DEBUGGABLE (which will thus
1102 * be the index of the first non-debuggable one).
1106 * Function: total_number_of_imps (char *selector);
1108 * Input: a string representing a selector
1109 * Output: number of methods that implement that selector.
1111 * By analogy with function "total_number_of_methods", this allows
1112 * decode_line_1 (symtab.c) to detect if there are objective c methods
1113 * matching the input, and to allocate an array of pointers to them
1114 * which can be manipulated by "decode_line_2" (also in symtab.c).
1118 parse_selector (char *method
, char **selector
)
1122 int found_quote
= 0;
1124 char *nselector
= NULL
;
1126 gdb_assert (selector
!= NULL
);
1130 while (isspace (*s1
))
1137 while (isspace (*s1
))
1144 if (isalnum (*s2
) || (*s2
== '_') || (*s2
== ':'))
1146 else if (isspace (*s2
))
1148 else if ((*s2
== '\0') || (*s2
== '\''))
1156 while (isspace (*s2
))
1162 while (isspace (*s2
))
1166 if (selector
!= NULL
)
1167 *selector
= nselector
;
1173 parse_method (char *method
, char *type
, char **class,
1174 char **category
, char **selector
)
1178 int found_quote
= 0;
1181 char *nclass
= NULL
;
1182 char *ncategory
= NULL
;
1183 char *nselector
= NULL
;
1185 gdb_assert (type
!= NULL
);
1186 gdb_assert (class != NULL
);
1187 gdb_assert (category
!= NULL
);
1188 gdb_assert (selector
!= NULL
);
1192 while (isspace (*s1
))
1199 while (isspace (*s1
))
1202 if ((s1
[0] == '+') || (s1
[0] == '-'))
1205 while (isspace (*s1
))
1213 while (isalnum (*s1
) || (*s1
== '_'))
1217 while (isspace (*s2
))
1223 while (isspace (*s2
))
1226 while (isalnum (*s2
) || (*s2
== '_'))
1231 /* Truncate the class name now that we're not using the open paren. */
1238 if (isalnum (*s2
) || (*s2
== '_') || (*s2
== ':'))
1240 else if (isspace (*s2
))
1242 else if (*s2
== ']')
1251 while (isspace (*s2
))
1258 while (isspace (*s2
))
1266 if (category
!= NULL
)
1267 *category
= ncategory
;
1268 if (selector
!= NULL
)
1269 *selector
= nselector
;
1275 find_methods (struct symtab
*symtab
, char type
,
1276 const char *class, const char *category
,
1277 const char *selector
, struct symbol
**syms
,
1278 unsigned int *nsym
, unsigned int *ndebug
)
1280 struct objfile
*objfile
= NULL
;
1281 struct minimal_symbol
*msymbol
= NULL
;
1282 struct block
*block
= NULL
;
1283 struct symbol
*sym
= NULL
;
1285 char *symname
= NULL
;
1288 char *nclass
= NULL
;
1289 char *ncategory
= NULL
;
1290 char *nselector
= NULL
;
1292 unsigned int csym
= 0;
1293 unsigned int cdebug
= 0;
1295 static char *tmp
= NULL
;
1296 static unsigned int tmplen
= 0;
1298 gdb_assert (nsym
!= NULL
);
1299 gdb_assert (ndebug
!= NULL
);
1302 block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab
), STATIC_BLOCK
);
1304 ALL_MSYMBOLS (objfile
, msymbol
)
1308 if ((msymbol
->type
!= mst_text
) && (msymbol
->type
!= mst_file_text
))
1309 /* Not a function or method. */
1313 if ((SYMBOL_VALUE_ADDRESS (msymbol
) < BLOCK_START (block
)) ||
1314 (SYMBOL_VALUE_ADDRESS (msymbol
) >= BLOCK_END (block
)))
1315 /* Not in the specified symtab. */
1318 symname
= SYMBOL_NATURAL_NAME (msymbol
);
1319 if (symname
== NULL
)
1322 if ((symname
[0] != '-' && symname
[0] != '+') || (symname
[1] != '['))
1323 /* Not a method name. */
1326 while ((strlen (symname
) + 1) >= tmplen
)
1328 tmplen
= (tmplen
== 0) ? 1024 : tmplen
* 2;
1329 tmp
= xrealloc (tmp
, tmplen
);
1331 strcpy (tmp
, symname
);
1333 if (parse_method (tmp
, &ntype
, &nclass
, &ncategory
, &nselector
) == NULL
)
1336 if ((type
!= '\0') && (ntype
!= type
))
1340 && ((nclass
== NULL
) || (strcmp (class, nclass
) != 0)))
1343 if ((category
!= NULL
) &&
1344 ((ncategory
== NULL
) || (strcmp (category
, ncategory
) != 0)))
1347 if ((selector
!= NULL
) &&
1348 ((nselector
== NULL
) || (strcmp (selector
, nselector
) != 0)))
1351 sym
= find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol
));
1354 const char *newsymname
= SYMBOL_NATURAL_NAME (sym
);
1356 if (strcmp (symname
, newsymname
) == 0)
1358 /* Found a high-level method sym: swap it into the
1359 lower part of sym_arr (below num_debuggable). */
1362 syms
[csym
] = syms
[cdebug
];
1371 "debugging symbol \"%s\" does not match minimal symbol (\"%s\"); ignoring",
1372 newsymname
, symname
);
1374 syms
[csym
] = (struct symbol
*) msymbol
;
1380 /* Found a non-debuggable method symbol. */
1382 syms
[csym
] = (struct symbol
*) msymbol
;
1393 char *find_imps (struct symtab
*symtab
, struct block
*block
,
1394 char *method
, struct symbol
**syms
,
1395 unsigned int *nsym
, unsigned int *ndebug
)
1399 char *category
= NULL
;
1400 char *selector
= NULL
;
1402 unsigned int csym
= 0;
1403 unsigned int cdebug
= 0;
1405 unsigned int ncsym
= 0;
1406 unsigned int ncdebug
= 0;
1411 gdb_assert (nsym
!= NULL
);
1412 gdb_assert (ndebug
!= NULL
);
1419 buf
= (char *) alloca (strlen (method
) + 1);
1420 strcpy (buf
, method
);
1421 tmp
= parse_method (buf
, &type
, &class, &category
, &selector
);
1425 struct symbol
*sym
= NULL
;
1426 struct minimal_symbol
*msym
= NULL
;
1428 strcpy (buf
, method
);
1429 tmp
= parse_selector (buf
, &selector
);
1434 sym
= lookup_symbol (selector
, block
, VAR_DOMAIN
, 0, NULL
);
1444 msym
= lookup_minimal_symbol (selector
, 0, 0);
1449 syms
[csym
] = (struct symbol
*)msym
;
1455 find_methods (symtab
, type
, class, category
, selector
,
1456 syms
+ csym
, &ncsym
, &ncdebug
);
1458 find_methods (symtab
, type
, class, category
, selector
,
1459 NULL
, &ncsym
, &ncdebug
);
1461 /* If we didn't find any methods, just return. */
1462 if (ncsym
== 0 && ncdebug
== 0)
1465 /* Take debug symbols from the second batch of symbols and swap them
1466 * with debug symbols from the first batch. Repeat until either the
1467 * second section is out of debug symbols or the first section is
1468 * full of debug symbols. Either way we have all debug symbols
1469 * packed to the beginning of the buffer.
1474 while ((cdebug
< csym
) && (ncdebug
> 0))
1476 struct symbol
*s
= NULL
;
1477 /* First non-debugging symbol. */
1478 unsigned int i
= cdebug
;
1479 /* Last of second batch of debug symbols. */
1480 unsigned int j
= csym
+ ncdebug
- 1;
1486 /* We've moved a symbol from the second debug section to the
1502 return method
+ (tmp
- buf
);
1506 /* Sort debuggable symbols. */
1508 qsort (syms
, cdebug
, sizeof (struct minimal_symbol
*),
1511 /* Sort minimal_symbols. */
1512 if ((csym
- cdebug
) > 1)
1513 qsort (&syms
[cdebug
], csym
- cdebug
,
1514 sizeof (struct minimal_symbol
*), compare_classes
);
1516 /* Terminate the sym_arr list. */
1519 return method
+ (tmp
- buf
);
1523 print_object_command (char *args
, int from_tty
)
1525 struct value
*object
, *function
, *description
;
1526 CORE_ADDR string_addr
, object_addr
;
1530 if (!args
|| !*args
)
1532 "The 'print-object' command requires an argument (an Objective-C object)");
1535 struct expression
*expr
= parse_expression (args
);
1536 register struct cleanup
*old_chain
=
1537 make_cleanup (free_current_contents
, &expr
);
1540 object
= expr
->language_defn
->evaluate_exp (builtin_type_void_data_ptr
,
1541 expr
, &pc
, EVAL_NORMAL
);
1542 do_cleanups (old_chain
);
1545 /* Validate the address for sanity. */
1546 object_addr
= value_as_long (object
);
1547 read_memory (object_addr
, &c
, 1);
1549 function
= find_function_in_inferior ("_NSPrintForDebugger");
1550 if (function
== NULL
)
1551 error ("Unable to locate _NSPrintForDebugger in child process");
1553 description
= call_function_by_hand (function
, 1, &object
);
1555 string_addr
= value_as_long (description
);
1556 if (string_addr
== 0)
1557 error ("object returns null description");
1559 read_memory (string_addr
+ i
++, &c
, 1);
1562 { /* Read and print characters up to EOS. */
1564 printf_filtered ("%c", c
);
1565 read_memory (string_addr
+ i
++, &c
, 1);
1568 printf_filtered("<object returns empty description>");
1569 printf_filtered ("\n");
1572 /* The data structure 'methcalls' is used to detect method calls (thru
1573 * ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.),
1574 * and ultimately find the method being called.
1577 struct objc_methcall
{
1579 /* Return instance method to be called. */
1580 int (*stop_at
) (CORE_ADDR
, CORE_ADDR
*);
1581 /* Start of pc range corresponding to method invocation. */
1583 /* End of pc range corresponding to method invocation. */
1587 static int resolve_msgsend (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1588 static int resolve_msgsend_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1589 static int resolve_msgsend_super (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1590 static int resolve_msgsend_super_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1592 static struct objc_methcall methcalls
[] = {
1593 { "_objc_msgSend", resolve_msgsend
, 0, 0},
1594 { "_objc_msgSend_stret", resolve_msgsend_stret
, 0, 0},
1595 { "_objc_msgSendSuper", resolve_msgsend_super
, 0, 0},
1596 { "_objc_msgSendSuper_stret", resolve_msgsend_super_stret
, 0, 0},
1597 { "_objc_getClass", NULL
, 0, 0},
1598 { "_objc_getMetaClass", NULL
, 0, 0}
1601 #define nmethcalls (sizeof (methcalls) / sizeof (methcalls[0]))
1603 /* The following function, "find_objc_msgsend", fills in the data
1604 * structure "objc_msgs" by finding the addresses of each of the
1605 * (currently four) functions that it holds (of which objc_msgSend is
1606 * the first). This must be called each time symbols are loaded, in
1607 * case the functions have moved for some reason.
1611 find_objc_msgsend (void)
1614 for (i
= 0; i
< nmethcalls
; i
++) {
1616 struct minimal_symbol
*func
;
1618 /* Try both with and without underscore. */
1619 func
= lookup_minimal_symbol (methcalls
[i
].name
, NULL
, NULL
);
1620 if ((func
== NULL
) && (methcalls
[i
].name
[0] == '_')) {
1621 func
= lookup_minimal_symbol (methcalls
[i
].name
+ 1, NULL
, NULL
);
1624 methcalls
[i
].begin
= 0;
1625 methcalls
[i
].end
= 0;
1629 methcalls
[i
].begin
= SYMBOL_VALUE_ADDRESS (func
);
1631 methcalls
[i
].end
= SYMBOL_VALUE_ADDRESS (++func
);
1632 } while (methcalls
[i
].begin
== methcalls
[i
].end
);
1636 /* find_objc_msgcall (replaces pc_off_limits)
1638 * ALL that this function now does is to determine whether the input
1639 * address ("pc") is the address of one of the Objective-C message
1640 * dispatch functions (mainly objc_msgSend or objc_msgSendSuper), and
1641 * if so, it returns the address of the method that will be called.
1643 * The old function "pc_off_limits" used to do a lot of other things
1644 * in addition, such as detecting shared library jump stubs and
1645 * returning the address of the shlib function that would be called.
1646 * That functionality has been moved into the SKIP_TRAMPOLINE_CODE and
1647 * IN_SOLIB_TRAMPOLINE macros, which are resolved in the target-
1648 * dependent modules.
1651 struct objc_submethod_helper_data
{
1652 int (*f
) (CORE_ADDR
, CORE_ADDR
*);
1658 find_objc_msgcall_submethod_helper (void * arg
)
1660 struct objc_submethod_helper_data
*s
=
1661 (struct objc_submethod_helper_data
*) arg
;
1663 if (s
->f (s
->pc
, s
->new_pc
) == 0)
1670 find_objc_msgcall_submethod (int (*f
) (CORE_ADDR
, CORE_ADDR
*),
1674 struct objc_submethod_helper_data s
;
1680 if (catch_errors (find_objc_msgcall_submethod_helper
,
1682 "Unable to determine target of Objective-C method call (ignoring):\n",
1683 RETURN_MASK_ALL
) == 0)
1690 find_objc_msgcall (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1694 find_objc_msgsend ();
1700 for (i
= 0; i
< nmethcalls
; i
++)
1701 if ((pc
>= methcalls
[i
].begin
) && (pc
< methcalls
[i
].end
))
1703 if (methcalls
[i
].stop_at
!= NULL
)
1704 return find_objc_msgcall_submethod (methcalls
[i
].stop_at
,
1713 extern initialize_file_ftype _initialize_objc_language
; /* -Wmissing-prototypes */
1716 _initialize_objc_language (void)
1718 add_language (&objc_language_defn
);
1719 add_info ("selectors", selectors_info
, /* INFO SELECTORS command. */
1720 "All Objective-C selectors, or those matching REGEXP.");
1721 add_info ("classes", classes_info
, /* INFO CLASSES command. */
1722 "All Objective-C classes, or those matching REGEXP.");
1723 add_com ("print-object", class_vars
, print_object_command
,
1724 "Ask an Objective-C object to print itself.");
1725 add_com_alias ("po", "print-object", class_vars
, 1);
1729 read_objc_method (CORE_ADDR addr
, struct objc_method
*method
)
1731 method
->name
= read_memory_unsigned_integer (addr
+ 0, 4);
1732 method
->types
= read_memory_unsigned_integer (addr
+ 4, 4);
1733 method
->imp
= read_memory_unsigned_integer (addr
+ 8, 4);
1737 unsigned long read_objc_methlist_nmethods (CORE_ADDR addr
)
1739 return read_memory_unsigned_integer (addr
+ 4, 4);
1743 read_objc_methlist_method (CORE_ADDR addr
, unsigned long num
,
1744 struct objc_method
*method
)
1746 gdb_assert (num
< read_objc_methlist_nmethods (addr
));
1747 read_objc_method (addr
+ 8 + (12 * num
), method
);
1751 read_objc_object (CORE_ADDR addr
, struct objc_object
*object
)
1753 object
->isa
= read_memory_unsigned_integer (addr
, 4);
1757 read_objc_super (CORE_ADDR addr
, struct objc_super
*super
)
1759 super
->receiver
= read_memory_unsigned_integer (addr
, 4);
1760 super
->class = read_memory_unsigned_integer (addr
+ 4, 4);
1764 read_objc_class (CORE_ADDR addr
, struct objc_class
*class)
1766 class->isa
= read_memory_unsigned_integer (addr
, 4);
1767 class->super_class
= read_memory_unsigned_integer (addr
+ 4, 4);
1768 class->name
= read_memory_unsigned_integer (addr
+ 8, 4);
1769 class->version
= read_memory_unsigned_integer (addr
+ 12, 4);
1770 class->info
= read_memory_unsigned_integer (addr
+ 16, 4);
1771 class->instance_size
= read_memory_unsigned_integer (addr
+ 18, 4);
1772 class->ivars
= read_memory_unsigned_integer (addr
+ 24, 4);
1773 class->methods
= read_memory_unsigned_integer (addr
+ 28, 4);
1774 class->cache
= read_memory_unsigned_integer (addr
+ 32, 4);
1775 class->protocols
= read_memory_unsigned_integer (addr
+ 36, 4);
1779 find_implementation_from_class (CORE_ADDR
class, CORE_ADDR sel
)
1781 CORE_ADDR subclass
= class;
1783 while (subclass
!= 0)
1786 struct objc_class class_str
;
1787 unsigned mlistnum
= 0;
1789 read_objc_class (subclass
, &class_str
);
1794 unsigned long nmethods
;
1797 mlist
= read_memory_unsigned_integer (class_str
.methods
+
1802 nmethods
= read_objc_methlist_nmethods (mlist
);
1804 for (i
= 0; i
< nmethods
; i
++)
1806 struct objc_method meth_str
;
1807 read_objc_methlist_method (mlist
, i
, &meth_str
);
1811 "checking method 0x%lx against selector 0x%lx\n",
1812 meth_str
.name
, sel
);
1815 if (meth_str
.name
== sel
)
1816 /* FIXME: hppa arch was doing a pointer dereference
1817 here. There needs to be a better way to do that. */
1818 return meth_str
.imp
;
1822 subclass
= class_str
.super_class
;
1829 find_implementation (CORE_ADDR object
, CORE_ADDR sel
)
1831 struct objc_object ostr
;
1835 read_objc_object (object
, &ostr
);
1839 return find_implementation_from_class (ostr
.isa
, sel
);
1842 #define OBJC_FETCH_POINTER_ARGUMENT(argi) \
1843 FETCH_POINTER_ARGUMENT (get_current_frame (), argi, builtin_type_void_func_ptr)
1846 resolve_msgsend (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1852 object
= OBJC_FETCH_POINTER_ARGUMENT (0);
1853 sel
= OBJC_FETCH_POINTER_ARGUMENT (1);
1855 res
= find_implementation (object
, sel
);
1864 resolve_msgsend_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1870 object
= OBJC_FETCH_POINTER_ARGUMENT (1);
1871 sel
= OBJC_FETCH_POINTER_ARGUMENT (2);
1873 res
= find_implementation (object
, sel
);
1882 resolve_msgsend_super (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1884 struct objc_super sstr
;
1890 super
= OBJC_FETCH_POINTER_ARGUMENT (0);
1891 sel
= OBJC_FETCH_POINTER_ARGUMENT (1);
1893 read_objc_super (super
, &sstr
);
1894 if (sstr
.class == 0)
1897 res
= find_implementation_from_class (sstr
.class, sel
);
1906 resolve_msgsend_super_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1908 struct objc_super sstr
;
1914 super
= OBJC_FETCH_POINTER_ARGUMENT (1);
1915 sel
= OBJC_FETCH_POINTER_ARGUMENT (2);
1917 read_objc_super (super
, &sstr
);
1918 if (sstr
.class == 0)
1921 res
= find_implementation_from_class (sstr
.class, sel
);