From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1655 invoked by alias); 19 May 2014 06:13:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 1633 invoked by uid 89); 19 May 2014 06:13:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 May 2014 06:13:01 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WmGok-0003i2-1A from Yao_Qi@mentor.com ; Sun, 18 May 2014 23:12:58 -0700 Received: from SVR-ORW-FEM-06.mgc.mentorg.com ([147.34.97.120]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 18 May 2014 23:12:57 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.2.247.3; Sun, 18 May 2014 23:12:56 -0700 Message-ID: <5379A051.9040209@codesourcery.com> Date: Mon, 19 May 2014 06:13:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Tom Tromey , CC: Jan Kratochvil Subject: Re: [PATCH 07/14] add infcall_mmap and gcc_target_options gdbarch methods References: <1400253995-12333-1-git-send-email-tromey@redhat.com> <1400253995-12333-8-git-send-email-tromey@redhat.com> In-Reply-To: <1400253995-12333-8-git-send-email-tromey@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00325.txt.bz2 On 05/16/2014 11:26 PM, Tom Tromey wrote: > The compiler needed two new gdbarch methods. > > The infcall_mmap method allocates memory in the inferior. > This is used when inserting the object code. IMO, "infcall_mmap" is confusing.... > diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh > index 9f357b6..6b2bc12 100755 > --- a/gdb/gdbarch.sh > +++ b/gdb/gdbarch.sh > @@ -1029,6 +1029,18 @@ m:int:insn_is_jump:CORE_ADDR addr:addr::default_insn_is_jump::0 > # Return -1 if there is insufficient buffer for a whole entry. > # Return 1 if an entry was read into *TYPEP and *VALP. > M:int:auxv_parse:gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp:readptr, endptr, typep, valp > + > +# 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". > +# 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. -- Yao (齐尧)