102 error (
_(
"This context has class, union or enum %s, not a struct."),
112 struct value *
function, *classval;
127 _(
"no way to lookup Objective-C classes"));
131 classval =
value_string (classname, strlen (classname) + 1, char_type);
142 struct value *
function, *selstring;
157 _(
"no way to lookup Objective-C selectors"));
171 struct value *stringValue[3];
172 struct value *
function, *nsstringValue;
186 NULL, 1, &stringValue[2]);
206 error (
_(
"NSString: internal error -- no way to create new NSString"));
217 return nsstringValue;
225 char *demangled, *cp;
227 if (mangled[0] ==
'_' &&
228 (mangled[1] ==
'i' || mangled[1] ==
'c') &&
231 cp = demangled = (
char *)
xmalloc (strlen (mangled) + 2);
233 if (mangled[1] ==
'i')
239 strcpy(cp, mangled+3);
241 while (*cp && *cp ==
'_')
245 cp = strchr(cp,
'_');
254 strcpy(cp, mangled + (cp - demangled) + 2);
259 cp = strchr(cp,
'_');
267 strcpy(cp, mangled + (cp - demangled));
270 while (*cp && *cp ==
'_')
292 return *demangled != NULL;
310 if (real_stop_pc != 0)
318 (
gdbarch, frame, method_stop_pc);
319 if (real_stop_pc == 0)
320 real_stop_pc = method_stop_pc;
498 error (
_(
"Can't find selector \"%s\""), p);
517 while (*a && *a !=
' ' && *a !=
']' && *b && *b !=
' ' && *b !=
']')
523 if (*a && *a !=
' ' && *a !=
']')
525 if (*b && *b !=
' ' && *b !=
']')
540 const char *aname, *bname;
544 if (aname == NULL || bname == NULL)
545 error (
_(
"internal: compare_selectors(1)"));
547 aname = strchr(aname,
' ');
548 bname = strchr(bname,
' ');
549 if (aname == NULL || bname == NULL)
550 error (
_(
"internal: compare_selectors(2)"));
580 strcpy(myregexp,
".*]");
583 if (*regexp ==
'+' || *regexp ==
'-')
585 plusminus = *regexp++;
586 while (*regexp ==
' ' || *regexp ==
'\t')
590 strcpy(myregexp,
".*]");
594 if (
sizeof (myregexp) < strlen (regexp) + 4)
595 error (
_(
"Regexp is too long: %s"), regexp);
596 strcpy(myregexp, regexp);
597 if (myregexp[strlen(myregexp) - 1] ==
'$')
598 myregexp[strlen(myregexp) - 1] =
']';
600 strcat(myregexp,
".*]");
608 error (
_(
"Invalid regexp (%s): %s"), val, regexp);
617 && (
name[0] ==
'-' ||
name[0] ==
'+')
621 if (plusminus &&
name[0] != plusminus)
624 name = (
char *) strchr (
name+2,
' ');
628 _(
"Bad method name '%s'"),
632 if (regexp == NULL || re_exec(++
name) != 0)
634 const char *mystart =
name;
635 const char *myend = strchr (mystart,
']');
637 if (myend && (myend - mystart > maxlen))
638 maxlen = myend - mystart;
646 regexp ? regexp :
"*");
648 sym_arr = XALLOCAVEC (
struct symbol *, matches);
655 (
name[0] ==
'-' ||
name[0] ==
'+') &&
659 if (plusminus &&
name[0] != plusminus)
662 name = (
char *) strchr(
name+2,
' ');
663 if (regexp == NULL || re_exec(++
name) != 0)
664 sym_arr[matches++] = (
struct symbol *) msymbol;
672 for (ix = 0; ix < matches; ix++)
693 regexp ? regexp :
"*");
706 const char *aname, *bname;
710 if (aname == NULL || bname == NULL)
711 error (
_(
"internal: compare_classes(1)"));
741 strcpy(myregexp,
".* ");
745 if (
sizeof (myregexp) < strlen (regexp) + 4)
746 error (
_(
"Regexp is too long: %s"), regexp);
747 strcpy(myregexp, regexp);
748 if (myregexp[strlen(myregexp) - 1] ==
'$')
750 myregexp[strlen(myregexp) - 1] =
' ';
752 strcat(myregexp,
".* ");
759 error (
_(
"Invalid regexp (%s): %s"), val, regexp);
768 (
name[0] ==
'-' ||
name[0] ==
'+') &&
770 if (regexp == NULL || re_exec(
name+2) != 0)
773 const char *mystart =
name + 2;
774 const char *myend = strchr (mystart,
' ');
776 if (myend && (myend - mystart > maxlen))
777 maxlen = myend - mystart;
784 regexp ? regexp :
"*");
785 sym_arr = XALLOCAVEC (
struct symbol *, matches);
792 (
name[0] ==
'-' ||
name[0] ==
'+') &&
794 if (regexp == NULL || re_exec(
name+2) != 0)
795 sym_arr[matches++] = (
struct symbol *) msymbol;
802 for (ix = 0; ix < matches; ix++)
832 char *nselector = NULL;
851 if (isalnum (*s2) || (*s2 ==
'_') || (*s2 ==
':'))
853 else if (isspace (*s2))
855 else if ((*s2 ==
'\0') || (*s2 ==
'\''))
887 char *ncategory = NULL;
888 char *nselector = NULL;
905 if ((s1[0] ==
'+') || (s1[0] ==
'-'))
915 while (isalnum (*s1) || (*s1 ==
'_'))
926 while (isalnum (*s2) || (*s2 ==
'_'))
939 if (isalnum (*s2) || (*s2 ==
'_') || (*s2 ==
':'))
941 else if (isspace (*s2))
963 if (theclass != NULL)
965 if (category != NULL)
966 *category = ncategory;
980 const char *symname = NULL;
984 char *ncategory = NULL;
985 char *nselector = NULL;
987 static char *tmp = NULL;
988 static unsigned int tmplen = 0;
994 unsigned int *objc_csym;
1002 unsigned int objfile_csym = 0;
1005 if (objc_csym != NULL && *objc_csym == 0)
1016 if (symname == NULL)
1019 if ((symname[0] !=
'-' && symname[0] !=
'+') || (symname[1] !=
'['))
1026 while ((strlen (symname) + 1) >= tmplen)
1028 tmplen = (tmplen == 0) ? 1024 : tmplen * 2;
1029 tmp = (
char *)
xrealloc (tmp, tmplen);
1031 strcpy (tmp, symname);
1034 &ncategory, &nselector) == NULL)
1037 if ((
type !=
'\0') && (ntype !=
type))
1040 if ((theclass != NULL)
1041 && ((nclass == NULL) || (strcmp (theclass, nclass) != 0)))
1044 if ((category != NULL) &&
1045 ((ncategory == NULL) || (strcmp (category, ncategory) != 0)))
1049 ((nselector == NULL) || (strcmp (
selector, nselector) != 0)))
1055 if (objc_csym == NULL)
1058 *objc_csym = objfile_csym;
1073 const char *elem, *last = NULL;
1088 if (last == NULL || strcmp (last, elem) != 0)
1133 char *theclass = NULL;
1134 char *category = NULL;
1140 int selector_case = 0;
1144 buf = (
char *) alloca (strlen (method) + 1);
1145 strcpy (buf, method);
1150 strcpy (buf, method);
1184 return method + (tmp - buf);
1190 struct value *object, *
function, *description;
1195 if (!args || !*args)
1197 "The 'print-object' command requires an argument (an Objective-C object)");
1212 if (
function == NULL)
1213 error (
_(
"Unable to locate _NSPrintForDebugger in child process"));
1218 if (string_addr == 0)
1219 error (
_(
"object returns null description"));
1259 {
"_objc_getClass", NULL, 0, 0},
1260 {
"_objc_getMetaClass", NULL, 0, 0}
1263 #define nmethcalls (sizeof (methcalls) / sizeof (methcalls[0])) 1287 if (
func.minsym == NULL)
1321 if (f (pc, new_pc) == 0)
1327 "Unable to determine target of " 1328 "Objective-C method call (ignoring):\n");
1363 _(
"All Objective-C selectors, or those matching REGEXP."));
1365 _(
"All Objective-C classes, or those matching REGEXP."));
1367 _(
"Ask an Objective-C object to print itself."));
1382 static unsigned long 1443 while (subclass != 0)
1447 unsigned mlistnum = 0;
1454 unsigned long nmethods;
1465 for (i = 0; i < nmethods; i++)
1471 if (meth_str.
name == sel)
1474 return meth_str.
imp;
static void read_objc_method(struct gdbarch *gdbarch, CORE_ADDR addr, struct objc_method *method)
static void info_classes_command(const char *regexp, int from_tty)
int end_msglist(struct parser_state *ps)
struct type * builtin_func_ptr
#define VEC_replace(T, V, I, O)
#define SYMBOL_PRINT_NAME(symbol)
struct frame_info * get_current_frame(void)
#define parse_gdbarch(ps)
static void read_objc_object(struct gdbarch *gdbarch, CORE_ADDR addr, struct objc_object *object)
unsigned int default_search_name_hash(const char *string0)
gdb::unique_xmalloc_ptr< expression > expression_up
static CORE_ADDR find_implementation_from_class(struct gdbarch *gdbarch, CORE_ADDR theclass, CORE_ADDR sel)
static int specialcmp(const char *a, const char *b)
static void uniquify_strings(VEC(const_char_ptr) **strings)
LONGEST value_as_long(struct value *val)
#define BMSYMBOL_VALUE_ADDRESS(symbol)
const char * default_word_break_characters(void)
static char * parse_selector(char *method, char **selector)
struct value * value_coerce_array(struct value *arg1)
CORE_ADDR minimal_symbol_upper_bound(struct bound_minimal_symbol minsym)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct cmd_list_element * add_info(const char *name, cmd_const_cfunc_ftype *fun, const char *doc)
static void read_objc_super(struct gdbarch *gdbarch, CORE_ADDR addr, struct objc_super *super)
void c_language_arch_info(struct gdbarch *gdbarch, struct language_arch_info *lai)
struct value * default_read_var_value(struct symbol *var, const struct block *var_block, struct frame_info *frame)
static char * msglist_sel
static void print_object_command(const char *args, int from_tty)
#define VEC_safe_push(T, V, O)
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
void _initialize_objc_lang(void)
char * skip_spaces(char *chp)
CORE_ADDR lookup_objc_class(struct gdbarch *gdbarch, const char *classname)
static unsigned long read_objc_methlist_nmethods(struct gdbarch *gdbarch, CORE_ADDR addr)
CORE_ADDR gdbarch_fetch_pointer_argument(struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type)
void printf_filtered(const char *format,...)
void deprecated_set_value_type(struct value *value, struct type *type)
static int resolve_msgsend_super_stret(CORE_ADDR pc, CORE_ADDR *new_pc)
void write_exp_elt_longcst(struct parser_state *ps, LONGEST expelt)
static struct objc_methcall methcalls[]
void _initialize_objc_language(void)
#define VEC_iterate(T, V, I, P)
#define CATCH(EXCEPTION, MASK)
struct block_symbol basic_lookup_symbol_nonlocal(const struct language_defn *langdef, const char *name, const struct block *block, const domain_enum domain)
static void read_objc_methlist_method(struct gdbarch *gdbarch, CORE_ADDR addr, unsigned long num, struct objc_method *method)
objfile(bfd *, const char *, objfile_flags)
void c_emit_char(int c, struct type *type, struct ui_file *stream, int quoter)
const char * const_char_ptr
static int resolve_msgsend_stret(CORE_ADDR pc, CORE_ADDR *new_pc)
struct value * find_function_in_inferior(const char *name, struct objfile **objf_p)
void puts_filtered_tabular(char *string, int width, int right)
struct cmd_list_element * add_com_alias(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag)
void c_yyerror(const char *)
int default_pass_by_reference(struct type *type)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct type * basic_lookup_transparent_type(const char *name)
void add_msglist(struct stoken *str, int addcolon)
static const char * objc_extensions[]
static int compare_selectors(const void *a, const void *b)
static int find_objc_msgcall_submethod(int(*f)(CORE_ADDR, CORE_ADDR *), CORE_ADDR pc, CORE_ADDR *new_pc)
#define MSYMBOL_NATURAL_NAME(symbol)
void null_post_parser(expression_up *exp, int void_context_p)
struct value * value_from_longest(struct type *type, LONGEST num)
void exception_fprintf(struct ui_file *file, struct gdb_exception e, const char *prefix,...)
#define complaint(COMPLAINTS, FMT,...)
struct type * builtin_long
#define target_has_execution
void default_print_array_index(struct value *index_value, struct ui_file *stream, const struct value_print_options *options)
static CORE_ADDR find_implementation(struct gdbarch *gdbarch, CORE_ADDR object, CORE_ADDR sel)
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
const char * find_imps(const char *method, VEC(const_char_ptr) **symbol_names)
void c_val_print(struct type *, int, CORE_ADDR, struct ui_file *, int, struct value *, const struct value_print_options *)
void c_print_typedef(struct type *, struct symbol *, struct ui_file *)
static struct selname * selname_chain
static int compare_classes(const void *a, const void *b)
int c_parse(struct parser_state *par_state)
static int resolve_msgsend_super(CORE_ADDR pc, CORE_ADDR *new_pc)
static char * parse_method(char *method, char *type, char **theclass, char **category, char **selector)
void c_printstr(struct ui_file *stream, struct type *type, const gdb_byte *string, unsigned int length, const char *user_encoding, int force_ellipses, const struct value_print_options *options)
PTR xrealloc(PTR ptr, size_t size)
void default_collect_symbol_completion_matches(completion_tracker &tracker, complete_symbol_mode mode, symbol_name_match_type name_match_type, const char *text, const char *word, enum type_code code)
#define VEC_truncate(T, V, I)
gdb::unique_xmalloc_ptr< char > c_watch_location_expression(struct type *type, CORE_ADDR addr)
struct type * builtin_char
#define ALL_MSYMBOLS(objfile, m)
const struct language_defn objc_language_defn
static void read_objc_class(struct gdbarch *gdbarch, CORE_ADDR addr, struct objc_class *theclass)
void default_get_string(struct value *value, gdb_byte **buffer, int *length, struct type **char_type, const char **charset)
#define TYPE_CODE(thistype)
#define default_varobj_ops
int find_objc_msgcall(CORE_ADDR pc, CORE_ADDR *new_pc)
struct type * builtin_data_ptr
struct complaints * symfile_complaints
struct minimal_symbol * minsym
void c_print_type(struct type *, const char *, struct ui_file *, int, int, const struct type_print_options *)
const struct exp_descriptor exp_descriptor_standard
struct bound_minimal_symbol lookup_bound_minimal_symbol(const char *name)
struct value * evaluate_subexp(struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
#define VEC_address(T, V)
static int objc_sniff_from_mangled_name(const char *mangled, char **demangled)
static int resolve_msgsend(CORE_ADDR pc, CORE_ADDR *new_pc)
int(* stop_at)(CORE_ADDR, CORE_ADDR *)
#define ALL_OBJFILE_MSYMBOLS(objfile, m)
struct value * value_string(const char *ptr, ssize_t len, struct type *char_type)
#define SYMBOL_NATURAL_NAME(symbol)
EXTERN_C char * re_comp(const char *)
struct value * call_function_by_hand(struct value *function, type *default_return_type, int nargs, struct value **args)
expression_up parse_expression(const char *)
void c_printchar(int c, struct type *type, struct ui_file *stream)
#define SYMBOL_TYPE(symbol)
CORE_ADDR gdbarch_skip_trampoline_code(struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR pc)
static void info_selectors_command(const char *regexp, int from_tty)
void iterate_over_symbols(const struct block *block, const lookup_name_info &name, const domain_enum domain, gdb::function_view< symbol_found_callback_ftype > callback)
static void find_objc_msgsend(void)
int compare_strings(const void *arg1, const void *arg2)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
static const struct objfile_data * objc_objfile_data
CORE_ADDR lookup_child_selector(struct gdbarch *gdbarch, const char *selname)
#define ALL_OBJFILES(obj)
struct symbol * lookup_struct_typedef(const char *name, const struct block *block, int noerr)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
static CORE_ADDR objc_skip_trampoline(struct frame_info *frame, CORE_ADDR stop_pc)
void c_value_print(struct value *, struct ui_file *, const struct value_print_options *)
static void find_methods(char type, const char *theclass, const char *category, const char *selector, VEC(const_char_ptr) **symbol_names)
void error(const char *fmt,...)
struct value * value_nsstring(struct gdbarch *gdbarch, char *ptr, int len)
struct type * lookup_pointer_type(struct type *type)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
static const struct op_print objc_op_print_tab[]
char * objc_demangle(const char *mangled, int options)