Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752750Ab2EFCAu (ORCPT ); Sat, 5 May 2012 22:00:50 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:63130 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752698Ab2EFCAt convert rfc822-to-8bit (ORCPT ); Sat, 5 May 2012 22:00:49 -0400 MIME-Version: 1.0 In-Reply-To: References: <4F788731.8020708@xenotime.net> Date: Sat, 5 May 2012 23:00:48 -0300 Message-ID: Subject: Re: How can I turn off/disable -O2/-Os optimization? From: Renato Westphal To: Zhihua Che Cc: Randy Dunlap , linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1786 Lines: 49 2012/4/2 Zhihua Che : > 在 2012年4月2日 上午12:49,Randy Dunlap 写道: >> On 04/01/2012 09:31 AM, Zhihua Che wrote: >> >>> Hi, everyone >>> >>>     I'm debugging linux kernel using kgdb/qemu, but I find that the >>> execution order didn't math the program order usually.  I guess it was >>> because the compiling optimization. So I decided to remove -O options >>> in Makefiles. >>>     First I removed -Ox in variables HOSTCFLAGS/HOSTCXXFLAGS in >>> /Makefile around line 248 and -Ox in variable >>> KBUILD_CFLAGS in /arch/x86/boot/Makefile around line 55. >>> But it didn't work, the step execution still didn't follow the program >>> order. Then I found I missed -Ox in KBUILD_CFLAGS in >>> /Makefile around line 562, so I removed them, but this >>> time, the compiling failed, complaining >>>     rcupdate.h:917:2: error: size of unnamed array is negative >>>    And finally, after grep, I find there are a load of -O2 option are >>> assigned in a load of Makefiles. So, How could I disable -O >>> optimization for debugging? >>> >>>    Thanks for any tips >>> -- >> >> >> You could try the new CONFIG_READABLE_ASM patch: >>  http://marc.info/?l=linux-kernel&m=133296079716268&w=2 >> >> >> -- >> ~Randy > > Hi, >    I tried your patch, and it seemed not to work:-(. It still didn't > follow the program order Hi Zhihua Che, Have you found a solution for this? I'm facing the same problem with KGDB.. -- Renato Westphal -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/