+2002-12-02 Adam Fedor <fedor@gnu.org>
+ Klee Dienes <kdienes@apple.com>
+
+ * objc-lang.c (objc_printstr): Add width arg to match
+ printstr prototype.
+ (compare_selectors): Add 'const' to arg types.
+ (compare_classes): Likewise.
+ (find_imps): Cast msym pointer to avoid compiler warning.
+ (print_object_command): Validate the address before
+ passing it to the print routine.
+ (find_objc_msgcall_submethod): Change function argument to
+ return an int.
+ * objc-lang.h: Add 'extern' to all function declarations.
+ (value_nsstring): Add declaration.
+
2002-12-02 J. Brobecker <brobecker@gnat.com>
* somsolib.c (dld_cache): Replace boolean by int for field is_valid.
static void
objc_printstr (struct ui_file *stream, char *string,
- unsigned int length, int force_ellipses)
+ unsigned int length, int width, int force_ellipses)
{
register unsigned int i;
unsigned int things_printed = 0;
}
/*
- * Function: compare_selectors (void *, void *)
+ * Function: compare_selectors (const void *, const void *)
*
* Comparison function for use with qsort. Arguments are symbols or
* msymbols Compares selector part of objc method name alphabetically.
*/
static int
-compare_selectors (void *a, void *b)
+compare_selectors (const void *a, const void *b)
{
char *aname, *bname;
}
/*
- * Function: compare_classes (void *, void *)
+ * Function: compare_classes (const void *, const void *)
*
* Comparison function for use with qsort. Arguments are symbols or
* msymbols Compares class part of objc method name alphabetically.
*/
static int
-compare_classes (void *a, void *b)
+compare_classes (const void *a, const void *b)
{
char *aname, *bname;
sym = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol));
if (sym != NULL)
{
- const char *newsymname = SYMBOL_DEMANGLED_NAME (sym);
+ const char *newsymname = SYMBOL_DEMANGLED_NAME (sym);
if (newsymname == NULL)
newsymname = SYMBOL_NAME (sym);
if (msym != NULL)
{
if (syms)
- syms[csym] = msym;
+ syms[csym] = (struct symbol *)msym;
csym++;
}
}
print_object_command (char *args, int from_tty)
{
struct value *object, *function, *description;
- CORE_ADDR string_addr;
+ CORE_ADDR string_addr, object_addr;
int i = 0;
char c = -1;
make_cleanup (free_current_contents, &expr);
int pc = 0;
-#if 1
object = expr->language_defn->evaluate_exp (builtin_type_void_data_ptr,
expr, &pc, EVAL_NORMAL);
-#else
- object = evaluate_subexp (builtin_type_void_data_ptr,
- expr, &pc, EVAL_NORMAL);
-#endif
do_cleanups (old_chain);
}
+ /* Validate the address for sanity. */
+ object_addr = value_as_long (object);
+ read_memory (object_addr, &c, 1);
+
function = find_function_in_inferior ("_NSPrintForDebugger");
- if (!function)
+ if (function == NULL)
error ("Unable to locate _NSPrintForDebugger in child process");
description = call_function_by_hand (function, 1, &object);
struct objc_methcall {
char *name;
/* Return instance method to be called. */
- CORE_ADDR (*stop_at) (CORE_ADDR);
+ int (*stop_at) (CORE_ADDR, CORE_ADDR *);
/* Start of pc range corresponding to method invocation. */
CORE_ADDR begin;
/* End of pc range corresponding to method invocation. */
*/
struct objc_submethod_helper_data {
- CORE_ADDR (*f) (CORE_ADDR, CORE_ADDR *);
+ int (*f) (CORE_ADDR, CORE_ADDR *);
CORE_ADDR pc;
CORE_ADDR *new_pc;
};
}
int
-find_objc_msgcall_submethod (CORE_ADDR (*f) (CORE_ADDR, CORE_ADDR *),
+find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *),
CORE_ADDR pc,
CORE_ADDR *new_pc)
{
add_info ("classes", classes_info, /* 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.\n");
+ "Ask an Objective-C object to print itself.");
add_com_alias ("po", "print-object", class_vars, 1);
}
extern CORE_ADDR lookup_objc_class (char *classname);
extern int lookup_child_selector (char *methodname);
-char *objc_demangle (const char *mangled);
+extern char *objc_demangle (const char *mangled);
-int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc);
+extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc);
-char *parse_selector (char *method, char **selector);
+extern char *parse_selector (char *method, char **selector);
-char *parse_method (char *method, char *type,
- char **class, char **category,
- char **selector);
+extern char *parse_method (char *method, char *type,
+ char **class, char **category,
+ char **selector);
-void find_methods (struct symtab *symtab, char type,
- const char *class, const char *category,
- const char *selector, struct symbol **syms,
- unsigned int *nsym, unsigned int *ndebug);
+extern void find_methods (struct symtab *symtab, char type,
+ const char *class, const char *category,
+ const char *selector, struct symbol **syms,
+ unsigned int *nsym, unsigned int *ndebug);
-char *find_imps (struct symtab *symtab, struct block *block,
- char *method, struct symbol **syms,
- unsigned int *nsym, unsigned int *ndebug);
+extern char *find_imps (struct symtab *symtab, struct block *block,
+ char *method, struct symbol **syms,
+ unsigned int *nsym, unsigned int *ndebug);
+
+extern struct value *value_nsstring (char *ptr, int len);