From owner-freebsd-hackers@freebsd.org Sun Jan 3 14:31:08 2016 Return-Path: Delivered-To: freebsd-hackers@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 EE9CFA60308 for ; Sun, 3 Jan 2016 14:31:08 +0000 (UTC) (envelope-from kah@kahnews.net) Received: from nl.kahnews.net (nl.kahnews.net [IPv6:2a01:7c8:aab0:4bb::2001]) by mx1.freebsd.org (Postfix) with ESMTP id BEABD1378 for ; Sun, 3 Jan 2016 14:31:08 +0000 (UTC) (envelope-from kah@kahnews.net) Received: from [192.168.1.20] (cm-84.215.48.116.getinternet.no [84.215.48.116]) by nl.kahnews.net (Postfix) with ESMTPSA id 7E4AEAB4F6 for ; Sun, 3 Jan 2016 15:30:58 +0100 (CET) Subject: Re: variables optimized out To: freebsd-hackers@freebsd.org References: From: "Kristian A. Hiorth" Message-ID: <568930A0.6010405@kahnews.net> Date: Sun, 3 Jan 2016 15:30:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2016 14:31:09 -0000 On 01/03/2016 02:38 PM, robbinson defau wrote: > Hi all, > > Im debugging some issues in the kernel and as the kernel is compiled by > default with -O2, a lot of variables are optimized out. So i made changes > to make.conf (CFLAGS and COPTFLAGS).\ > > All builds fine, but I get the weirdest of panics that most certainly not > happen with -O2. So it's likely i'm doing something wrong. What would be > the correct way to be able to debug the kernel and have it build such that > locals and function arguments are not optimized out? > > Thanks in advance, > > /DF Hi, sounds like stack overflows, did you try increasing kernel stack size? Stuff like WITNESS causes a lot of stack growth when the optimizer inlines fewer calls. I've run an -O0 kernel with options KSTACK_PAGES=6 without too many problems. Hope this helps, Kristian