From patchwork Thu Feb 19 17:48:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 5176 Received: (qmail 22979 invoked by alias); 19 Feb 2015 17:48:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 22894 invoked by uid 89); 19 Feb 2015 17:48:45 -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_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Feb 2015 17:48:44 +0000 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 7255034873555; Thu, 19 Feb 2015 17:48:38 +0000 (GMT) Received: from BAMAIL02.ba.imgtec.org (10.20.40.28) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 19 Feb 2015 17:48:41 +0000 Received: from [10.20.3.58] (10.20.3.58) by bamail02.ba.imgtec.org (10.20.40.28) with Microsoft SMTP Server (TLS) id 14.3.174.1; Thu, 19 Feb 2015 09:48:39 -0800 Message-ID: <1424368119.27855.123.camel@ubuntu-sellcey> Subject: Re: Build failure with probe patch From: Steve Ellcey Reply-To: To: "Jose E. Marchesi" CC: Pedro Alves , Sergio Durigan Junior , Date: Thu, 19 Feb 2015 09:48:39 -0800 In-Reply-To: <87vbix3iqm.fsf@oracle.com> References: <87wq3ercw0.fsf@redhat.com> <1424306916.27855.115.camel@ubuntu-sellcey> <87r3tl7uwz.fsf@oracle.com> <54E6150B.9060808@redhat.com> <87vbix3iqm.fsf@oracle.com> MIME-Version: 1.0 On Thu, 2015-02-19 at 18:37 +0100, Jose E. Marchesi wrote: > I see, void is not allowed to alias a char... we are doomed! :D > > Oh well, I guess we will have to use an union to avoid any possible > strict-aliasing warning... Can we assume C99 in GDB? Even with this issue fixed I ran into one other compiler problem. I get this error from GCC 4.1.2: cc1: warnings being treated as errors /scratch/sellcey/gdb-bug/src/gdb/gdb/dtrace-probe.c: In function 'dtrace_get_probes': /scratch/sellcey/gdb-bug/src/gdb/gdb/dtrace-probe.c:64: warning: 'arg.expr' is used uninitialized in this function To fix this problem I changed dtrace_process_dof_probe to have 'arg.expr = NULL' in the loop that stores argument descriptions. Here is a complete patch that compiled for me using the old GCC. Steve Ellcey sellcey@imgtec.com diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c index a6544ba..fd6ae6e 100644 --- a/gdb/dtrace-probe.c +++ b/gdb/dtrace-probe.c @@ -415,6 +415,7 @@ dtrace_process_dof_probe (struct objfile *objfile, struct dtrace_probe_arg arg; struct expression *expr; + arg.expr = NULL; arg.type_str = xstrdup (p); /* Use strtab_size as a sentinel. */ @@ -617,17 +618,17 @@ dtrace_get_probes (VEC (probe_p) **probesp, struct objfile *objfile) { if (elf_section_data (sect)->this_hdr.sh_type == SHT_SUNW_dof) { - struct dtrace_dof_hdr *dof; + bfd_byte *dof; /* Read the contents of the DOF section and then process it to extract the information of any probe defined into it. */ - if (!bfd_malloc_and_get_section (abfd, sect, (bfd_byte **) &dof)) + if (!bfd_malloc_and_get_section (abfd, sect, &dof)) complaint (&symfile_complaints, _("could not obtain the contents of" "section '%s' in objfile `%s'."), sect->name, abfd->filename); - dtrace_process_dof (sect, objfile, probesp, dof); + dtrace_process_dof (sect, objfile, probesp, (struct dtrace_dof_hdr *) dof); xfree (dof); } }