From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21194 invoked by alias); 29 Dec 2010 02:26:23 -0000 Received: (qmail 21184 invoked by uid 22791); 29 Dec 2010 02:26:23 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Dec 2010 02:26:18 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B356E2BAB8D; Tue, 28 Dec 2010 21:26:16 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1CUnCYxgmqVr; Tue, 28 Dec 2010 21:26:16 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1491A2BAB6C; Tue, 28 Dec 2010 21:26:16 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 65F71145870; Wed, 29 Dec 2010 06:26:09 +0400 (RET) Date: Wed, 29 Dec 2010 02:26:00 -0000 From: Joel Brobecker To: Michael Snyder Cc: Jan Kratochvil , Edjunior Barbosa Machado , "gdb@sourceware.org" Subject: Re: next/step after main() function's return Message-ID: <20101229022609.GA2413@adacore.com> References: <4D19144E.1030504@linux.vnet.ibm.com> <20101228052055.GY2618@adacore.com> <20101228082324.GA29391@host0.dyn.jankratochvil.net> <4D1A6C99.6050202@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D1A6C99.6050202@vmware.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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-12/txt/msg00084.txt.bz2 > I'm guessing this happens because libc_start_main is compiled with -g. > Otherwise, gdb would continue executing "in the woods" until exit. Actually, off-by-one error :-). __libc_start_main is not compiled with debugging info, but main is. When you do a "next" in main, GDB takes the debugging info, and computes the address range that we need to step out of. So, when main returns back to __libc_start_main, we're done, and tell the user where we are. What you are describing, however, happens once we land inside __libc_start_main, since there is no line info to help us compute the next/step range. -- Joel