This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [6/8] Remove macro NAME_OF_MALLOC
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Fri, 08 Jun 2007 11:11:42 +0200
- Subject: [rfc] [6/8] Remove macro NAME_OF_MALLOC
Hello,
this patch removes NAME_OF_MALLOC macro from gdbarch.sh
ChangeLog:
* gdbarch.sh (NAME_OF_MALLOC): Replace by gdbarch_name_of_malloc.
* valops.c (value_allocate_space_in_inferior): Likewise.
* gdbarch.c, gdbarch.h: Regenerate.
Is this ok to commit?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urN src/gdb/gdbarch.c src.orig/gdb/gdbarch.c
--- src/gdb/gdbarch.c 2007-06-08 05:38:50.000000000 +0200
+++ src.orig/gdb/gdbarch.c 2007-06-08 08:20:23.000000000 +0200
@@ -1082,14 +1082,9 @@
fprintf_unfiltered (file,
"gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n",
(long) current_gdbarch->memory_remove_breakpoint);
-#ifdef NAME_OF_MALLOC
- fprintf_unfiltered (file,
- "gdbarch_dump: NAME_OF_MALLOC # %s\n",
- XSTRING (NAME_OF_MALLOC));
-#endif
fprintf_unfiltered (file,
"gdbarch_dump: name_of_malloc = %s\n",
- NAME_OF_MALLOC);
+ gdbarch_name_of_malloc (current_gdbarch));
fprintf_unfiltered (file,
"gdbarch_dump: num_pseudo_regs = %s\n",
paddr_d (current_gdbarch->num_pseudo_regs));
diff -urN src/gdb/gdbarch.h src.orig/gdb/gdbarch.h
--- src/gdb/gdbarch.h 2007-06-08 05:38:50.000000000 +0200
+++ src.orig/gdb/gdbarch.h 2007-06-08 08:18:45.000000000 +0200
@@ -1042,12 +1042,6 @@
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 !defined (GDB_TM_FILE) && defined (NAME_OF_MALLOC)
-#error "Non multi-arch definition of NAME_OF_MALLOC"
-#endif
-#if !defined (NAME_OF_MALLOC)
-#define NAME_OF_MALLOC (gdbarch_name_of_malloc (current_gdbarch))
-#endif
extern int gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch);
extern void set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch, int cannot_step_breakpoint);
diff -urN src/gdb/gdbarch.sh src.orig/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh 2007-06-08 05:38:50.000000000 +0200
+++ src.orig/gdb/gdbarch.sh 2007-06-08 08:19:23.000000000 +0200
@@ -652,7 +652,7 @@
m::char *:construct_inferior_arguments:int argc, char **argv:argc, argv::construct_inferior_arguments::0
f::void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym::default_elf_make_msymbol_special::0
f::void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym::default_coff_make_msymbol_special::0
-v:=:const char *:name_of_malloc:::"malloc":"malloc"::0:NAME_OF_MALLOC
+v::const char *:name_of_malloc:::"malloc":"malloc"::0:NAME_OF_MALLOC
v::int:cannot_step_breakpoint:::0:0::0
v::int:have_nonsteppable_watchpoint:::0:0::0
F:=:int:address_class_type_flags:int byte_size, int dwarf2_addr_class:byte_size, dwarf2_addr_class
diff -urN src/gdb/valops.c src.orig/gdb/valops.c
--- src/gdb/valops.c 2007-06-08 05:38:51.000000000 +0200
+++ src.orig/gdb/valops.c 2007-06-08 08:22:17.000000000 +0200
@@ -182,7 +182,8 @@
value_allocate_space_in_inferior (int len)
{
struct value *blocklen;
- struct value *val = find_function_in_inferior (NAME_OF_MALLOC);
+ struct value *val = find_function_in_inferior
+ (gdbarch_name_of_malloc (current_gdbarch));
blocklen = value_from_longest (builtin_type_int, (LONGEST) len);
val = call_function_by_hand (val, 1, &blocklen);