From patchwork Mon Oct 16 14:04:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walfred Tedeschi X-Patchwork-Id: 23613 Received: (qmail 72814 invoked by alias); 16 Oct 2017 14:04:28 -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 72799 invoked by uid 89); 16 Oct 2017 14:04:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, MIME_BASE64_BLANKS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mga06.intel.com Received: from mga06.intel.com (HELO mga06.intel.com) (134.134.136.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Oct 2017 14:04:21 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 16 Oct 2017 07:04:19 -0700 X-ExtLoop1: 1 Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by orsmga002.jf.intel.com with ESMTP; 16 Oct 2017 07:04:17 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.248]) by IRSMSX151.ger.corp.intel.com ([169.254.4.108]) with mapi id 14.03.0319.002; Mon, 16 Oct 2017 15:04:16 +0100 From: "Tedeschi, Walfred" To: Pedro Alves , "gdb-patches@sourceware.org" Subject: RE: [pushed 8.0-branch] [Bug server/22137] gdbserver crashes on hosts with pkru register Date: Mon, 16 Oct 2017 14:04:16 +0000 Message-ID: References: <4e1810f2-a6cd-1c80-bdc6-6588e8759246@redhat.com> In-Reply-To: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action MIME-Version: 1.0 X-IsSubscribed: yes > -----Original Message----- > From: Pedro Alves [mailto:palves@redhat.com] > Sent: Monday, October 16, 2017 3:44 PM > To: Tedeschi, Walfred ; gdb- > patches@sourceware.org > Subject: Re: [pushed 8.0-branch] [Bug server/22137] gdbserver crashes on > hosts with pkru register > > On 10/16/2017 02:20 PM, Tedeschi, Walfred wrote: > > > >>> > > I also couldn't compile master: > >>> > > ../../../binutils-gdb/gdb/probe.c: In function \u2018void > >> > parse_probes_in_pspace(const probe_ops*, program_space*, const > >> > char*, const char*, const char*, > std::vector*)\u2019: > >>> > > ../../../binutils-gdb/gdb/probe.c:68:12: error: types may not be > >>> > > defined in a > >> > for-range-declaration [-Werror] > >>> > > for (struct probe *probe : probes) > >>> > > ^~~~~~ > >>> > > ../../../binutils-gdb/gdb/probe.c: In function > >>> > > \u2018VEC_probe_p* > >> > find_probes_in_objfile(objfile*, const char*, const char*)\u2019: > >>> > > ../../../binutils-gdb/gdb/probe.c:213:8: error: types may not be > >>> > > defined in a > >> > for-range-declaration [-Werror] > >>> > > for (struct probe *probe : probes) > >>> > > ^~~~~~ > >>> > > > >>> > > Are you aware of it? > >> > > >> > Yes, it's a GCC bug: > >> > https://sourceware.org/ml/gdb-patches/2017-09/msg00270.html > >> > > >> > What is your gcc version? > >> > > >> > I don't see this myself, but I know that Keith also ran into this > >> > recently. If it's easy to work around it, I don't see why not. > >> > > >> > Does this work for you? > >> > > > It worked! > > Thanks, I'll push in a bit. I'm still curious to know your gcc version though. Version is 6.3.1 > > Actually, I'm confused on how it worked for you, since I hadn't fixed the > same problem around line "213" quoted above. > Yes there were more, I fixed in the same way, full patch is here: > Are you sure you tested with the same compiler? > > Thanks, > Pedro Alves Thanks and regards, /Fred Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 diff --git a/gdb/elfread.c b/gdb/elfread.c index 436d9b5..8a12b56 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1340,8 +1340,8 @@ probe_key_free (bfd *abfd, void *d) { std::vector *probes = (std::vector *) d; - for (struct probe *probe : *probes) - probe->pops->destroy (probe); + for (probe *prob : *probes) + prob->pops->destroy (prob); delete probes; } diff --git a/gdb/probe.c b/gdb/probe.c index b3dbf89..487847c 100644 --- a/gdb/probe.c +++ b/gdb/probe.c @@ -65,23 +65,23 @@ parse_probes_in_pspace (const struct probe_ops *probe_ops, const std::vector &probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (struct probe *probe : probes) + for (probe *pro : probes) { - if (probe_ops != &probe_ops_any && probe->pops != probe_ops) + if (probe_ops != &probe_ops_any && pro->pops != probe_ops) continue; - if (provider && strcmp (probe->provider, provider) != 0) + if (provider && strcmp (pro->provider, provider) != 0) continue; - if (strcmp (probe->name, name) != 0) + if (strcmp (pro->name, name) != 0) continue; symtab_and_line sal; - sal.pc = get_probe_address (probe, objfile); + sal.pc = get_probe_address (pro, objfile); sal.explicit_pc = 1; sal.section = find_pc_overlay (sal.pc); sal.pspace = search_pspace; - sal.probe = probe; + sal.probe = pro; sal.objfile = objfile; result->push_back (std::move (sal)); @@ -210,15 +210,15 @@ find_probes_in_objfile (struct objfile *objfile, const char *provider, const std::vector &probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (struct probe *probe : probes) + for (probe *prob : probes) { - if (strcmp (probe->provider, provider) != 0) + if (strcmp (prob->provider, provider) != 0) continue; - if (strcmp (probe->name, name) != 0) + if (strcmp (prob->name, name) != 0) continue; - VEC_safe_push (probe_p, result, probe); + VEC_safe_push (probe_p, result, prob); } return result; @@ -244,11 +244,11 @@ find_probe_by_pc (CORE_ADDR pc) /* If this proves too inefficient, we can replace with a hash. */ const std::vector &probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (struct probe *probe : probes) - if (get_probe_address (probe, objfile) == pc) + for (probe *prob : probes) + if (get_probe_address (prob, objfile) == pc) { result.objfile = objfile; - result.probe = probe; + result.probe = prob; return result; } } @@ -294,20 +294,20 @@ collect_probes (const std::string &objname, const std::string &provider, const std::vector &probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (struct probe *probe : probes) + for (probe *prob : probes) { - if (pops != NULL && probe->pops != pops) + if (pops != NULL && prob->pops != pops) continue; if (prov_pat - && prov_pat->exec (probe->provider, 0, NULL, 0) != 0) + && prov_pat->exec (prob->provider, 0, NULL, 0) != 0) continue; if (probe_pat - && probe_pat->exec (probe->name, 0, NULL, 0) != 0) + && probe_pat->exec (prob->name, 0, NULL, 0) != 0) continue; - result.emplace_back (probe, objfile); + result.emplace_back (prob, objfile); } }