From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32458 invoked by alias); 18 Jun 2005 13:13:20 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 32432 invoked by uid 22791); 18 Jun 2005 13:13:15 -0000 Received: from romy.inter.net.il (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 18 Jun 2005 13:13:15 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-159-161.inter.net.il [80.230.159.161]) by romy.inter.net.il (MOS 3.5.8-GR) with ESMTP id BOM80671 (AUTH halo1); Sat, 18 Jun 2005 16:13:11 +0300 (IDT) Date: Sat, 18 Jun 2005 13:13:00 -0000 Message-Id: From: Eli Zaretskii To: Richard Earnshaw CC: drow@false.org, sjohnson@sakuraindustries.com, gdb@sources.redhat.com In-reply-to: <1119007241.10542.7.camel@pc960.cambridge.arm.com> (message from Richard Earnshaw on Fri, 17 Jun 2005 12:20:41 +0100) Subject: Re: Unwinding stack past main() when it has another name Reply-to: Eli Zaretskii References: <200506152247.07232.rodda@kde.org> <200506160112.58152.rodda@kde.org> <20050615163658.GA18795@nevyn.them.org> <200506161743.00708.rodda@kde.org> <20050616132242.GA5480@nevyn.them.org> <42B322E5.4080403@sakuraindustries.com> <20050616220527.GA9960@nevyn.them.org> <1119007241.10542.7.camel@pc960.cambridge.arm.com> X-SW-Source: 2005-06/txt/msg00189.txt.bz2 > From: Richard Earnshaw > Cc: Steven Johnson , gdb@sources.redhat.com > Date: Fri, 17 Jun 2005 12:20:41 +0100 > > > > This isnt always the case for embedded targets. There is no RULE that C > > > programs must have a main() function. It may be that most do by > > > convention, but they dont have to. In fact, main() can be a pain for > > > small embedded targets because it wants a return value and arguments, > > > which mean nothing for a program that isnt "launched" by a user on > > > demand, but the C compiler detects the special function name main() and > > > objects if it doesnt have the standard format. Programs dont even need > > > to have an entry point called _start. It all depends on how you set up > > > your link map. > > > > In fact you're wrong: there is a rule that C programs must have a > > main() function. It's in the language standard. > > You are both right, and both wrong. In fact the standard says that two > things are permitted. > > In a hosted environment the entry point to the application shall be > 'main'. In a free-standing environment there is no constraint on the > entry point -- there may even be multiple entry points. I added a footnote in the manual about this.