diff options
Diffstat (limited to 'gdb/objc-lang.c')
-rw-r--r-- | gdb/objc-lang.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 3655445..6bba8d3 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -1,6 +1,6 @@ /* Objective-C language support routines for GDB, the GNU debugger. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. Contributed by Apple Computer, Inc. Written by Michael Snyder. @@ -120,9 +120,11 @@ lookup_objc_class (struct gdbarch *gdbarch, const char *classname) return 0; } - if (lookup_minimal_symbol("objc_lookUpClass", 0, 0).minsym) + if (lookup_minimal_symbol (current_program_space, + "objc_lookUpClass").minsym != nullptr) function = find_function_in_inferior("objc_lookUpClass", NULL); - else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0).minsym) + else if (lookup_minimal_symbol (current_program_space, + "objc_lookup_class").minsym != nullptr) function = find_function_in_inferior("objc_lookup_class", NULL); else { @@ -149,9 +151,11 @@ lookup_child_selector (struct gdbarch *gdbarch, const char *selname) return 0; } - if (lookup_minimal_symbol("sel_getUid", 0, 0).minsym) + if (lookup_minimal_symbol (current_program_space, "sel_getUid").minsym + != nullptr) function = find_function_in_inferior("sel_getUid", NULL); - else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0).minsym) + else if (lookup_minimal_symbol (current_program_space, + "sel_get_any_uid").minsym != nullptr) function = find_function_in_inferior("sel_get_any_uid", NULL); else { @@ -180,17 +184,21 @@ value_nsstring (struct gdbarch *gdbarch, const char *ptr, int len) stringValue[2] = value_string(ptr, len, char_type); stringValue[2] = value_coerce_array(stringValue[2]); /* _NSNewStringFromCString replaces "istr" after Lantern2A. */ - if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0).minsym) + if (lookup_minimal_symbol (current_program_space, + "_NSNewStringFromCString").minsym != nullptr) { function = find_function_in_inferior("_NSNewStringFromCString", NULL); nsstringValue = call_function_by_hand(function, NULL, stringValue[2]); } - else if (lookup_minimal_symbol("istr", 0, 0).minsym) + else if (lookup_minimal_symbol (current_program_space, + "istr").minsym != nullptr) { function = find_function_in_inferior("istr", NULL); nsstringValue = call_function_by_hand(function, NULL, stringValue[2]); } - else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0).minsym) + else if (lookup_minimal_symbol (current_program_space, + "+[NSString stringWithCString:]").minsym + != nullptr) { function = find_function_in_inferior("+[NSString stringWithCString:]", NULL); @@ -544,7 +552,7 @@ compare_selectors (const void *a, const void *b) * * Implements the "Info selectors" command. Takes an optional regexp * arg. Lists all objective c selectors that match the regexp. Works - * by grepping thru all symbols for objective c methods. Output list + * by grepping through all symbols for objective c methods. Output list * is sorted and uniqued. */ @@ -593,7 +601,7 @@ info_selectors_command (const char *regexp, int from_tty) error (_("Invalid regexp (%s): %s"), val, regexp); } - /* First time thru is JUST to get max length and count. */ + /* First time through is JUST to get max length and count. */ for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile->msymbols ()) @@ -708,7 +716,7 @@ compare_classes (const void *a, const void *b) * * Implements the "info classes" command for objective c classes. * Lists all objective c classes that match the optional regexp. - * Works by grepping thru the list of objective c methods. List will + * Works by grepping through the list of objective c methods. List will * be sorted and uniqued (since one class may have many methods). * BUGS: will not list a class that has no methods. */ @@ -747,7 +755,7 @@ info_classes_command (const char *regexp, int from_tty) error (_("Invalid regexp (%s): %s"), val, regexp); } - /* First time thru is JUST to get max length and count. */ + /* First time through is JUST to get max length and count. */ for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile->msymbols ()) @@ -1137,8 +1145,8 @@ find_imps (const char *method, std::vector<const char *> *symbol_names) symbol_names->push_back (sym->natural_name ()); else { - struct bound_minimal_symbol msym - = lookup_minimal_symbol (selector, 0, 0); + bound_minimal_symbol msym + = lookup_minimal_symbol (current_program_space, selector); if (msym.minsym != NULL) symbol_names->push_back (msym.minsym->natural_name ()); @@ -1195,7 +1203,7 @@ print_object_command (const char *args, int from_tty) gdb_printf ("\n"); } -/* The data structure 'methcalls' is used to detect method calls (thru +/* The data structure 'methcalls' is used to detect method calls (through * ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.), * and ultimately find the method being called. */ @@ -1240,13 +1248,13 @@ find_objc_msgsend (void) for (i = 0; i < nmethcalls; i++) { - struct bound_minimal_symbol func; - /* Try both with and without underscore. */ - func = lookup_bound_minimal_symbol (methcalls[i].name); + bound_minimal_symbol func + = lookup_minimal_symbol (current_program_space, methcalls[i].name); if ((func.minsym == NULL) && (methcalls[i].name[0] == '_')) { - func = lookup_bound_minimal_symbol (methcalls[i].name + 1); + func = lookup_minimal_symbol (current_program_space, + methcalls[i].name + 1); } if (func.minsym == NULL) { @@ -1319,9 +1327,7 @@ find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc) return 0; } -void _initialize_objc_language (); -void -_initialize_objc_language () +INIT_GDB_FILE (objc_language) { add_info ("selectors", info_selectors_command, _("All Objective-C selectors, or those matching REGEXP.")); |