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 3 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, see <http://www.gnu.org/licenses/>. */
26 #include "expression.h"
27 #include "parser-defs.h"
30 #include "objc-lang.h"
31 #include "exceptions.h"
32 #include "complaints.h"
36 #include "gdb_string.h" /* for strchr */
37 #include "target.h" /* for target_has_execution */
41 #include "gdb_regex.h"
46 #include "gdb_assert.h"
56 CORE_ADDR super_class
;
78 /* Lookup a structure type named "struct NAME", visible in lexical
79 block BLOCK. If NOERR is nonzero, return zero if NAME is not
83 lookup_struct_typedef (char *name
, struct block
*block
, int noerr
)
87 sym
= lookup_symbol (name
, block
, STRUCT_DOMAIN
, 0,
88 (struct symtab
**) NULL
);
95 error (_("No struct type named %s."), name
);
97 if (TYPE_CODE (SYMBOL_TYPE (sym
)) != TYPE_CODE_STRUCT
)
102 error (_("This context has class, union or enum %s, not a struct."),
109 lookup_objc_class (char *classname
)
111 struct value
* function
, *classval
;
113 if (! target_has_execution
)
115 /* Can't call into inferior to lookup class. */
119 if (lookup_minimal_symbol("objc_lookUpClass", 0, 0))
120 function
= find_function_in_inferior("objc_lookUpClass");
121 else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0))
122 function
= find_function_in_inferior("objc_lookup_class");
125 complaint (&symfile_complaints
, _("no way to lookup Objective-C classes"));
129 classval
= value_string (classname
, strlen (classname
) + 1);
130 classval
= value_coerce_array (classval
);
131 return (CORE_ADDR
) value_as_long (call_function_by_hand (function
,
136 lookup_child_selector (char *selname
)
138 struct value
* function
, *selstring
;
140 if (! target_has_execution
)
142 /* Can't call into inferior to lookup selector. */
146 if (lookup_minimal_symbol("sel_getUid", 0, 0))
147 function
= find_function_in_inferior("sel_getUid");
148 else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0))
149 function
= find_function_in_inferior("sel_get_any_uid");
152 complaint (&symfile_complaints
, _("no way to lookup Objective-C selectors"));
156 selstring
= value_coerce_array (value_string (selname
,
157 strlen (selname
) + 1));
158 return value_as_long (call_function_by_hand (function
, 1, &selstring
));
162 value_nsstring (char *ptr
, int len
)
164 struct value
*stringValue
[3];
165 struct value
*function
, *nsstringValue
;
169 if (!target_has_execution
)
170 return 0; /* Can't call into inferior to create NSString. */
172 sym
= lookup_struct_typedef("NSString", 0, 1);
174 sym
= lookup_struct_typedef("NXString", 0, 1);
176 type
= lookup_pointer_type(builtin_type_void
);
178 type
= lookup_pointer_type(SYMBOL_TYPE (sym
));
180 stringValue
[2] = value_string(ptr
, len
);
181 stringValue
[2] = value_coerce_array(stringValue
[2]);
182 /* _NSNewStringFromCString replaces "istr" after Lantern2A. */
183 if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0))
185 function
= find_function_in_inferior("_NSNewStringFromCString");
186 nsstringValue
= call_function_by_hand(function
, 1, &stringValue
[2]);
188 else if (lookup_minimal_symbol("istr", 0, 0))
190 function
= find_function_in_inferior("istr");
191 nsstringValue
= call_function_by_hand(function
, 1, &stringValue
[2]);
193 else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0))
195 function
= find_function_in_inferior("+[NSString stringWithCString:]");
196 stringValue
[0] = value_from_longest
197 (builtin_type_long
, lookup_objc_class ("NSString"));
198 stringValue
[1] = value_from_longest
199 (builtin_type_long
, lookup_child_selector ("stringWithCString:"));
200 nsstringValue
= call_function_by_hand(function
, 3, &stringValue
[0]);
203 error (_("NSString: internal error -- no way to create new NSString"));
205 deprecated_set_value_type (nsstringValue
, type
);
206 return nsstringValue
;
209 /* Objective-C name demangling. */
212 objc_demangle (const char *mangled
, int options
)
214 char *demangled
, *cp
;
216 if (mangled
[0] == '_' &&
217 (mangled
[1] == 'i' || mangled
[1] == 'c') &&
220 cp
= demangled
= xmalloc(strlen(mangled
) + 2);
222 if (mangled
[1] == 'i')
223 *cp
++ = '-'; /* for instance method */
225 *cp
++ = '+'; /* for class method */
227 *cp
++ = '['; /* opening left brace */
228 strcpy(cp
, mangled
+3); /* tack on the rest of the mangled name */
230 while (*cp
&& *cp
== '_')
231 cp
++; /* skip any initial underbars in class name */
233 cp
= strchr(cp
, '_');
234 if (!cp
) /* find first non-initial underbar */
236 xfree(demangled
); /* not mangled name */
239 if (cp
[1] == '_') { /* easy case: no category name */
240 *cp
++ = ' '; /* replace two '_' with one ' ' */
241 strcpy(cp
, mangled
+ (cp
- demangled
) + 2);
244 *cp
++ = '('; /* less easy case: category name */
245 cp
= strchr(cp
, '_');
248 xfree(demangled
); /* not mangled name */
252 *cp
++ = ' '; /* overwriting 1st char of method name... */
253 strcpy(cp
, mangled
+ (cp
- demangled
)); /* get it back */
256 while (*cp
&& *cp
== '_')
257 cp
++; /* skip any initial underbars in method name */
261 *cp
= ':'; /* replace remaining '_' with ':' */
263 *cp
++ = ']'; /* closing right brace */
264 *cp
++ = 0; /* string terminator */
268 return NULL
; /* Not an objc mangled name. */
271 /* Print the character C on STREAM as part of the contents of a
272 literal string whose delimiter is QUOTER. Note that that format
273 for printing characters and strings is language specific. */
276 objc_emit_char (int c
, struct ui_file
*stream
, int quoter
)
279 c
&= 0xFF; /* Avoid sign bit follies. */
281 if (PRINT_LITERAL_FORM (c
))
283 if (c
== '\\' || c
== quoter
)
285 fputs_filtered ("\\", stream
);
287 fprintf_filtered (stream
, "%c", c
);
294 fputs_filtered ("\\n", stream
);
297 fputs_filtered ("\\b", stream
);
300 fputs_filtered ("\\t", stream
);
303 fputs_filtered ("\\f", stream
);
306 fputs_filtered ("\\r", stream
);
309 fputs_filtered ("\\e", stream
);
312 fputs_filtered ("\\a", stream
);
315 fprintf_filtered (stream
, "\\%.3o", (unsigned int) c
);
322 objc_printchar (int c
, struct ui_file
*stream
)
324 fputs_filtered ("'", stream
);
325 objc_emit_char (c
, stream
, '\'');
326 fputs_filtered ("'", stream
);
329 /* Print the character string STRING, printing at most LENGTH
330 characters. Printing stops early if the number hits print_max;
331 repeat counts are printed as appropriate. Print ellipses at the
332 end if we had to stop before printing LENGTH characters, or if
336 objc_printstr (struct ui_file
*stream
, const gdb_byte
*string
,
337 unsigned int length
, int width
, int force_ellipses
)
340 unsigned int things_printed
= 0;
344 /* If the string was not truncated due to `set print elements', and
345 the last byte of it is a null, we don't print that, in
346 traditional C style. */
347 if ((!force_ellipses
) && length
> 0 && string
[length
-1] == '\0')
352 fputs_filtered ("\"\"", stream
);
356 for (i
= 0; i
< length
&& things_printed
< print_max
; ++i
)
358 /* Position of the character we are examining to see whether it
361 /* Number of repetitions we have detected so far. */
368 fputs_filtered (", ", stream
);
374 while (rep1
< length
&& string
[rep1
] == string
[i
])
380 if (reps
> repeat_count_threshold
)
385 fputs_filtered ("\\\", ", stream
);
387 fputs_filtered ("\", ", stream
);
390 objc_printchar (string
[i
], stream
);
391 fprintf_filtered (stream
, " <repeats %u times>", reps
);
393 things_printed
+= repeat_count_threshold
;
401 fputs_filtered ("\\\"", stream
);
403 fputs_filtered ("\"", stream
);
406 objc_emit_char (string
[i
], stream
, '"');
411 /* Terminate the quotes if necessary. */
415 fputs_filtered ("\\\"", stream
);
417 fputs_filtered ("\"", stream
);
420 if (force_ellipses
|| i
< length
)
421 fputs_filtered ("...", stream
);
424 /* Create a fundamental C type using default reasonable for the
427 Some object/debugging file formats (DWARF version 1, COFF, etc) do
428 not define fundamental types such as "int" or "double". Others
429 (stabs or DWARF version 2, etc) do define fundamental types. For
430 the formats which don't provide fundamental types, gdb can create
431 such types using this function.
433 FIXME: Some compilers distinguish explicitly signed integral types
434 (signed short, signed int, signed long) from "regular" integral
435 types (short, int, long) in the debugging information. There is
436 some disagreement as to how useful this feature is. In particular,
437 gcc does not support this. Also, only some debugging formats allow
438 the distinction to be passed on to a debugger. For now, we always
439 just use "short", "int", or "long" as the type name, for both the
440 implicit and explicitly signed types. This also makes life easier
441 for the gdb test suite since we don't have to account for the
442 differences in output depending upon what the compiler and
443 debugging format support. We will probably have to re-examine the
444 issue when gdb starts taking it's fundamental type information
445 directly from the debugging information supplied by the compiler.
449 objc_create_fundamental_type (struct objfile
*objfile
, int typeid)
451 struct type
*type
= NULL
;
456 /* FIXME: For now, if we are asked to produce a type not in
457 this language, create the equivalent of a C integer type
458 with the name "<?type?>". When all the dust settles from
459 the type reconstruction work, this should probably become
461 type
= init_type (TYPE_CODE_INT
,
462 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
463 0, "<?type?>", objfile
);
464 warning (_("internal error: no C/C++ fundamental type %d"), typeid);
467 type
= init_type (TYPE_CODE_VOID
,
468 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
472 type
= init_type (TYPE_CODE_INT
,
473 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
477 type
= init_type (TYPE_CODE_INT
,
478 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
479 0, "signed char", objfile
);
481 case FT_UNSIGNED_CHAR
:
482 type
= init_type (TYPE_CODE_INT
,
483 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
484 TYPE_FLAG_UNSIGNED
, "unsigned char", objfile
);
487 type
= init_type (TYPE_CODE_INT
,
488 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
489 0, "short", objfile
);
491 case FT_SIGNED_SHORT
:
492 type
= init_type (TYPE_CODE_INT
,
493 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
494 0, "short", objfile
); /* FIXME-fnf */
496 case FT_UNSIGNED_SHORT
:
497 type
= init_type (TYPE_CODE_INT
,
498 gdbarch_short_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
499 TYPE_FLAG_UNSIGNED
, "unsigned short", objfile
);
502 type
= init_type (TYPE_CODE_INT
,
503 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
506 case FT_SIGNED_INTEGER
:
507 type
= init_type (TYPE_CODE_INT
,
508 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
509 0, "int", objfile
); /* FIXME -fnf */
511 case FT_UNSIGNED_INTEGER
:
512 type
= init_type (TYPE_CODE_INT
,
513 gdbarch_int_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
514 TYPE_FLAG_UNSIGNED
, "unsigned int", objfile
);
517 type
= init_type (TYPE_CODE_INT
,
518 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
522 type
= init_type (TYPE_CODE_INT
,
523 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
524 0, "long", objfile
); /* FIXME -fnf */
526 case FT_UNSIGNED_LONG
:
527 type
= init_type (TYPE_CODE_INT
,
528 gdbarch_long_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
529 TYPE_FLAG_UNSIGNED
, "unsigned long", objfile
);
532 type
= init_type (TYPE_CODE_INT
,
533 gdbarch_long_long_bit (current_gdbarch
)
535 0, "long long", objfile
);
537 case FT_SIGNED_LONG_LONG
:
538 type
= init_type (TYPE_CODE_INT
,
539 gdbarch_long_long_bit (current_gdbarch
)
541 0, "signed long long", objfile
);
543 case FT_UNSIGNED_LONG_LONG
:
544 type
= init_type (TYPE_CODE_INT
,
545 gdbarch_long_long_bit (current_gdbarch
)
547 TYPE_FLAG_UNSIGNED
, "unsigned long long", objfile
);
550 type
= init_type (TYPE_CODE_FLT
,
551 gdbarch_float_bit (current_gdbarch
) / TARGET_CHAR_BIT
,
552 0, "float", objfile
);
554 case FT_DBL_PREC_FLOAT
:
555 type
= init_type (TYPE_CODE_FLT
,
556 gdbarch_double_bit (current_gdbarch
)
558 0, "double", objfile
);
560 case FT_EXT_PREC_FLOAT
:
561 type
= init_type (TYPE_CODE_FLT
,
562 gdbarch_long_double_bit (current_gdbarch
)
564 0, "long double", objfile
);
570 /* Determine if we are currently in the Objective-C dispatch function.
571 If so, get the address of the method function that the dispatcher
572 would call and use that as the function to step into instead. Also
573 skip over the trampoline for the function (if any). This is better
574 for the user since they are only interested in stepping into the
575 method function anyway. */
577 objc_skip_trampoline (struct frame_info
*frame
, CORE_ADDR stop_pc
)
579 CORE_ADDR real_stop_pc
;
580 CORE_ADDR method_stop_pc
;
582 real_stop_pc
= gdbarch_skip_trampoline_code
583 (current_gdbarch
, frame
, stop_pc
);
585 if (real_stop_pc
!= 0)
586 find_objc_msgcall (real_stop_pc
, &method_stop_pc
);
588 find_objc_msgcall (stop_pc
, &method_stop_pc
);
592 real_stop_pc
= gdbarch_skip_trampoline_code
593 (current_gdbarch
, frame
, method_stop_pc
);
594 if (real_stop_pc
== 0)
595 real_stop_pc
= method_stop_pc
;
602 /* Table mapping opcodes into strings for printing operators
603 and precedences of the operators. */
605 static const struct op_print objc_op_print_tab
[] =
607 {",", BINOP_COMMA
, PREC_COMMA
, 0},
608 {"=", BINOP_ASSIGN
, PREC_ASSIGN
, 1},
609 {"||", BINOP_LOGICAL_OR
, PREC_LOGICAL_OR
, 0},
610 {"&&", BINOP_LOGICAL_AND
, PREC_LOGICAL_AND
, 0},
611 {"|", BINOP_BITWISE_IOR
, PREC_BITWISE_IOR
, 0},
612 {"^", BINOP_BITWISE_XOR
, PREC_BITWISE_XOR
, 0},
613 {"&", BINOP_BITWISE_AND
, PREC_BITWISE_AND
, 0},
614 {"==", BINOP_EQUAL
, PREC_EQUAL
, 0},
615 {"!=", BINOP_NOTEQUAL
, PREC_EQUAL
, 0},
616 {"<=", BINOP_LEQ
, PREC_ORDER
, 0},
617 {">=", BINOP_GEQ
, PREC_ORDER
, 0},
618 {">", BINOP_GTR
, PREC_ORDER
, 0},
619 {"<", BINOP_LESS
, PREC_ORDER
, 0},
620 {">>", BINOP_RSH
, PREC_SHIFT
, 0},
621 {"<<", BINOP_LSH
, PREC_SHIFT
, 0},
622 {"+", BINOP_ADD
, PREC_ADD
, 0},
623 {"-", BINOP_SUB
, PREC_ADD
, 0},
624 {"*", BINOP_MUL
, PREC_MUL
, 0},
625 {"/", BINOP_DIV
, PREC_MUL
, 0},
626 {"%", BINOP_REM
, PREC_MUL
, 0},
627 {"@", BINOP_REPEAT
, PREC_REPEAT
, 0},
628 {"-", UNOP_NEG
, PREC_PREFIX
, 0},
629 {"!", UNOP_LOGICAL_NOT
, PREC_PREFIX
, 0},
630 {"~", UNOP_COMPLEMENT
, PREC_PREFIX
, 0},
631 {"*", UNOP_IND
, PREC_PREFIX
, 0},
632 {"&", UNOP_ADDR
, PREC_PREFIX
, 0},
633 {"sizeof ", UNOP_SIZEOF
, PREC_PREFIX
, 0},
634 {"++", UNOP_PREINCREMENT
, PREC_PREFIX
, 0},
635 {"--", UNOP_PREDECREMENT
, PREC_PREFIX
, 0},
636 {NULL
, OP_NULL
, PREC_NULL
, 0}
639 const struct language_defn objc_language_defn
= {
640 "objective-c", /* Language name */
647 &exp_descriptor_standard
,
651 objc_printchar
, /* Print a character constant */
652 objc_printstr
, /* Function to print string constant */
654 objc_create_fundamental_type
, /* Create fundamental type in this language */
655 c_print_type
, /* Print a type using appropriate syntax */
656 c_val_print
, /* Print a value using appropriate syntax */
657 c_value_print
, /* Print a top-level value */
658 objc_skip_trampoline
, /* Language specific skip_trampoline */
659 value_of_this
, /* value_of_this */
660 basic_lookup_symbol_nonlocal
, /* lookup_symbol_nonlocal */
661 basic_lookup_transparent_type
,/* lookup_transparent_type */
662 objc_demangle
, /* Language specific symbol demangler */
663 NULL
, /* Language specific class_name_from_physname */
664 objc_op_print_tab
, /* Expression operators for printing */
665 1, /* C-style arrays */
666 0, /* String lower bound */
668 default_word_break_characters
,
669 c_language_arch_info
,
670 default_print_array_index
,
676 * Following functions help construct Objective-C message calls
679 struct selname
/* For parsing Objective-C. */
681 struct selname
*next
;
686 static int msglist_len
;
687 static struct selname
*selname_chain
;
688 static char *msglist_sel
;
693 struct selname
*new =
694 (struct selname
*) xmalloc (sizeof (struct selname
));
696 new->next
= selname_chain
;
697 new->msglist_len
= msglist_len
;
698 new->msglist_sel
= msglist_sel
;
700 msglist_sel
= (char *)xmalloc(1);
706 add_msglist(struct stoken
*str
, int addcolon
)
711 if (str
== 0) { /* Unnamed arg, or... */
712 if (addcolon
== 0) { /* variable number of args. */
722 len
= plen
+ strlen(msglist_sel
) + 2;
723 s
= (char *)xmalloc(len
);
724 strcpy(s
, msglist_sel
);
739 int val
= msglist_len
;
740 struct selname
*sel
= selname_chain
;
741 char *p
= msglist_sel
;
744 selname_chain
= sel
->next
;
745 msglist_len
= sel
->msglist_len
;
746 msglist_sel
= sel
->msglist_sel
;
747 selid
= lookup_child_selector(p
);
749 error (_("Can't find selector \"%s\""), p
);
750 write_exp_elt_longcst (selid
);
752 write_exp_elt_longcst (val
); /* Number of args */
759 * Function: specialcmp (char *a, char *b)
761 * Special strcmp: treats ']' and ' ' as end-of-string.
762 * Used for qsorting lists of objc methods (either by class or selector).
766 specialcmp (char *a
, char *b
)
768 while (*a
&& *a
!= ' ' && *a
!= ']' && *b
&& *b
!= ' ' && *b
!= ']')
774 if (*a
&& *a
!= ' ' && *a
!= ']')
775 return 1; /* a is longer therefore greater */
776 if (*b
&& *b
!= ' ' && *b
!= ']')
777 return -1; /* a is shorter therefore lesser */
778 return 0; /* a and b are identical */
782 * Function: compare_selectors (const void *, const void *)
784 * Comparison function for use with qsort. Arguments are symbols or
785 * msymbols Compares selector part of objc method name alphabetically.
789 compare_selectors (const void *a
, const void *b
)
793 aname
= SYMBOL_PRINT_NAME (*(struct symbol
**) a
);
794 bname
= SYMBOL_PRINT_NAME (*(struct symbol
**) b
);
795 if (aname
== NULL
|| bname
== NULL
)
796 error (_("internal: compare_selectors(1)"));
798 aname
= strchr(aname
, ' ');
799 bname
= strchr(bname
, ' ');
800 if (aname
== NULL
|| bname
== NULL
)
801 error (_("internal: compare_selectors(2)"));
803 return specialcmp (aname
+1, bname
+1);
807 * Function: selectors_info (regexp, from_tty)
809 * Implements the "Info selectors" command. Takes an optional regexp
810 * arg. Lists all objective c selectors that match the regexp. Works
811 * by grepping thru all symbols for objective c methods. Output list
812 * is sorted and uniqued.
816 selectors_info (char *regexp
, int from_tty
)
818 struct objfile
*objfile
;
819 struct minimal_symbol
*msymbol
;
827 struct symbol
**sym_arr
;
831 strcpy(myregexp
, ".*]"); /* Null input, match all objc methods. */
834 if (*regexp
== '+' || *regexp
== '-')
835 { /* User wants only class methods or only instance methods. */
836 plusminus
= *regexp
++;
837 while (*regexp
== ' ' || *regexp
== '\t')
841 strcpy(myregexp
, ".*]");
844 strcpy(myregexp
, regexp
);
845 if (myregexp
[strlen(myregexp
) - 1] == '$') /* end of selector */
846 myregexp
[strlen(myregexp
) - 1] = ']'; /* end of method name */
848 strcat(myregexp
, ".*]");
854 val
= re_comp (myregexp
);
856 error (_("Invalid regexp (%s): %s"), val
, regexp
);
859 /* First time thru is JUST to get max length and count. */
860 ALL_MSYMBOLS (objfile
, msymbol
)
863 name
= SYMBOL_NATURAL_NAME (msymbol
);
865 (name
[0] == '-' || name
[0] == '+') &&
866 name
[1] == '[') /* Got a method name. */
868 /* Filter for class/instance methods. */
869 if (plusminus
&& name
[0] != plusminus
)
871 /* Find selector part. */
872 name
= (char *) strchr(name
+2, ' ');
873 if (regexp
== NULL
|| re_exec(++name
) != 0)
875 char *mystart
= name
;
876 char *myend
= (char *) strchr(mystart
, ']');
878 if (myend
&& (myend
- mystart
> maxlen
))
879 maxlen
= myend
- mystart
; /* Get longest selector. */
886 printf_filtered (_("Selectors matching \"%s\":\n\n"),
887 regexp
? regexp
: "*");
889 sym_arr
= alloca (matches
* sizeof (struct symbol
*));
891 ALL_MSYMBOLS (objfile
, msymbol
)
894 name
= SYMBOL_NATURAL_NAME (msymbol
);
896 (name
[0] == '-' || name
[0] == '+') &&
897 name
[1] == '[') /* Got a method name. */
899 /* Filter for class/instance methods. */
900 if (plusminus
&& name
[0] != plusminus
)
902 /* Find selector part. */
903 name
= (char *) strchr(name
+2, ' ');
904 if (regexp
== NULL
|| re_exec(++name
) != 0)
905 sym_arr
[matches
++] = (struct symbol
*) msymbol
;
909 qsort (sym_arr
, matches
, sizeof (struct minimal_symbol
*),
911 /* Prevent compare on first iteration. */
913 for (ix
= 0; ix
< matches
; ix
++) /* Now do the output. */
918 name
= SYMBOL_NATURAL_NAME (sym_arr
[ix
]);
919 name
= strchr (name
, ' ') + 1;
920 if (p
[0] && specialcmp(name
, p
) == 0)
921 continue; /* Seen this one already (not unique). */
923 /* Copy selector part. */
924 while (*name
&& *name
!= ']')
927 /* Print in columns. */
928 puts_filtered_tabular(asel
, maxlen
+ 1, 0);
933 printf_filtered (_("No selectors matching \"%s\"\n"), regexp
? regexp
: "*");
937 * Function: compare_classes (const void *, const void *)
939 * Comparison function for use with qsort. Arguments are symbols or
940 * msymbols Compares class part of objc method name alphabetically.
944 compare_classes (const void *a
, const void *b
)
948 aname
= SYMBOL_PRINT_NAME (*(struct symbol
**) a
);
949 bname
= SYMBOL_PRINT_NAME (*(struct symbol
**) b
);
950 if (aname
== NULL
|| bname
== NULL
)
951 error (_("internal: compare_classes(1)"));
953 return specialcmp (aname
+1, bname
+1);
957 * Function: classes_info(regexp, from_tty)
959 * Implements the "info classes" command for objective c classes.
960 * Lists all objective c classes that match the optional regexp.
961 * Works by grepping thru the list of objective c methods. List will
962 * be sorted and uniqued (since one class may have many methods).
963 * BUGS: will not list a class that has no methods.
967 classes_info (char *regexp
, int from_tty
)
969 struct objfile
*objfile
;
970 struct minimal_symbol
*msymbol
;
978 struct symbol
**sym_arr
;
981 strcpy(myregexp
, ".* "); /* Null input: match all objc classes. */
984 strcpy(myregexp
, regexp
);
985 if (myregexp
[strlen(myregexp
) - 1] == '$')
986 /* In the method name, the end of the class name is marked by ' '. */
987 myregexp
[strlen(myregexp
) - 1] = ' ';
989 strcat(myregexp
, ".* ");
994 val
= re_comp (myregexp
);
996 error (_("Invalid regexp (%s): %s"), val
, regexp
);
999 /* First time thru is JUST to get max length and count. */
1000 ALL_MSYMBOLS (objfile
, msymbol
)
1003 name
= SYMBOL_NATURAL_NAME (msymbol
);
1005 (name
[0] == '-' || name
[0] == '+') &&
1006 name
[1] == '[') /* Got a method name. */
1007 if (regexp
== NULL
|| re_exec(name
+2) != 0)
1009 /* Compute length of classname part. */
1010 char *mystart
= name
+ 2;
1011 char *myend
= (char *) strchr(mystart
, ' ');
1013 if (myend
&& (myend
- mystart
> maxlen
))
1014 maxlen
= myend
- mystart
;
1020 printf_filtered (_("Classes matching \"%s\":\n\n"),
1021 regexp
? regexp
: "*");
1022 sym_arr
= alloca (matches
* sizeof (struct symbol
*));
1024 ALL_MSYMBOLS (objfile
, msymbol
)
1027 name
= SYMBOL_NATURAL_NAME (msymbol
);
1029 (name
[0] == '-' || name
[0] == '+') &&
1030 name
[1] == '[') /* Got a method name. */
1031 if (regexp
== NULL
|| re_exec(name
+2) != 0)
1032 sym_arr
[matches
++] = (struct symbol
*) msymbol
;
1035 qsort (sym_arr
, matches
, sizeof (struct minimal_symbol
*),
1037 /* Prevent compare on first iteration. */
1039 for (ix
= 0; ix
< matches
; ix
++) /* Now do the output. */
1044 name
= SYMBOL_NATURAL_NAME (sym_arr
[ix
]);
1046 if (p
[0] && specialcmp(name
, p
) == 0)
1047 continue; /* Seen this one already (not unique). */
1049 /* Copy class part of method name. */
1050 while (*name
&& *name
!= ' ')
1053 /* Print in columns. */
1054 puts_filtered_tabular(aclass
, maxlen
+ 1, 0);
1059 printf_filtered (_("No classes matching \"%s\"\n"), regexp
? regexp
: "*");
1063 * Function: find_imps (char *selector, struct symbol **sym_arr)
1065 * Input: a string representing a selector
1066 * a pointer to an array of symbol pointers
1067 * possibly a pointer to a symbol found by the caller.
1069 * Output: number of methods that implement that selector. Side
1070 * effects: The array of symbol pointers is filled with matching syms.
1072 * By analogy with function "find_methods" (symtab.c), builds a list
1073 * of symbols matching the ambiguous input, so that "decode_line_2"
1074 * (symtab.c) can list them and ask the user to choose one or more.
1075 * In this case the matches are objective c methods
1076 * ("implementations") matching an objective c selector.
1078 * Note that it is possible for a normal (c-style) function to have
1079 * the same name as an objective c selector. To prevent the selector
1080 * from eclipsing the function, we allow the caller (decode_line_1) to
1081 * search for such a function first, and if it finds one, pass it in
1082 * to us. We will then integrate it into the list. We also search
1083 * for one here, among the minsyms.
1085 * NOTE: if NUM_DEBUGGABLE is non-zero, the sym_arr will be divided
1086 * into two parts: debuggable (struct symbol) syms, and
1087 * non_debuggable (struct minimal_symbol) syms. The debuggable
1088 * ones will come first, before NUM_DEBUGGABLE (which will thus
1089 * be the index of the first non-debuggable one).
1093 * Function: total_number_of_imps (char *selector);
1095 * Input: a string representing a selector
1096 * Output: number of methods that implement that selector.
1098 * By analogy with function "total_number_of_methods", this allows
1099 * decode_line_1 (symtab.c) to detect if there are objective c methods
1100 * matching the input, and to allocate an array of pointers to them
1101 * which can be manipulated by "decode_line_2" (also in symtab.c).
1105 parse_selector (char *method
, char **selector
)
1109 int found_quote
= 0;
1111 char *nselector
= NULL
;
1113 gdb_assert (selector
!= NULL
);
1117 while (isspace (*s1
))
1124 while (isspace (*s1
))
1131 if (isalnum (*s2
) || (*s2
== '_') || (*s2
== ':'))
1133 else if (isspace (*s2
))
1135 else if ((*s2
== '\0') || (*s2
== '\''))
1143 while (isspace (*s2
))
1149 while (isspace (*s2
))
1153 if (selector
!= NULL
)
1154 *selector
= nselector
;
1160 parse_method (char *method
, char *type
, char **class,
1161 char **category
, char **selector
)
1165 int found_quote
= 0;
1168 char *nclass
= NULL
;
1169 char *ncategory
= NULL
;
1170 char *nselector
= NULL
;
1172 gdb_assert (type
!= NULL
);
1173 gdb_assert (class != NULL
);
1174 gdb_assert (category
!= NULL
);
1175 gdb_assert (selector
!= NULL
);
1179 while (isspace (*s1
))
1186 while (isspace (*s1
))
1189 if ((s1
[0] == '+') || (s1
[0] == '-'))
1192 while (isspace (*s1
))
1200 while (isalnum (*s1
) || (*s1
== '_'))
1204 while (isspace (*s2
))
1210 while (isspace (*s2
))
1213 while (isalnum (*s2
) || (*s2
== '_'))
1218 /* Truncate the class name now that we're not using the open paren. */
1225 if (isalnum (*s2
) || (*s2
== '_') || (*s2
== ':'))
1227 else if (isspace (*s2
))
1229 else if (*s2
== ']')
1238 while (isspace (*s2
))
1245 while (isspace (*s2
))
1253 if (category
!= NULL
)
1254 *category
= ncategory
;
1255 if (selector
!= NULL
)
1256 *selector
= nselector
;
1262 find_methods (struct symtab
*symtab
, char type
,
1263 const char *class, const char *category
,
1264 const char *selector
, struct symbol
**syms
,
1265 unsigned int *nsym
, unsigned int *ndebug
)
1267 struct objfile
*objfile
= NULL
;
1268 struct minimal_symbol
*msymbol
= NULL
;
1269 struct block
*block
= NULL
;
1270 struct symbol
*sym
= NULL
;
1272 char *symname
= NULL
;
1275 char *nclass
= NULL
;
1276 char *ncategory
= NULL
;
1277 char *nselector
= NULL
;
1279 unsigned int csym
= 0;
1280 unsigned int cdebug
= 0;
1282 static char *tmp
= NULL
;
1283 static unsigned int tmplen
= 0;
1285 gdb_assert (nsym
!= NULL
);
1286 gdb_assert (ndebug
!= NULL
);
1289 block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab
), STATIC_BLOCK
);
1291 ALL_MSYMBOLS (objfile
, msymbol
)
1295 if ((msymbol
->type
!= mst_text
) && (msymbol
->type
!= mst_file_text
))
1296 /* Not a function or method. */
1300 if ((SYMBOL_VALUE_ADDRESS (msymbol
) < BLOCK_START (block
)) ||
1301 (SYMBOL_VALUE_ADDRESS (msymbol
) >= BLOCK_END (block
)))
1302 /* Not in the specified symtab. */
1305 symname
= SYMBOL_NATURAL_NAME (msymbol
);
1306 if (symname
== NULL
)
1309 if ((symname
[0] != '-' && symname
[0] != '+') || (symname
[1] != '['))
1310 /* Not a method name. */
1313 while ((strlen (symname
) + 1) >= tmplen
)
1315 tmplen
= (tmplen
== 0) ? 1024 : tmplen
* 2;
1316 tmp
= xrealloc (tmp
, tmplen
);
1318 strcpy (tmp
, symname
);
1320 if (parse_method (tmp
, &ntype
, &nclass
, &ncategory
, &nselector
) == NULL
)
1323 if ((type
!= '\0') && (ntype
!= type
))
1327 && ((nclass
== NULL
) || (strcmp (class, nclass
) != 0)))
1330 if ((category
!= NULL
) &&
1331 ((ncategory
== NULL
) || (strcmp (category
, ncategory
) != 0)))
1334 if ((selector
!= NULL
) &&
1335 ((nselector
== NULL
) || (strcmp (selector
, nselector
) != 0)))
1338 sym
= find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol
));
1341 const char *newsymname
= SYMBOL_NATURAL_NAME (sym
);
1343 if (strcmp (symname
, newsymname
) == 0)
1345 /* Found a high-level method sym: swap it into the
1346 lower part of sym_arr (below num_debuggable). */
1349 syms
[csym
] = syms
[cdebug
];
1358 "debugging symbol \"%s\" does not match minimal symbol (\"%s\"); ignoring",
1359 newsymname
, symname
);
1361 syms
[csym
] = (struct symbol
*) msymbol
;
1367 /* Found a non-debuggable method symbol. */
1369 syms
[csym
] = (struct symbol
*) msymbol
;
1380 char *find_imps (struct symtab
*symtab
, struct block
*block
,
1381 char *method
, struct symbol
**syms
,
1382 unsigned int *nsym
, unsigned int *ndebug
)
1386 char *category
= NULL
;
1387 char *selector
= NULL
;
1389 unsigned int csym
= 0;
1390 unsigned int cdebug
= 0;
1392 unsigned int ncsym
= 0;
1393 unsigned int ncdebug
= 0;
1398 gdb_assert (nsym
!= NULL
);
1399 gdb_assert (ndebug
!= NULL
);
1406 buf
= (char *) alloca (strlen (method
) + 1);
1407 strcpy (buf
, method
);
1408 tmp
= parse_method (buf
, &type
, &class, &category
, &selector
);
1412 struct symbol
*sym
= NULL
;
1413 struct minimal_symbol
*msym
= NULL
;
1415 strcpy (buf
, method
);
1416 tmp
= parse_selector (buf
, &selector
);
1421 sym
= lookup_symbol (selector
, block
, VAR_DOMAIN
, 0, NULL
);
1431 msym
= lookup_minimal_symbol (selector
, 0, 0);
1436 syms
[csym
] = (struct symbol
*)msym
;
1442 find_methods (symtab
, type
, class, category
, selector
,
1443 syms
+ csym
, &ncsym
, &ncdebug
);
1445 find_methods (symtab
, type
, class, category
, selector
,
1446 NULL
, &ncsym
, &ncdebug
);
1448 /* If we didn't find any methods, just return. */
1449 if (ncsym
== 0 && ncdebug
== 0)
1452 /* Take debug symbols from the second batch of symbols and swap them
1453 * with debug symbols from the first batch. Repeat until either the
1454 * second section is out of debug symbols or the first section is
1455 * full of debug symbols. Either way we have all debug symbols
1456 * packed to the beginning of the buffer.
1461 while ((cdebug
< csym
) && (ncdebug
> 0))
1463 struct symbol
*s
= NULL
;
1464 /* First non-debugging symbol. */
1465 unsigned int i
= cdebug
;
1466 /* Last of second batch of debug symbols. */
1467 unsigned int j
= csym
+ ncdebug
- 1;
1473 /* We've moved a symbol from the second debug section to the
1489 return method
+ (tmp
- buf
);
1493 /* Sort debuggable symbols. */
1495 qsort (syms
, cdebug
, sizeof (struct minimal_symbol
*),
1498 /* Sort minimal_symbols. */
1499 if ((csym
- cdebug
) > 1)
1500 qsort (&syms
[cdebug
], csym
- cdebug
,
1501 sizeof (struct minimal_symbol
*), compare_classes
);
1503 /* Terminate the sym_arr list. */
1506 return method
+ (tmp
- buf
);
1510 print_object_command (char *args
, int from_tty
)
1512 struct value
*object
, *function
, *description
;
1513 CORE_ADDR string_addr
, object_addr
;
1517 if (!args
|| !*args
)
1519 "The 'print-object' command requires an argument (an Objective-C object)");
1522 struct expression
*expr
= parse_expression (args
);
1523 struct cleanup
*old_chain
=
1524 make_cleanup (free_current_contents
, &expr
);
1527 object
= expr
->language_defn
->la_exp_desc
->evaluate_exp
1528 (builtin_type_void_data_ptr
, expr
, &pc
, EVAL_NORMAL
);
1529 do_cleanups (old_chain
);
1532 /* Validate the address for sanity. */
1533 object_addr
= value_as_long (object
);
1534 read_memory (object_addr
, &c
, 1);
1536 function
= find_function_in_inferior ("_NSPrintForDebugger");
1537 if (function
== NULL
)
1538 error (_("Unable to locate _NSPrintForDebugger in child process"));
1540 description
= call_function_by_hand (function
, 1, &object
);
1542 string_addr
= value_as_long (description
);
1543 if (string_addr
== 0)
1544 error (_("object returns null description"));
1546 read_memory (string_addr
+ i
++, &c
, 1);
1549 { /* Read and print characters up to EOS. */
1551 printf_filtered ("%c", c
);
1552 read_memory (string_addr
+ i
++, &c
, 1);
1555 printf_filtered(_("<object returns empty description>"));
1556 printf_filtered ("\n");
1559 /* The data structure 'methcalls' is used to detect method calls (thru
1560 * ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.),
1561 * and ultimately find the method being called.
1564 struct objc_methcall
{
1566 /* Return instance method to be called. */
1567 int (*stop_at
) (CORE_ADDR
, CORE_ADDR
*);
1568 /* Start of pc range corresponding to method invocation. */
1570 /* End of pc range corresponding to method invocation. */
1574 static int resolve_msgsend (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1575 static int resolve_msgsend_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1576 static int resolve_msgsend_super (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1577 static int resolve_msgsend_super_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
);
1579 static struct objc_methcall methcalls
[] = {
1580 { "_objc_msgSend", resolve_msgsend
, 0, 0},
1581 { "_objc_msgSend_stret", resolve_msgsend_stret
, 0, 0},
1582 { "_objc_msgSendSuper", resolve_msgsend_super
, 0, 0},
1583 { "_objc_msgSendSuper_stret", resolve_msgsend_super_stret
, 0, 0},
1584 { "_objc_getClass", NULL
, 0, 0},
1585 { "_objc_getMetaClass", NULL
, 0, 0}
1588 #define nmethcalls (sizeof (methcalls) / sizeof (methcalls[0]))
1590 /* The following function, "find_objc_msgsend", fills in the data
1591 * structure "objc_msgs" by finding the addresses of each of the
1592 * (currently four) functions that it holds (of which objc_msgSend is
1593 * the first). This must be called each time symbols are loaded, in
1594 * case the functions have moved for some reason.
1598 find_objc_msgsend (void)
1601 for (i
= 0; i
< nmethcalls
; i
++) {
1603 struct minimal_symbol
*func
;
1605 /* Try both with and without underscore. */
1606 func
= lookup_minimal_symbol (methcalls
[i
].name
, NULL
, NULL
);
1607 if ((func
== NULL
) && (methcalls
[i
].name
[0] == '_')) {
1608 func
= lookup_minimal_symbol (methcalls
[i
].name
+ 1, NULL
, NULL
);
1611 methcalls
[i
].begin
= 0;
1612 methcalls
[i
].end
= 0;
1616 methcalls
[i
].begin
= SYMBOL_VALUE_ADDRESS (func
);
1618 methcalls
[i
].end
= SYMBOL_VALUE_ADDRESS (++func
);
1619 } while (methcalls
[i
].begin
== methcalls
[i
].end
);
1623 /* find_objc_msgcall (replaces pc_off_limits)
1625 * ALL that this function now does is to determine whether the input
1626 * address ("pc") is the address of one of the Objective-C message
1627 * dispatch functions (mainly objc_msgSend or objc_msgSendSuper), and
1628 * if so, it returns the address of the method that will be called.
1630 * The old function "pc_off_limits" used to do a lot of other things
1631 * in addition, such as detecting shared library jump stubs and
1632 * returning the address of the shlib function that would be called.
1633 * That functionality has been moved into the gdbarch_skip_trampoline_code and
1634 * IN_SOLIB_TRAMPOLINE macros, which are resolved in the target-
1635 * dependent modules.
1638 struct objc_submethod_helper_data
{
1639 int (*f
) (CORE_ADDR
, CORE_ADDR
*);
1645 find_objc_msgcall_submethod_helper (void * arg
)
1647 struct objc_submethod_helper_data
*s
=
1648 (struct objc_submethod_helper_data
*) arg
;
1650 if (s
->f (s
->pc
, s
->new_pc
) == 0)
1657 find_objc_msgcall_submethod (int (*f
) (CORE_ADDR
, CORE_ADDR
*),
1661 struct objc_submethod_helper_data s
;
1667 if (catch_errors (find_objc_msgcall_submethod_helper
,
1669 "Unable to determine target of Objective-C method call (ignoring):\n",
1670 RETURN_MASK_ALL
) == 0)
1677 find_objc_msgcall (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1681 find_objc_msgsend ();
1687 for (i
= 0; i
< nmethcalls
; i
++)
1688 if ((pc
>= methcalls
[i
].begin
) && (pc
< methcalls
[i
].end
))
1690 if (methcalls
[i
].stop_at
!= NULL
)
1691 return find_objc_msgcall_submethod (methcalls
[i
].stop_at
,
1700 extern initialize_file_ftype _initialize_objc_language
; /* -Wmissing-prototypes */
1703 _initialize_objc_language (void)
1705 add_language (&objc_language_defn
);
1706 add_info ("selectors", selectors_info
, /* INFO SELECTORS command. */
1707 _("All Objective-C selectors, or those matching REGEXP."));
1708 add_info ("classes", classes_info
, /* INFO CLASSES command. */
1709 _("All Objective-C classes, or those matching REGEXP."));
1710 add_com ("print-object", class_vars
, print_object_command
,
1711 _("Ask an Objective-C object to print itself."));
1712 add_com_alias ("po", "print-object", class_vars
, 1);
1716 read_objc_method (CORE_ADDR addr
, struct objc_method
*method
)
1718 method
->name
= read_memory_unsigned_integer (addr
+ 0, 4);
1719 method
->types
= read_memory_unsigned_integer (addr
+ 4, 4);
1720 method
->imp
= read_memory_unsigned_integer (addr
+ 8, 4);
1724 unsigned long read_objc_methlist_nmethods (CORE_ADDR addr
)
1726 return read_memory_unsigned_integer (addr
+ 4, 4);
1730 read_objc_methlist_method (CORE_ADDR addr
, unsigned long num
,
1731 struct objc_method
*method
)
1733 gdb_assert (num
< read_objc_methlist_nmethods (addr
));
1734 read_objc_method (addr
+ 8 + (12 * num
), method
);
1738 read_objc_object (CORE_ADDR addr
, struct objc_object
*object
)
1740 object
->isa
= read_memory_unsigned_integer (addr
, 4);
1744 read_objc_super (CORE_ADDR addr
, struct objc_super
*super
)
1746 super
->receiver
= read_memory_unsigned_integer (addr
, 4);
1747 super
->class = read_memory_unsigned_integer (addr
+ 4, 4);
1751 read_objc_class (CORE_ADDR addr
, struct objc_class
*class)
1753 class->isa
= read_memory_unsigned_integer (addr
, 4);
1754 class->super_class
= read_memory_unsigned_integer (addr
+ 4, 4);
1755 class->name
= read_memory_unsigned_integer (addr
+ 8, 4);
1756 class->version
= read_memory_unsigned_integer (addr
+ 12, 4);
1757 class->info
= read_memory_unsigned_integer (addr
+ 16, 4);
1758 class->instance_size
= read_memory_unsigned_integer (addr
+ 18, 4);
1759 class->ivars
= read_memory_unsigned_integer (addr
+ 24, 4);
1760 class->methods
= read_memory_unsigned_integer (addr
+ 28, 4);
1761 class->cache
= read_memory_unsigned_integer (addr
+ 32, 4);
1762 class->protocols
= read_memory_unsigned_integer (addr
+ 36, 4);
1766 find_implementation_from_class (CORE_ADDR
class, CORE_ADDR sel
)
1768 CORE_ADDR subclass
= class;
1770 while (subclass
!= 0)
1773 struct objc_class class_str
;
1774 unsigned mlistnum
= 0;
1776 read_objc_class (subclass
, &class_str
);
1781 unsigned long nmethods
;
1784 mlist
= read_memory_unsigned_integer (class_str
.methods
+
1789 nmethods
= read_objc_methlist_nmethods (mlist
);
1791 for (i
= 0; i
< nmethods
; i
++)
1793 struct objc_method meth_str
;
1794 read_objc_methlist_method (mlist
, i
, &meth_str
);
1798 "checking method 0x%lx against selector 0x%lx\n",
1799 meth_str
.name
, sel
);
1802 if (meth_str
.name
== sel
)
1803 /* FIXME: hppa arch was doing a pointer dereference
1804 here. There needs to be a better way to do that. */
1805 return meth_str
.imp
;
1809 subclass
= class_str
.super_class
;
1816 find_implementation (CORE_ADDR object
, CORE_ADDR sel
)
1818 struct objc_object ostr
;
1822 read_objc_object (object
, &ostr
);
1826 return find_implementation_from_class (ostr
.isa
, sel
);
1829 #define OBJC_FETCH_POINTER_ARGUMENT(argi) \
1830 gdbarch_fetch_pointer_argument (current_gdbarch, get_current_frame (), \
1831 argi, builtin_type_void_func_ptr)
1834 resolve_msgsend (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1840 object
= OBJC_FETCH_POINTER_ARGUMENT (0);
1841 sel
= OBJC_FETCH_POINTER_ARGUMENT (1);
1843 res
= find_implementation (object
, sel
);
1852 resolve_msgsend_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1858 object
= OBJC_FETCH_POINTER_ARGUMENT (1);
1859 sel
= OBJC_FETCH_POINTER_ARGUMENT (2);
1861 res
= find_implementation (object
, sel
);
1870 resolve_msgsend_super (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1872 struct objc_super sstr
;
1878 super
= OBJC_FETCH_POINTER_ARGUMENT (0);
1879 sel
= OBJC_FETCH_POINTER_ARGUMENT (1);
1881 read_objc_super (super
, &sstr
);
1882 if (sstr
.class == 0)
1885 res
= find_implementation_from_class (sstr
.class, sel
);
1894 resolve_msgsend_super_stret (CORE_ADDR pc
, CORE_ADDR
*new_pc
)
1896 struct objc_super sstr
;
1902 super
= OBJC_FETCH_POINTER_ARGUMENT (1);
1903 sel
= OBJC_FETCH_POINTER_ARGUMENT (2);
1905 read_objc_super (super
, &sstr
);
1906 if (sstr
.class == 0)
1909 res
= find_implementation_from_class (sstr
.class, sel
);