[RFC/RFA] new gdbarch method: NAME_OF_MALLOC
Andrew Cagney
ac131313@ges.redhat.com
Thu Sep 12 13:44:00 GMT 2002
> Following the disussion around the fact that the name of the function
> used to allocate some memory in the inferior is hard-coded to "malloc"
> (http://sources.redhat.com/ml/gdb-patches/2002-09/msg00079.html),
> here is a proposed addition to the architecture vector.
>
> Is it the right thing to do to handle the interix case where the
> malloc function should be "_malloc"? Is "NAME_OF_MALLOC" ok, or would
> we prefer a different name?
[No one appears to have come up with a better name :-)]
> Also, I did not find much documentation on each field for the line I
> added in gdbarch.sh. So I kind of reversed engineered it by reading
> the script code. So if you find anything I missed, this might explain
> it...
>
> 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.
>
> Ok to apply?
> Index: gdbarch.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> retrieving revision 1.159
> diff -c -3 -p -r1.159 gdbarch.sh
> *** gdbarch.sh 6 Sep 2002 20:17:40 -0000 1.159
> --- gdbarch.sh 12 Sep 2002 19:57:06 -0000
> *************** m::CONSTRUCT_INFERIOR_ARGUMENTS:char *:c
> *** 660,665 ****
> --- 660,666 ----
> F:2:DWARF2_BUILD_FRAME_INFO:void:dwarf2_build_frame_info:struct objfile *objfile:objfile:::0
> f:2:ELF_MAKE_MSYMBOL_SPECIAL:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym:::default_elf_make_msymbol_special::0
> f:2:COFF_MAKE_MSYMBOL_SPECIAL:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym:::default_coff_make_msymbol_special::0
> + v::NAME_OF_MALLOC:char *:name_of_malloc::::"malloc":"malloc"::0
Can ``const char *'' be used? I think you'll just need to tweak the
function signature for find_function_in_inferior(). If you need to
tweak more, yell! :-)
doc/gdbint.texinfo will need a separate patch.
Andrew
More information about the Gdb-patches
mailing list