From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87131 invoked by alias); 29 Apr 2015 15:49:54 -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 87121 invoked by uid 89); 29 Apr 2015 15:49:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 29 Apr 2015 15:49:53 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 28012A10B5 for ; Wed, 29 Apr 2015 15:49:52 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3TFnoIH015863; Wed, 29 Apr 2015 11:49:51 -0400 Message-ID: <5540FD9E.1020005@redhat.com> Date: Wed, 29 Apr 2015 15:53:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Jan Kratochvil , gdb-patches@sourceware.org CC: Phil Muldoon Subject: Re: [PATCH v3 7/9] compile: New 'compile print' References: <20150411194322.29128.52477.stgit@host1.jankratochvil.net> <20150411194418.29128.3411.stgit@host1.jankratochvil.net> In-Reply-To: <20150411194418.29128.3411.stgit@host1.jankratochvil.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg01077.txt.bz2 On 04/11/2015 08:44 PM, Jan Kratochvil wrote: > + case COMPILE_I_PRINT_ADDRESS_SCOPE: > + case COMPILE_I_PRINT_VALUE_SCOPE: > + fputs_unfiltered ("#include \n" OOC, why do we need the include? > + "void " > + GCC_FE_WRAPPER_FUNCTION > + " (struct " > + COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG > + " *" > + COMPILE_I_SIMPLE_REGISTER_ARG_NAME > + ", " > + COMPILE_I_PRINT_OUT_ARG_TYPE > + " " > + COMPILE_I_PRINT_OUT_ARG > + ") {\n", > + buf); > + break; > + > case COMPILE_I_RAW_SCOPE: > break; > default: > @@ -354,6 +355,114 @@ copy_sections (bfd *abfd, asection *sect, void *data) > do_cleanups (cleanups); > } > > +/* Fetch the type of COMPILE_I_EXPR_PTR_TYPE and COMPILE_I_EXPR_VAL > + symbols in OBJFILE so we can calculate how much memory to allocate > + for the out parameter. This avoids needing a malloc in the generated > + code. Throw an error if anything fails. > + Set *OUT_VALUE_TAKE_ADDRESSP depending whether inferior code should > + copy COMPILE_I_EXPR_VAL or its address - this depends on __auto_type > + array-to-pointer type conversion of COMPILE_I_EXPR_VAL, as detected > + by COMPILE_I_EXPR_PTR_TYPE preserving the array type. */ This comment seems a bit stale. At least, I don't see an OUT_VALUE_TAKE_ADDRESSP parameter. > + > +static struct type * > +get_out_value_type (struct symbol *func_sym, struct objfile *objfile, > + enum compile_i_scope_types scope) > +{ > + struct symbol *gdb_ptr_type_sym, *gdb_val_sym; > + struct type *gdb_ptr_type, *gdb_type_from_ptr, *gdb_type, *retval; > + const struct block *block; > + const struct blockvector *bv; > + int nblocks = 0; > + int block_loop = 0; Otherwise this looks reasonable to me. Thanks, Pedro Alves