From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22467 invoked by alias); 10 Jul 2007 12:13:38 -0000 Received: (qmail 22457 invoked by uid 22791); 10 Jul 2007 12:13:37 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.175) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 10 Jul 2007 12:13:35 +0000 Received: by ug-out-1314.google.com with SMTP id s2so1463264uge for ; Tue, 10 Jul 2007 05:13:32 -0700 (PDT) Received: by 10.86.71.1 with SMTP id t1mr414010fga.1184069612300; Tue, 10 Jul 2007 05:13:32 -0700 (PDT) Received: from localhost.mail.individual.net ( [85.179.193.46]) by mx.google.com with ESMTP id y6sm67083387mug.2007.07.10.05.13.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Jul 2007 05:13:30 -0700 (PDT) To: Nick Roberts Cc: Jim Blandy , Hadron , gdb@sourceware.org Subject: Re: argc - cant access memory References: <87ejjhg137.fsf@gmail.com> <18066.47080.812496.129394@kahikatea.snap.net.nz> Date: Tue, 10 Jul 2007 12:13:00 -0000 Message-ID: <87hcoc5uef.fsf@gmail.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii From: Hadron 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: 2007-07/txt/msg00074.txt.bz2 Nick Roberts writes: > > > I recently compiled and executed an opengl programming guide (redbook) > > > example, hello.c, successfully. However, when I try to debug it under > > > GUD I get > > > > > > ,---- > > > | #0 main (argc=Cannot access memory at address 0x2d > > > | ) at hello.c:93 > > > `---- > > > > The code you labeled "hello.c" has no line 93. Are you sure you're > > debugging the program you intended to? > > Aside from that, I think it just means that the arguments have been optimised > away. I think current GCC does this now even if the user doesn't specify > optimisation. It doesn't stop you from debugging does it? There is no 93 you are right as I clipped the header. Mea culpa. As for optimizing the arguments away, wouldn't this be the case for all the lines referencing argc in the main()? But is this the typical "error" for such a case? I get the message after stepping over the first line in main and then when I get to line 3 (in main) then I get #0 main (argc=191860, argv=0xb7f49850) at hello.c:94 (94 is the line "glutInitWindowSize (250, 250);" in main) If you say this is normal behaviour then fine, but I haven't experienced it before. I would be interested to hear if you get the same.