mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-24 20:49:43 +00:00
* 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.
This commit is contained in:
parent
3bada2a2df
commit
5720643ce8
@ -1,3 +1,12 @@
|
||||
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
|
||||
|
@ -267,6 +267,7 @@ struct gdbarch
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@ -423,6 +424,7 @@ struct gdbarch startup_gdbarch =
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"malloc",
|
||||
/* startup_gdbarch() */
|
||||
};
|
||||
|
||||
@ -553,6 +555,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
|
||||
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;
|
||||
@ -797,6 +800,7 @@ verify_gdbarch (struct gdbarch *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)
|
||||
@ -1485,6 +1489,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
(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",
|
||||
@ -4955,6 +4967,23 @@ set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch,
|
||||
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. */
|
||||
|
@ -2207,7 +2207,7 @@ extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_
|
||||
#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. */
|
||||
@ -2532,6 +2532,22 @@ extern void set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, gdba
|
||||
#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);
|
||||
|
||||
|
||||
|
@ -660,6 +660,7 @@ m::CONSTRUCT_INFERIOR_ARGUMENTS:char *:construct_inferior_arguments:int argc, ch
|
||||
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:const char *:name_of_malloc::::"malloc":"malloc"::0
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ struct value *
|
||||
value_allocate_space_in_inferior (int len)
|
||||
{
|
||||
struct value *blocklen;
|
||||
struct value *val = find_function_in_inferior ("malloc");
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user