This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Regression for btrace [Re: [PATCH v4] gdb: clean up x86 cpuid implementations]


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]