/* Objective-C language support routines for GDB, the GNU debugger.
- Copyright (C) 2002-2017 Free Software Foundation, Inc.
+ Copyright (C) 2002-2018 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
Written by Michael Snyder.
classval = value_string (classname, strlen (classname) + 1, char_type);
classval = value_coerce_array (classval);
- return (CORE_ADDR) value_as_long (call_function_by_hand (function,
+ return (CORE_ADDR) value_as_long (call_function_by_hand (function,
+ NULL,
1, &classval));
}
selstring = value_coerce_array (value_string (selname,
strlen (selname) + 1,
char_type));
- return value_as_long (call_function_by_hand (function, 1, &selstring));
+ return value_as_long (call_function_by_hand (function, NULL, 1, &selstring));
}
struct value *
if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0).minsym)
{
function = find_function_in_inferior("_NSNewStringFromCString", NULL);
- nsstringValue = call_function_by_hand(function, 1, &stringValue[2]);
+ nsstringValue = call_function_by_hand(function,
+ NULL, 1, &stringValue[2]);
}
else if (lookup_minimal_symbol("istr", 0, 0).minsym)
{
function = find_function_in_inferior("istr", NULL);
- nsstringValue = call_function_by_hand(function, 1, &stringValue[2]);
+ nsstringValue = call_function_by_hand(function, NULL, 1, &stringValue[2]);
}
else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0).minsym)
{
(type, lookup_objc_class (gdbarch, "NSString"));
stringValue[1] = value_from_longest
(type, lookup_child_selector (gdbarch, "stringWithCString:"));
- nsstringValue = call_function_by_hand(function, 3, &stringValue[0]);
+ nsstringValue = call_function_by_hand(function, NULL, 3, &stringValue[0]);
}
else
error (_("NSString: internal error -- no way to create new NSString"));
".m", NULL
};
-const struct language_defn objc_language_defn = {
+extern const struct language_defn objc_language_defn = {
"objective-c", /* Language name */
"Objective-C",
language_objc,
default_pass_by_reference,
default_get_string,
c_watch_location_expression,
- NULL, /* la_get_symbol_name_cmp */
+ NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols,
+ default_search_name_hash,
&default_varobj_ops,
NULL,
NULL,
*/
static void
-selectors_info (char *regexp, int from_tty)
+info_selectors_command (const char *regexp, int from_tty)
{
struct objfile *objfile;
struct minimal_symbol *msymbol;
*/
static void
-classes_info (char *regexp, int from_tty)
+info_classes_command (const char *regexp, int from_tty)
{
struct objfile *objfile;
struct minimal_symbol *msymbol;
}
static void
-print_object_command (char *args, int from_tty)
+print_object_command (const char *args, int from_tty)
{
struct value *object, *function, *description;
CORE_ADDR string_addr, object_addr;
if (function == NULL)
error (_("Unable to locate _NSPrintForDebugger in child process"));
- description = call_function_by_hand (function, 1, &object);
+ description = call_function_by_hand (function, NULL, 1, &object);
string_addr = value_as_long (description);
if (string_addr == 0)
* dependent modules.
*/
-struct objc_submethod_helper_data {
- int (*f) (CORE_ADDR, CORE_ADDR *);
- CORE_ADDR pc;
- CORE_ADDR *new_pc;
-};
-
-static int
-find_objc_msgcall_submethod_helper (void * arg)
-{
- struct objc_submethod_helper_data *s =
- (struct objc_submethod_helper_data *) arg;
-
- if (s->f (s->pc, s->new_pc) == 0)
- return 1;
- else
- return 0;
-}
-
static int
find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *),
CORE_ADDR pc,
CORE_ADDR *new_pc)
{
- struct objc_submethod_helper_data s;
-
- s.f = f;
- s.pc = pc;
- s.new_pc = new_pc;
+ TRY
+ {
+ if (f (pc, new_pc) == 0)
+ return 1;
+ }
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception_fprintf (gdb_stderr, ex,
+ "Unable to determine target of "
+ "Objective-C method call (ignoring):\n");
+ }
+ END_CATCH
- if (catch_errors (find_objc_msgcall_submethod_helper,
- (void *) &s,
- "Unable to determine target of "
- "Objective-C method call (ignoring):\n",
- RETURN_MASK_ALL) == 0)
- return 1;
- else
- return 0;
+ return 0;
}
int
return 0;
}
-/* -Wmissing-prototypes */
-extern initialize_file_ftype _initialize_objc_language;
-
void
_initialize_objc_language (void)
{
- add_language (&objc_language_defn);
- add_info ("selectors", selectors_info, /* INFO SELECTORS command. */
+ add_info ("selectors", info_selectors_command,
_("All Objective-C selectors, or those matching REGEXP."));
- add_info ("classes", classes_info, /* INFO CLASSES command. */
+ add_info ("classes", info_classes_command,
_("All Objective-C classes, or those matching REGEXP."));
add_com ("print-object", class_vars, print_object_command,
_("Ask an Objective-C object to print itself."));
return 0;
}
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern initialize_file_ftype _initialize_objc_lang;
-
void
_initialize_objc_lang (void)
{