gdb, btrace: fix family and model computation
authorMarkus Metzger <markus.t.metzger@intel.com>
Thu, 20 Oct 2022 14:27:34 +0000 (16:27 +0200)
committerMarkus Metzger <markus.t.metzger@intel.com>
Fri, 28 Oct 2022 05:42:53 +0000 (07:42 +0200)
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

index 4911630ba5ce8828e0443c210ea927b42c086968..a951f3b56aaa8502d75d2f13584790609f4f982f 100644 (file)
@@ -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;
            }
        }