From owner-freebsd-alpha@FreeBSD.ORG Fri Jun 30 19:13:30 2006 Return-Path: X-Original-To: freebsd-alpha@freebsd.org Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7339416A521 for ; Fri, 30 Jun 2006 19:13:30 +0000 (UTC) (envelope-from ulrich@infopuls.com) Received: from igel.cyberlink.ch (igel.cyberlink.ch [62.12.136.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 03AA944301 for ; Fri, 30 Jun 2006 18:52:41 +0000 (GMT) (envelope-from ulrich@infopuls.com) Received: (qmail 17237 invoked by uid 600); 30 Jun 2006 18:52:40 -0000 Received: by simscan 1.0.9 ppid: 17233, pid: 17234, t: 0.0163s scanners: regex: 1.0.9 clamav: 0.88/m:39/d:1578 Message-ID: <20060630185240.17233.qmail@igel.cyberlink.ch> References: <20060227231802.8883.qmail@igel.cyberlink.ch> <20060228020917.GA2778@xiao.rsnet> <20060228074937.GB39184@freebie.xs4all.nl> From: Ulrich To: freebsd-alpha@freebsd.org Date: Fri, 30 Jun 2006 20:52:40 +0200 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: 4.11 gdb/gcc problem with debugging simple C programs X-BeenThere: freebsd-alpha@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Alpha List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jun 2006 19:13:30 -0000 Hi everybody While running a simple C program I noticed that gdb wasn't able to print out the correct values of parameters. All parameter values were wrongly displayed whenever gdb entered or left a function and automatically showed the function's parameter list together with each parameter's value. Strange enough the program works with the correct values and runs correctly. Using gdb's print command also displays the wrong values. Sometimes even a pointer value is displayed as null although the program works with a valid pointer. The program was compiled without optimisation: gcc -Wall -g test1.c -o test1 Here are two short examples of what I see. Starting program: ./test1 value1 value2 value3 value4 Breakpoint 1, main (ac=536872600, av=0x0) at test1.c:3 3 int main(int ac, char *av[]) { (gdb) print ac $1 = 536872600 The program can access the 4 parameter values and ac has the correct value. Starting program: ./test2 -v 6000 -l 112233 file1 file2 Breakpoint 1, main (ac=536873548, av=0x7) at test2.c:75 75 int main(int ac, char *av[]) { (gdb) print ac $1 = 536873548 It seems that the addresses of parameters are shifted while accessed by gdb. The value of parameter "av" is displayed as "0x7" which is the correct value of "ac". I also don't know whether it means something that the wrong values of "ac" in both examples start with the same sequence of digits "53687". I'm reading the list since end of 2004 and I cannot remember that this problem came up already. I also checked with google but didn't find anything useful. Can someone drop me a hint where to search or what to do? I don't think that gdb or gcc are faulty, but that I did something without noticing it. gcc version 2.95.4 20020320 [FreeBSD] GNU gdb 4.18 (FreeBSD) TIA Ulrich