From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1805) id 6DAB43857837; Fri, 28 Oct 2022 06:47:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DAB43857837 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666939681; bh=gFs7opEQv7ZuOudFOvAgTVyAC7yu5Ye+JFBMc3CrJxA=; h=From:To:Subject:Date:From; b=JyuqAmtglYQZQ54SEOzdvHy6vsp1Vc8VgFJGIdLwNhiizZLXMlOHibzS5CojhsLGo 7C0yH8gQONp4QzkrNGfmsCYEtsMeIWxelpEVDETw3VELVBo3JQx3WCWNhf5Rvx1Vbo rL4ZQO0DwLdBF/ZYn9y7rRI4pQtg7dPhYYM3xYTU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Markus Metzger To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb, btrace: fix family and model computation X-Act-Checkin: binutils-gdb X-Git-Author: Markus Metzger X-Git-Refname: refs/heads/master X-Git-Oldrev: 56d4450bdfc873ff3c2d1ebb194c7a076d4d13f6 X-Git-Newrev: d9757bcd43534875d2003962944d3d130289f82c Message-Id: <20221028064801.6DAB43857837@sourceware.org> Date: Fri, 28 Oct 2022 06:47:54 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd9757bcd4353= 4875d2003962944d3d130289f82c commit d9757bcd43534875d2003962944d3d130289f82c Author: Markus Metzger Date: Thu Oct 20 16:27:34 2022 +0200 gdb, btrace: fix family and model computation =20 In gdb/nat/linux-btrace.c:btrace_this_cpu() we initialize the cpu structure given to the libipt btrace decoder. =20 We only consider the extended model field for family 0x6 and forget abo= ut family 0xf and we don't consider the extended family field. Fix it. Diff: --- 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 =3D CV_INTEL; =20 cpu.family =3D (cpuid >> 8) & 0xf; - cpu.model =3D (cpuid >> 4) & 0xf; + if (cpu.family =3D=3D 0xf) + cpu.family +=3D (cpuid >> 20) & 0xff; =20 - if (cpu.family =3D=3D 0x6) + cpu.model =3D (cpuid >> 4) & 0xf; + if ((cpu.family =3D=3D 0x6) || ((cpu.family & 0xf) =3D=3D 0xf)) cpu.model +=3D (cpuid >> 12) & 0xf0; } }