This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 07/14] add infcall_mmap and gcc_target_options gdbarch methods
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, gdb-patches at sourceware dot org
- Date: Mon, 19 May 2014 08:40:19 +0200
- Subject: Re: [PATCH 07/14] add infcall_mmap and gcc_target_options gdbarch methods
- Authentication-results: sourceware.org; auth=none
- References: <1400253995-12333-1-git-send-email-tromey at redhat dot com> <1400253995-12333-8-git-send-email-tromey at redhat dot com> <5379A051 dot 9040209 at codesourcery dot com>
On Mon, 19 May 2014 08:10:25 +0200, Yao Qi wrote:
> > +# Allocate SIZE bytes of PROT protected page aligned memory in inferior.
> > +# PROT has rwx bitmask format - bit 2 (value 4) is for readable memory, bit 1
> > +# (value 2) is for writable memory and bit 0 (value 1) is for executable memory.
> > +# Throw an error if it is not possible. Returned address is always valid.
> > +f:CORE_ADDR:infcall_mmap:CORE_ADDR size, unsigned prot:size, prot::default_infcall_mmap::0
> > +
>
> .... looks this hook is to allocate some target memory pages with
> certain required permissions. Probably, we can use "allocate_memory"
> or "mmap".
I am then for plain "mmap". "allocate_memory" suggests me more malloc().
> > +# Return string (caller has to use xfree for it) with options for GCC
> > +# to produce code for this target, typically "-m64", "-m32" or "-m31".
> > +# These options are put before CU's DW_AT_producer compilation options so that
> > +# they can override it. Method may also return NULL.
> > +m:char *:gcc_target_options:void:::default_gcc_target_options::0
> > EOF
> > }
>
> I doubt the interface like this is sufficient for other archs, like
> arm and mips, which have multiple multilibs, such as -marm/thumb,
> -mfloat-abi={hard,softfp}, etc. This hook in GDB has to take something
> into account, such as gdbarch, current frame, the related bfd, etc, in
> order to return a correct or compatible options for gcc to compile
> source.
It already already takes 'gdbarch' as its parameter. If it is not enough some
more parameters can be added. But IMO those should be added only when this
method gets implemented for arch which needs such parameter.
Thanks,
Jan