Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: Pedro Alves <palves@redhat.com>,
	gdb-patches@sourceware.org,        "Metzger,
	Markus T" <markus.t.metzger@intel.com>
Subject: Regression for btrace  [Re: [PATCH v4] gdb: clean up x86 cpuid implementations]
Date: Fri, 21 Jun 2013 11:42:00 -0000	[thread overview]
Message-ID: <20130621111800.GA4552@host2.jankratochvil.net> (raw)
In-Reply-To: <201306191829.07274.vapier@gentoo.org>

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  <jan.kratochvil@redhat.com>

	* 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.  */


  reply	other threads:[~2013-06-21 11:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-06 18:51 [patch/rfc] gdb: clean up x86 cpuid implementations Mike Frysinger
2013-05-06 19:44 ` Eli Zaretskii
2013-05-06 20:30   ` Mike Frysinger
2013-05-07  2:41     ` Eli Zaretskii
2013-05-07  4:26       ` Doug Evans
2013-05-07 15:56         ` Eli Zaretskii
2013-05-07 13:29 ` [PATCH v2] " Mike Frysinger
2013-05-07 14:08   ` Pedro Alves
2013-05-07 14:19     ` Pedro Alves
2013-05-07 14:31       ` Mike Frysinger
2013-05-07 14:49         ` Pedro Alves
2013-05-07 15:05           ` Mike Frysinger
2013-05-07 15:21             ` Pedro Alves
2013-05-07 15:11 ` [PATCH v3] " Mike Frysinger
2013-06-17  6:16   ` Mike Frysinger
2013-06-17 17:52     ` Pedro Alves
2013-06-18 17:53       ` Mike Frysinger
2013-06-18 18:32         ` Pedro Alves
2013-06-18 23:37           ` Joel Brobecker
2013-06-19  3:12           ` Mike Frysinger
2013-06-19 12:11             ` Pedro Alves
2013-06-19 15:06               ` Mike Frysinger
2013-06-19 15:16                 ` Pedro Alves
2013-06-19 15:50                   ` Mike Frysinger
2013-06-19 16:59                     ` Pedro Alves
2013-06-19 17:35 ` [PATCH v4] " Mike Frysinger
2013-06-19 17:42   ` Pedro Alves
2013-06-19 22:45     ` Mike Frysinger
2013-06-21 11:42       ` Jan Kratochvil [this message]
2013-06-21 15:36         ` Regression for btrace [Re: [PATCH v4] gdb: clean up x86 cpuid implementations] Mike Frysinger
2013-06-21 15:41           ` Pedro Alves
2013-06-21 15:51             ` [commit] " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130621111800.GA4552@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    --cc=palves@redhat.com \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox