diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2008-09-11 14:27:34 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2008-09-11 14:27:34 +0000 |
commit | 3e3b026fee8cd62ac6c2cfc7f86cec972d8f5676 (patch) | |
tree | bc601c999d48b731197ac2a508aafb6c06ad054c /gdb/objc-lang.c | |
parent | f8dcfc0affda04681b337c807c15d3c59badc33c (diff) | |
download | gdb-3e3b026fee8cd62ac6c2cfc7f86cec972d8f5676.zip gdb-3e3b026fee8cd62ac6c2cfc7f86cec972d8f5676.tar.gz gdb-3e3b026fee8cd62ac6c2cfc7f86cec972d8f5676.tar.bz2 |
* valops.c: Include "objfiles.h" and "symtab.h".
(find_function_in_inferior): New argument OBJF_P. Use it to return
objfile where function is defined. Use per-objfile arch types
instead of builtin_type_ to define default return type.
* linux-fork.c (checkpoint_command): Update calls. Use per-objfile
architecture to define inferior call argument types.
* gcore.c (derive_heap_segment): Likewise.
* objc-lang.c (value_nsstring): Likewise.
* scm-lang.c (scm_lookup_name): Likewise.
* scm-valprint.c (scm_inferior_print): Likewise.
* valops.c (value_allocate_space_in_inferior): Likewise.
* eval.c (evaluate_subexp_standard): Update calls.
* objc-lang.c (lookup_objc_class, print_object_command): Likewise.
* linux-fork.c: Include "objfiles.h".
* scm-lang.c: Include "objfiles.h".
* scm-valprint.c: Include "objfiles.h".
Diffstat (limited to 'gdb/objc-lang.c')
-rw-r--r-- | gdb/objc-lang.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 0ff2ebc..1692c3d 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -117,9 +117,9 @@ lookup_objc_class (char *classname) } if (lookup_minimal_symbol("objc_lookUpClass", 0, 0)) - function = find_function_in_inferior("objc_lookUpClass"); + function = find_function_in_inferior("objc_lookUpClass", NULL); else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0)) - function = find_function_in_inferior("objc_lookup_class"); + function = find_function_in_inferior("objc_lookup_class", NULL); else { complaint (&symfile_complaints, _("no way to lookup Objective-C classes")); @@ -144,9 +144,9 @@ lookup_child_selector (char *selname) } if (lookup_minimal_symbol("sel_getUid", 0, 0)) - function = find_function_in_inferior("sel_getUid"); + function = find_function_in_inferior("sel_getUid", NULL); else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0)) - function = find_function_in_inferior("sel_get_any_uid"); + function = find_function_in_inferior("sel_get_any_uid", NULL); else { complaint (&symfile_complaints, _("no way to lookup Objective-C selectors")); @@ -165,43 +165,50 @@ value_nsstring (char *ptr, int len) struct value *function, *nsstringValue; struct symbol *sym; struct type *type; + struct objfile *objf; + struct gdbarch *gdbarch; if (!target_has_execution) return 0; /* Can't call into inferior to create NSString. */ - sym = lookup_struct_typedef("NSString", 0, 1); - if (sym == NULL) - sym = lookup_struct_typedef("NXString", 0, 1); - if (sym == NULL) - type = builtin_type_void_data_ptr; - else - type = lookup_pointer_type(SYMBOL_TYPE (sym)); - stringValue[2] = value_string(ptr, len); stringValue[2] = value_coerce_array(stringValue[2]); /* _NSNewStringFromCString replaces "istr" after Lantern2A. */ if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0)) { - function = find_function_in_inferior("_NSNewStringFromCString"); + function = find_function_in_inferior("_NSNewStringFromCString", &objf); nsstringValue = call_function_by_hand(function, 1, &stringValue[2]); } else if (lookup_minimal_symbol("istr", 0, 0)) { - function = find_function_in_inferior("istr"); + function = find_function_in_inferior("istr", &objf); nsstringValue = call_function_by_hand(function, 1, &stringValue[2]); } else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0)) { - function = find_function_in_inferior("+[NSString stringWithCString:]"); + function + = find_function_in_inferior("+[NSString stringWithCString:]", &objf); + type = builtin_type (get_objfile_arch (objf))->builtin_long; + stringValue[0] = value_from_longest - (builtin_type_long, lookup_objc_class ("NSString")); + (type, lookup_objc_class ("NSString")); stringValue[1] = value_from_longest - (builtin_type_long, lookup_child_selector ("stringWithCString:")); + (type, lookup_child_selector ("stringWithCString:")); nsstringValue = call_function_by_hand(function, 3, &stringValue[0]); } else error (_("NSString: internal error -- no way to create new NSString")); + gdbarch = get_objfile_arch (objf); + + sym = lookup_struct_typedef("NSString", 0, 1); + if (sym == NULL) + sym = lookup_struct_typedef("NXString", 0, 1); + if (sym == NULL) + type = builtin_type (gdbarch)->builtin_data_ptr; + else + type = lookup_pointer_type(SYMBOL_TYPE (sym)); + deprecated_set_value_type (nsstringValue, type); return nsstringValue; } @@ -1386,7 +1393,7 @@ print_object_command (char *args, int from_tty) object_addr = value_as_long (object); read_memory (object_addr, &c, 1); - function = find_function_in_inferior ("_NSPrintForDebugger"); + function = find_function_in_inferior ("_NSPrintForDebugger", NULL); if (function == NULL) error (_("Unable to locate _NSPrintForDebugger in child process")); |