+2002-09-12 Joel Brobecker <brobecker@gnat.com>
+
+ * gdbarch.sh (NAME_OF_MALLOC): New variable in the architecture
+ vector. Will be useful for Interix.
+ * gdbarch.h, gdbarch.c: Regenerate.
+
+ * valops.c (value_allocate_space_in_inferior): Replace hard-coded
+ name of the malloc function by NAME_OF_MALLOC.
+
2002-09-12 Joel Brobecker <brobecker@gnat.com>
* value.h (find_function_in_inferior): Add const keyword to
gdbarch_dwarf2_build_frame_info_ftype *dwarf2_build_frame_info;
gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special;
gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special;
+ const char * name_of_malloc;
};
0,
0,
0,
+ "malloc",
/* startup_gdbarch() */
};
current_gdbarch->construct_inferior_arguments = construct_inferior_arguments;
current_gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special;
current_gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special;
+ current_gdbarch->name_of_malloc = "malloc";
/* gdbarch_alloc() */
return current_gdbarch;
/* Skip verify of dwarf2_build_frame_info, has predicate */
/* Skip verify of elf_make_msymbol_special, invalid_p == 0 */
/* Skip verify of coff_make_msymbol_special, invalid_p == 0 */
+ /* Skip verify of name_of_malloc, invalid_p == 0 */
buf = ui_file_xstrdup (log, &dummy);
make_cleanup (xfree, buf);
if (strlen (buf) > 0)
(long) current_gdbarch->memory_remove_breakpoint
/*MEMORY_REMOVE_BREAKPOINT ()*/);
#endif
+#ifdef NAME_OF_MALLOC
+ fprintf_unfiltered (file,
+ "gdbarch_dump: NAME_OF_MALLOC # %s\n",
+ XSTRING (NAME_OF_MALLOC));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: NAME_OF_MALLOC = %ld\n",
+ (long) NAME_OF_MALLOC);
+#endif
#ifdef NPC_REGNUM
fprintf_unfiltered (file,
"gdbarch_dump: NPC_REGNUM # %s\n",
gdbarch->coff_make_msymbol_special = coff_make_msymbol_special;
}
+const char *
+gdbarch_name_of_malloc (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ /* Skip verify of name_of_malloc, invalid_p == 0 */
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_name_of_malloc called\n");
+ return gdbarch->name_of_malloc;
+}
+
+void
+set_gdbarch_name_of_malloc (struct gdbarch *gdbarch,
+ const char * name_of_malloc)
+{
+ gdbarch->name_of_malloc = name_of_malloc;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */
#endif
#endif
-/* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
+/* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
ADDR_BITS_REMOVE. */
/* Default (function) for non- multi-arch platforms. */
#endif
#endif
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (NAME_OF_MALLOC)
+#define NAME_OF_MALLOC ("malloc")
+#endif
+
+extern const char * gdbarch_name_of_malloc (struct gdbarch *gdbarch);
+extern void set_gdbarch_name_of_malloc (struct gdbarch *gdbarch, const char * name_of_malloc);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (NAME_OF_MALLOC)
+#error "Non multi-arch definition of NAME_OF_MALLOC"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (NAME_OF_MALLOC)
+#define NAME_OF_MALLOC (gdbarch_name_of_malloc (current_gdbarch))
+#endif
+#endif
+
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);