From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15991 invoked by alias); 21 Jun 2013 11:18:14 -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 15892 invoked by uid 89); 21 Jun 2013 11:18:13 -0000 X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_CP autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 21 Jun 2013 11:18:12 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5LBI6RY026619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Jun 2013 07:18:06 -0400 Received: from host2.jankratochvil.net (ovpn-116-40.ams2.redhat.com [10.36.116.40]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5LBI1J9006931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 21 Jun 2013 07:18:04 -0400 Date: Fri, 21 Jun 2013 11:42:00 -0000 From: Jan Kratochvil To: Mike Frysinger Cc: Pedro Alves , gdb-patches@sourceware.org, "Metzger, Markus T" Subject: Regression for btrace [Re: [PATCH v4] gdb: clean up x86 cpuid implementations] Message-ID: <20130621111800.GA4552@host2.jankratochvil.net> References: <201305061451.24861.vapier@gentoo.org> <1371662677-16527-1-git-send-email-vapier@gentoo.org> <51C1EC6E.4090402@redhat.com> <201306191829.07274.vapier@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201306191829.07274.vapier@gentoo.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-06/txt/msg00585.txt.bz2 On Thu, 20 Jun 2013 00:29:05 +0200, Mike Frysinger wrote: > On Wednesday 19 June 2013 13:37:50 Pedro Alves wrote: > > On 06/19/2013 06:24 PM, Mike Frysinger wrote: > > > * common/linux-btrace.c: Include i386-cpuid.h. > > > (intel_supports_btrace): Delete x86 ifdefs and replace inline asm with > > > call to i386_cpuid. > > > (cpu_supports_btrace): Likewise. [...] > pushed now Running gdb/testsuite/gdb.btrace/function_call_history.exp ... +PASS: gdb.btrace/function_call_history.exp: record btrace +PASS: gdb.btrace/function_call_history.exp: continue to breakpoint: cont to 43 +PASS: gdb.btrace/function_call_history.exp: set record function-call-history-size 0 +FAIL: gdb.btrace/function_call_history.exp: record function-call-history - with size unlimited [...] +FAIL: gdb.btrace/function_call_history.exp: show recursive function call history My Intel CPU is not btrace-capable but after the patch Intel vendor is no longer correctly identified. - "movl %%ebx, %0;" - "movl %%edx, %1;" - "movl %%ecx, %2;" - : "=m" (vendor[0]), - "=m" (vendor[4]), - "=m" (vendor[8]) - : - : "%eax", "%ebx", "%ecx", "%edx"); + if (!i386_cpuid (0, NULL, &ebx, &ecx, &edx)) + return 0; + + memcpy (&vendor[0], &ebx, 4); + memcpy (&vendor[4], &ecx, 4); + memcpy (&vendor[8], &edx, 4); Here ecx and edx are exchanged by the patch. OK to check in the fix this way? Jan gdb/ 2013-06-21 Jan Kratochvil * common/linux-btrace.c (cpu_supports_btrace): Remove variable vendor, replace strcmp with signature_INTEL_ebx, signature_INTEL_ecx and signature_INTEL_edx comparisons. diff --git a/gdb/common/linux-btrace.c b/gdb/common/linux-btrace.c index 0ec13bb..b874c84 100644 --- a/gdb/common/linux-btrace.c +++ b/gdb/common/linux-btrace.c @@ -382,17 +382,12 @@ static int cpu_supports_btrace (void) { unsigned int ebx, ecx, edx; - char vendor[13]; if (!i386_cpuid (0, NULL, &ebx, &ecx, &edx)) return 0; - memcpy (&vendor[0], &ebx, 4); - memcpy (&vendor[4], &ecx, 4); - memcpy (&vendor[8], &edx, 4); - vendor[12] = '\0'; - - if (strcmp (vendor, "GenuineIntel") == 0) + if (ebx == signature_INTEL_ebx && ecx == signature_INTEL_ecx + && edx == signature_INTEL_edx) return intel_supports_btrace (); /* Don't know about others. Let's assume they do. */