From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 946 invoked by alias); 28 Dec 2010 23:02:59 -0000 Received: (qmail 935 invoked by uid 22791); 28 Dec 2010 23:02:58 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Dec 2010 23:02:52 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 68DF613079; Tue, 28 Dec 2010 15:02:50 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost4.vmware.com (Postfix) with ESMTP id 5DF72C9A53; Tue, 28 Dec 2010 15:02:50 -0800 (PST) Message-ID: <4D1A6C99.6050202@vmware.com> Date: Tue, 28 Dec 2010 23:02:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: Jan Kratochvil CC: Joel Brobecker , Edjunior Barbosa Machado , "gdb@sourceware.org" Subject: Re: next/step after main() function's return References: <4D19144E.1030504@linux.vnet.ibm.com> <20101228052055.GY2618@adacore.com> <20101228082324.GA29391@host0.dyn.jankratochvil.net> In-Reply-To: <20101228082324.GA29391@host0.dyn.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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/msg00082.txt.bz2 Jan Kratochvil wrote: > On Tue, 28 Dec 2010 06:20:55 +0100, Joel Brobecker wrote: >>> when issuing a next or step after main() function's return statement, >>> gdb drops to __libc_start_main() from libc on x86 (or >>> generic_start_main() on ppc and so on, depending on the arch if I'm >>> not mistaken). Is it considered a bug or it's just the expected >>> behavior? >> I'd say that this is expected behavior. `main' is called by >> __libc_start_main, so "next"-ing out of main will land in that function. > > With default `set backtrace past-main off' the user may expect it to behave > differently. Still the atexit functions could be "next"ed so GDB would have > to identify somehow their calls. I'm guessing this happens because libc_start_main is compiled with -g. Otherwise, gdb would continue executing "in the woods" until exit.