From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5925 invoked by alias); 17 Jun 2005 11:21:24 -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 5893 invoked by uid 22791); 17 Jun 2005 11:21:21 -0000 Received: from cam-admin0.cambridge.arm.com (HELO cam-admin0.cambridge.arm.com) (193.131.176.58) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 17 Jun 2005 11:21:21 +0000 Received: from pc960.cambridge.arm.com (pc960.cambridge.arm.com [10.1.205.4]) by cam-admin0.cambridge.arm.com (8.12.10/8.12.10) with ESMTP id j5HBKI6i019041; Fri, 17 Jun 2005 12:20:18 +0100 (BST) Received: from pc960.cambridge.arm.com (localhost.localdomain [127.0.0.1]) by pc960.cambridge.arm.com (8.12.8/8.12.8) with ESMTP id j5HBKgbC013862; Fri, 17 Jun 2005 12:20:42 +0100 Received: (from rearnsha@localhost) by pc960.cambridge.arm.com (8.12.8/8.12.8/Submit) id j5HBKfB9013649; Fri, 17 Jun 2005 12:20:41 +0100 Subject: Re: Unwinding stack past main() when it has another name From: Richard Earnshaw To: Daniel Jacobowitz Cc: Steven Johnson , gdb@sources.redhat.com In-Reply-To: <20050616220527.GA9960@nevyn.them.org> 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> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1119007241.10542.7.camel@pc960.cambridge.arm.com> Mime-Version: 1.0 Date: Fri, 17 Jun 2005 11:21:00 -0000 X-SW-Source: 2005-06/txt/msg00183.txt.bz2 On Thu, 2005-06-16 at 23:05, Daniel Jacobowitz wrote: > On Fri, Jun 17, 2005 at 08:22:13AM -1100, Steven Johnson wrote: > > Daniel Jacobowitz wrote: > > >For some non-C languages we get the name of the main function from > > >debug information, but for C it's always main() > > > > > > > > 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. R.