From owner-dev-commits-src-all@freebsd.org Wed Dec 23 19:42:08 2020 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 563D54C99A4; Wed, 23 Dec 2020 19:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D1Nrc22MDz3t5b; Wed, 23 Dec 2020 19:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3907223AC1; Wed, 23 Dec 2020 19:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 0BNJg8gR098819; Wed, 23 Dec 2020 19:42:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 0BNJg82S098818; Wed, 23 Dec 2020 19:42:08 GMT (envelope-from git) Date: Wed, 23 Dec 2020 19:42:08 GMT Message-Id: <202012231942.0BNJg82S098818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 962c06c5a32d - gdb(4) fix x86 signal reporting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 962c06c5a32deb9357851d5aca060defc79e6e90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for all branches of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2020 19:42:08 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=962c06c5a32deb9357851d5aca060defc79e6e90 commit 962c06c5a32deb9357851d5aca060defc79e6e90 Author: Mitchell Horne AuthorDate: 2020-12-23 19:36:17 +0000 Commit: Mitchell Horne CommitDate: 2020-12-23 19:40:14 +0000 gdb(4) fix x86 signal reporting The existing values correspond to x86 exception vector numbers, but the trap numbers used in the kernel do not match these 1-to-1. Prefer the definitions from x86/trap.h, as they are what actually get passed to kdb_trap(). This is of little consequence, as gdb_cpu_signal() only reports the trap reason (signal number) to the gdb client. This is limited to the subset of trap values for which kdb_trap() is reachable. Reviewed by: kib Discussed with: jhb MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27645 --- sys/amd64/amd64/gdb_machdep.c | 27 ++++++++++++--------------- sys/i386/i386/gdb_machdep.c | 27 ++++++++++++--------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/gdb_machdep.c b/sys/amd64/amd64/gdb_machdep.c index eda1ab72168d..610096e1355d 100644 --- a/sys/amd64/amd64/gdb_machdep.c +++ b/sys/amd64/amd64/gdb_machdep.c @@ -136,21 +136,18 @@ gdb_cpu_signal(int type, int code) { switch (type & ~T_USER) { - case 0: return (SIGFPE); /* Divide by zero. */ - case 1: return (SIGTRAP); /* Debug exception. */ - case 3: return (SIGTRAP); /* Breakpoint. */ - case 4: return (SIGSEGV); /* into instr. (overflow). */ - case 5: return (SIGURG); /* bound instruction. */ - case 6: return (SIGILL); /* Invalid opcode. */ - case 7: return (SIGFPE); /* Coprocessor not present. */ - case 8: return (SIGEMT); /* Double fault. */ - case 9: return (SIGSEGV); /* Coprocessor segment overrun. */ - case 10: return (SIGTRAP); /* Invalid TSS (also single-step). */ - case 11: return (SIGSEGV); /* Segment not present. */ - case 12: return (SIGSEGV); /* Stack exception. */ - case 13: return (SIGSEGV); /* General protection. */ - case 14: return (SIGSEGV); /* Page fault. */ - case 16: return (SIGEMT); /* Coprocessor error. */ + case T_BPTFLT: return (SIGTRAP); + case T_ARITHTRAP: return (SIGFPE); + case T_PROTFLT: return (SIGSEGV); + case T_TRCTRAP: return (SIGTRAP); + case T_PAGEFLT: return (SIGSEGV); + case T_DIVIDE: return (SIGFPE); + case T_NMI: return (SIGTRAP); + case T_FPOPFLT: return (SIGILL); + case T_TSSFLT: return (SIGSEGV); + case T_SEGNPFLT: return (SIGSEGV); + case T_STKFLT: return (SIGSEGV); + case T_XMMFLT: return (SIGFPE); } return (SIGEMT); } diff --git a/sys/i386/i386/gdb_machdep.c b/sys/i386/i386/gdb_machdep.c index d501b847fda9..fd522309dbb2 100644 --- a/sys/i386/i386/gdb_machdep.c +++ b/sys/i386/i386/gdb_machdep.c @@ -99,21 +99,18 @@ gdb_cpu_signal(int type, int code) { switch (type & ~T_USER) { - case 0: return (SIGFPE); /* Divide by zero. */ - case 1: return (SIGTRAP); /* Debug exception. */ - case 3: return (SIGTRAP); /* Breakpoint. */ - case 4: return (SIGURG); /* into instr. (overflow). */ - case 5: return (SIGURG); /* bound instruction. */ - case 6: return (SIGILL); /* Invalid opcode. */ - case 7: return (SIGFPE); /* Coprocessor not present. */ - case 8: return (SIGEMT); /* Double fault. */ - case 9: return (SIGSEGV); /* Coprocessor segment overrun. */ - case 10: return (SIGTRAP); /* Invalid TSS (also single-step). */ - case 11: return (SIGSEGV); /* Segment not present. */ - case 12: return (SIGSEGV); /* Stack exception. */ - case 13: return (SIGSEGV); /* General protection. */ - case 14: return (SIGSEGV); /* Page fault. */ - case 16: return (SIGEMT); /* Coprocessor error. */ + case T_BPTFLT: return (SIGTRAP); + case T_ARITHTRAP: return (SIGFPE); + case T_PROTFLT: return (SIGSEGV); + case T_TRCTRAP: return (SIGTRAP); + case T_PAGEFLT: return (SIGSEGV); + case T_DIVIDE: return (SIGFPE); + case T_NMI: return (SIGTRAP); + case T_FPOPFLT: return (SIGILL); + case T_TSSFLT: return (SIGSEGV); + case T_SEGNPFLT: return (SIGSEGV); + case T_STKFLT: return (SIGSEGV); + case T_XMMFLT: return (SIGFPE); } return (SIGEMT); }