From f208eee0f3a4f42a0bf20ab900eb36fbba8e4b9e Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 14 May 2014 14:08:57 -0600 Subject: add infcall_mmap and gcc_target_options gdbarch methods The compiler needed two new gdbarch methods. The infcall_mmap method allocates memory in the inferior. This is used when inserting the object code. The gcc_target_options method computes some arch-specific gcc options to pass to the compiler. This is used to ensure that gcc generates object code for the correct architecture. gdb/ChangeLog 2014-12-12 Jan Kratochvil * arch-utils.c (default_infcall_mmap) (default_gcc_target_options): New functions. * arch-utils.h (GDB_MMAP_PROT_READ, GDB_MMAP_PROT_WRITE) (GDB_MMAP_PROT_EXEC): Define. (default_infcall_mmap, default_gcc_target_options): Declare. * gdbarch.h: Rebuild. * gdbarch.c: Rebuild. * gdbarch.sh (infcall_mmap, gcc_target_options): New methods. --- gdb/arch-utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gdb/arch-utils.c') diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 33d5543..3cd0a21 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -858,6 +858,22 @@ default_skip_permanent_breakpoint (struct regcache *regcache) regcache_write_pc (regcache, current_pc); } +CORE_ADDR +default_infcall_mmap (CORE_ADDR size, unsigned prot) +{ + error (_("This target does not support inferior memory allocation by mmap.")); +} + +/* -mcmodel=large is used so that no GOT (Global Offset Table) is needed to be + created in inferior memory by GDB (normally it is set by ld.so). */ + +char * +default_gcc_target_options (struct gdbarch *gdbarch) +{ + return xstrprintf ("-m%d%s", gdbarch_ptr_bit (gdbarch), + gdbarch_ptr_bit (gdbarch) == 64 ? " -mcmodel=large" : ""); +} + /* -Wmissing-prototypes */ extern initialize_file_ftype _initialize_gdbarch_utils; -- cgit v1.1