From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2206 Path: news.gmane.org!not-for-mail From: Brian Wang Newsgroups: gmane.linux.lib.musl.general Subject: Re: Difference between -O2 and -g Date: Fri, 26 Oct 2012 10:47:57 +0800 Message-ID: References: <20121026014022.GT254@brightrain.aerifal.cx> <20121026023254.GU254@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1351219692 22381 80.91.229.3 (26 Oct 2012 02:48:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Oct 2012 02:48:12 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2207-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 26 04:48:20 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TRZy4-0005se-QW for gllmg-musl@plane.gmane.org; Fri, 26 Oct 2012 04:48:16 +0200 Original-Received: (qmail 18155 invoked by uid 550); 26 Oct 2012 02:48:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 18147 invoked from network); 26 Oct 2012 02:48:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wDJR2QgPn8nmRAxPzIvvUDmPCrYDoNTroiIpovvD0iQ=; b=Q1Y9rjjil3R8QzqKnZhLb6q539N0TO7YFKQffVM9DL+mwxAENNg3oR1MsLJHpLixWA KUWCdBFooeT2BmbH3xq7iYsQh3qcdEMw2opxs3sY55XfuTxJ5e9icybpLRzZzv18KnkB ZyH6vQ4ZAEnqj2LaXTK8Axpg0R7vWmoUAqM6wE9Y90SwDZSfdqjuJoy/rtnsSHY5RQA7 mIyF3XzpXsCxlzdI/hJNdDEryyhGJgpUNQHPuaUzUEx5ie1tWJmBYe+e6ITCsxMX5TV+ 4EnDoE0fiUfYeU4fnps6V1VPEl2AGWvM81WlFzlxV2Gi/HBT0uUGtTzSR6vIQH3l/8SD MLbw== In-Reply-To: <20121026023254.GU254@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:2206 Archived-At: On Fri, Oct 26, 2012 at 10:32 AM, Rich Felker wrote: > On Fri, Oct 26, 2012 at 10:04:46AM +0800, Brian Wang wrote: >> > One very simple way to get a picture of what's going on in a program >> > is to run it under strace. Try saving strace logs for both the working >> > version and the broken version and comparing them either manually or >> > with the diff utility (although the latter may be difficult unless you >> > filter out the addresses and other contnets that will naturally >> > differ, so it might be easier to visually inspect). If you don't >> > already have an strace built for your target, I think Aboriginal Linux >> > has static binaries you can use. >> >> I have previously built my static strace. >> I could not decipher what went wrong. Please find the strace logs for >> the three binaries in question. >> The source code is basically the same, except for the musl ones, >> printf calls are sprinkled here and there >> as my desperate attempt. > > The good and bad traces diverge at this line, which only happens in > the good one: > > writev(2, [{"CreateColormap : good end\n", 26}, {NULL, 0}], 2) = 26 > > So search the source for that string and see what condition is causing > that code to be reached or not reached. Thank you for reading through them. :-) The failed call (XaceHook) is: ----------- /* * Security creation/labeling check */ i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP, pmap, RT_NONE, NULL, DixCreateAccess); if (i != Success) { fprintf(stderr, "%s : 9\n", __func__); FreeResource(mid, RT_NONE); return i; } ----------- I got tired of lots of printfs. That is why I would like the help of gdbserver. However, with -O2 turned on, it is rather difficult to step through the code, and without -O2, it will not go into the error path... Are there any known alignment tricks that I should apply for ARM targets? Thanks. Brian -- brian ------------------ Cool-Karaoke - The smallest recording studio, in your palm, open-sourced http://cool-idea.com.tw/ iMaGiNaTiOn iS mOrE iMpOrTaNt tHaN kNoWlEdGe