From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29347 invoked by alias); 29 Nov 2010 10:12:31 -0000 Received: (qmail 29335 invoked by uid 22791); 29 Nov 2010 10:12:30 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_KG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 29 Nov 2010 10:12:25 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oATACI5J014240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 29 Nov 2010 05:12:18 -0500 Received: from [10.3.113.83] (ovpn-113-83.phx2.redhat.com [10.3.113.83]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oATACGDK021062; Mon, 29 Nov 2010 05:12:17 -0500 Subject: Re: [PATCH] Built kernel without -O2 option From: Mark Wielaard To: Andi Kleen Cc: Hui Zhu , linux-kernel@vger.kernel.org, gdb@sourceware.org, hellogcc@freelists.org In-Reply-To: <87r5e4lab7.fsf@basil.nowhere.org> References: <87r5e4lab7.fsf@basil.nowhere.org> Content-Type: text/plain; charset="UTF-8" Date: Mon, 29 Nov 2010 10:12:00 -0000 Message-ID: <1291025536.2904.6.camel@springer.wildebeest.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00115.txt.bz2 On Mon, 2010-11-29 at 10:59 +0100, Andi Kleen wrote: > Hui Zhu writes: > > > Now, there are a lot of ways to debug the Linux kernel with GDB, like > > qemu, kgtp or kgdb and so on. > > But the developer more like add a printk. It have a lot of reason, a big one is: > > (gdb) p ret > > $3 = > > And the code execution order is not right. > > Really the right place to fix a lot of this would be gcc (and perhaps > gdb). I suspect with some careful work the debugging experience > for -O2 could be improved a lot. > I also believe the latest gccs already have improvements in this area. The VTA branch was merged for GCC 4.5 http://gcc.gnu.org/wiki/Var_Tracking_Assignments Which helps a lot with generating dwarf for previously "optimized out" values. There were also a couple of papers on generating even better debuginfo at the recent GCC Summit: http://gcc.gnu.org/wiki/summit2010 Jakub Jelínek, Improving debug info for optimized away parameters http://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=get&target=jelinek.pdf Alexandre Oliva, Consistent Views at Recommended Breakpoints http://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=get&target=oliva.pdf Cheers, Mark