public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb, btrace: fix family and model computation
@ 2022-10-21 12:13 Markus Metzger
  2022-10-21 15:30 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Metzger @ 2022-10-21 12:13 UTC (permalink / raw)
  To: gdb-patches

In gdb/nat/linux-btrace.c:btrace_this_cpu() we initialize the cpu
structure given to the libipt btrace decoder.

We only consider the extended model field for family 0x6 and forget about
family 0xf and we don't consider the extended family field.  Fix it.
---
 gdb/nat/linux-btrace.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 4911630ba5c..a951f3b56aa 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -84,9 +84,11 @@ btrace_this_cpu (void)
 	      cpu.vendor = CV_INTEL;
 
 	      cpu.family = (cpuid >> 8) & 0xf;
-	      cpu.model = (cpuid >> 4) & 0xf;
+	      if (cpu.family == 0xf)
+		cpu.family += (cpuid >> 20) & 0xff;
 
-	      if (cpu.family == 0x6)
+	      cpu.model = (cpuid >> 4) & 0xf;
+	      if ((cpu.family == 0x6) || ((cpu.family & 0xf) == 0xf))
 		cpu.model += (cpuid >> 12) & 0xf0;
 	    }
 	}
-- 
2.37.3

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-28  6:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 12:13 [PATCH] gdb, btrace: fix family and model computation Markus Metzger
2022-10-21 15:30 ` Tom Tromey
2022-10-24  8:19   ` Metzger, Markus T
2022-10-25 16:55     ` Tom Tromey
2022-10-28  6:46       ` Metzger, Markus T

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).