From owner-svn-src-projects@freebsd.org Wed Jan 4 22:06:15 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78109C9F6D9 for ; Wed, 4 Jan 2017 22:06:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4748F1205; Wed, 4 Jan 2017 22:06:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v04M6ExC017322; Wed, 4 Jan 2017 22:06:14 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v04M6ESv017320; Wed, 4 Jan 2017 22:06:14 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701042206.v04M6ESv017320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Jan 2017 22:06:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r311314 - in projects/clang400-import: sys/mips/mips tools/build/mk X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2017 22:06:15 -0000 Author: dim Date: Wed Jan 4 22:06:14 2017 New Revision: 311314 URL: https://svnweb.freebsd.org/changeset/base/311314 Log: Merge ^/head r311306 through r311313. Modified: projects/clang400-import/sys/mips/mips/db_trace.c projects/clang400-import/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: projects/clang400-import/ (props changed) Modified: projects/clang400-import/sys/mips/mips/db_trace.c ============================================================================== --- projects/clang400-import/sys/mips/mips/db_trace.c Wed Jan 4 21:58:33 2017 (r311313) +++ projects/clang400-import/sys/mips/mips/db_trace.c Wed Jan 4 22:06:14 2017 (r311314) @@ -141,11 +141,12 @@ stacktrace_subr(register_t pc, register_ */ int valid_args[4]; register_t args[4]; - register_t va, subr; + register_t va, subr, cause, badvaddr; unsigned instr, mask; unsigned int frames = 0; int more, stksize, j; register_t next_ra; + bool trapframe; /* Jump here when done with a frame, to start a new one */ loop: @@ -160,6 +161,7 @@ loop: next_ra = 0; stksize = 0; subr = 0; + trapframe = false; if (frames++ > 100) { (*printfn) ("\nstackframe count exceeded\n"); /* return breaks stackframe-size heuristics with gcc -O2 */ @@ -183,17 +185,21 @@ loop: * preceding "j ra" at the tail of the preceding function. Depends * on relative ordering of functions in exception.S, swtch.S. */ - if (pcBetween(MipsKernGenException, MipsUserGenException)) + if (pcBetween(MipsKernGenException, MipsUserGenException)) { subr = (uintptr_t)MipsKernGenException; - else if (pcBetween(MipsUserGenException, MipsKernIntr)) + trapframe = true; + } else if (pcBetween(MipsUserGenException, MipsKernIntr)) subr = (uintptr_t)MipsUserGenException; - else if (pcBetween(MipsKernIntr, MipsUserIntr)) + else if (pcBetween(MipsKernIntr, MipsUserIntr)) { subr = (uintptr_t)MipsKernIntr; - else if (pcBetween(MipsUserIntr, MipsTLBInvalidException)) + trapframe = true; + } else if (pcBetween(MipsUserIntr, MipsTLBInvalidException)) subr = (uintptr_t)MipsUserIntr; - else if (pcBetween(MipsTLBInvalidException, MipsTLBMissException)) + else if (pcBetween(MipsTLBInvalidException, MipsTLBMissException)) { subr = (uintptr_t)MipsTLBInvalidException; - else if (pcBetween(fork_trampoline, savectx)) + if (pc == (uintptr_t)MipsKStackOverflow) + trapframe = true; + } else if (pcBetween(fork_trampoline, savectx)) subr = (uintptr_t)fork_trampoline; else if (pcBetween(savectx, cpu_throw)) subr = (uintptr_t)savectx; @@ -215,11 +221,11 @@ loop: } /* - * For a kernel stack overflow, skip to the output and - * afterwards pull the previous registers out of the trapframe - * instead of decoding the function prologue. + * For a trapframe, skip to the output and afterwards pull the + * previous registers out of the trapframe instead of decoding + * the function prologue. */ - if (pc == (uintptr_t)MipsKStackOverflow) + if (trapframe) goto done; /* @@ -398,19 +404,24 @@ done: (uintmax_t)(u_register_t) sp, stksize); - if (pc == (uintptr_t)MipsKStackOverflow) { + if (trapframe) { #define TF_REG(base, reg) ((base) + CALLFRAME_SIZ + ((reg) * SZREG)) #if defined(__mips_n64) || defined(__mips_n32) pc = kdbpeekd((int *)TF_REG(sp, PC)); ra = kdbpeekd((int *)TF_REG(sp, RA)); sp = kdbpeekd((int *)TF_REG(sp, SP)); + cause = kdbpeekd((int *)TF_REG(sp, CAUSE)); + badvaddr = kdbpeekd((int *)TF_REG(sp, BADVADDR)); #else pc = kdbpeek((int *)TF_REG(sp, PC)); ra = kdbpeek((int *)TF_REG(sp, RA)); sp = kdbpeek((int *)TF_REG(sp, SP)); + cause = kdbpeek((int *)TF_REG(sp, CAUSE)); + badvaddr = kdbpeek((int *)TF_REG(sp, BADVADDR)); #endif #undef TF_REG - (*printfn) ("--- Kernel Stack Overflow ---\n"); + (*printfn) ("--- exception, cause %jx badvaddr %jx ---\n", + (uintmax_t)cause, (uintmax_t)badvaddr); goto loop; } else if (ra) { if (pc == ra && stksize == 0) Modified: projects/clang400-import/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- projects/clang400-import/tools/build/mk/OptionalObsoleteFiles.inc Wed Jan 4 21:58:33 2017 (r311313) +++ projects/clang400-import/tools/build/mk/OptionalObsoleteFiles.inc Wed Jan 4 22:06:14 2017 (r311314) @@ -1348,6 +1348,7 @@ OLD_FILES+=usr/bin/clang OLD_FILES+=usr/bin/clang++ OLD_FILES+=usr/bin/clang-cpp OLD_FILES+=usr/bin/clang-tblgen +OLD_FILES+=usr/bin/llvm-objdump OLD_FILES+=usr/bin/llvm-tblgen OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/asan_interface.h