This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] [6/8] Remove macro NAME_OF_MALLOC
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: deuling at de dot ibm dot com (Markus Deuling)
- Cc: gdb-patches at sourceware dot org (GDB Patches)
- Date: Sat, 9 Jun 2007 16:26:49 +0200 (CEST)
- Subject: Re: [rfc] [6/8] Remove macro NAME_OF_MALLOC
Markus Deuling wrote:
> * gdbarch.sh (NAME_OF_MALLOC): Replace by gdbarch_name_of_malloc.
> * valops.c (value_allocate_space_in_inferior): Likewise.
> * gdbarch.c, gdbarch.h: Regenerate.
You also have to update the "print" column in gdbarch.sh, or else
re-generating gdbarch.c will re-introduce NAME_OF_MALLOC.
I've committed the version appended below.
Bye,
Ulrich
Index: gdb/gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.367
diff -c -p -r1.367 gdbarch.c
*** gdb/gdbarch.c 9 Jun 2007 14:02:39 -0000 1.367
--- gdb/gdbarch.c 9 Jun 2007 14:11:23 -0000
*************** gdbarch_dump (struct gdbarch *current_gd
*** 1035,1048 ****
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);
fprintf_unfiltered (file,
"gdbarch_dump: num_pseudo_regs = %s\n",
paddr_d (current_gdbarch->num_pseudo_regs));
--- 1035,1043 ----
fprintf_unfiltered (file,
"gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n",
(long) current_gdbarch->memory_remove_breakpoint);
fprintf_unfiltered (file,
"gdbarch_dump: name_of_malloc = %s\n",
! current_gdbarch->name_of_malloc);
fprintf_unfiltered (file,
"gdbarch_dump: num_pseudo_regs = %s\n",
paddr_d (current_gdbarch->num_pseudo_regs));
Index: gdb/gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.323
diff -c -p -r1.323 gdbarch.h
*** gdb/gdbarch.h 9 Jun 2007 14:02:39 -0000 1.323
--- gdb/gdbarch.h 9 Jun 2007 14:11:24 -0000
*************** extern void set_gdbarch_coff_make_msymbo
*** 993,1004 ****
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);
--- 993,998 ----
Index: gdb/gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.405
diff -c -p -r1.405 gdbarch.sh
*** gdb/gdbarch.sh 9 Jun 2007 14:02:39 -0000 1.405
--- gdb/gdbarch.sh 9 Jun 2007 14:11:24 -0000
*************** m::int:in_function_epilogue_p:CORE_ADDR
*** 652,658 ****
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::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
--- 652,658 ----
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:current_gdbarch->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
Index: gdb/valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.172
diff -c -p -r1.172 valops.c
*** gdb/valops.c 6 Jun 2007 15:23:06 -0000 1.172
--- gdb/valops.c 9 Jun 2007 14:11:24 -0000
*************** struct value *
*** 182,188 ****
value_allocate_space_in_inferior (int len)
{
struct value *blocklen;
! struct value *val = find_function_in_inferior (NAME_OF_MALLOC);
blocklen = value_from_longest (builtin_type_int, (LONGEST) len);
val = call_function_by_hand (val, 1, &blocklen);
--- 182,189 ----
value_allocate_space_in_inferior (int len)
{
struct value *blocklen;
! 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);
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com