From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3482 invoked by alias); 7 Nov 2012 00:26:25 -0000 Received: (qmail 3451 invoked by uid 22791); 7 Nov 2012 00:26:23 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO 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, 07 Nov 2012 00:26:18 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 2D1531C6F3A; Tue, 6 Nov 2012 19:26:18 -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 84H0FHsAYYSq; Tue, 6 Nov 2012 19:26:18 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id F157E1C6F25; Tue, 6 Nov 2012 19:26:17 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 89022C54B3; Tue, 6 Nov 2012 16:26:11 -0800 (PST) Date: Wed, 07 Nov 2012 00:26:00 -0000 From: Joel Brobecker To: Luis Machado Cc: gdb-patches@sourceware.org Subject: Re: [PATCH,tests] Run to main before doing any tests in structs3.exp Message-ID: <20121107002611.GD5103@adacore.com> References: <50994431.1040405@codesourcery.com> <20121106173029.GC5103@adacore.com> <50995C16.2060507@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50995C16.2060507@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00130.txt.bz2 > Consider, for example, a target that runs on QEMU. QEMU won't start > the binary in exactly the same way as gdbserver running on linux. > Thus, global variable initialization procedures may not have > happened at that point yet. Consider that we start even before the > dynamic loader had a chance to run and do all the relocation magic. The part I don't get is why this even enters the picture. If it was a C++ program, with elaboration code that's run when the binary is loaded in memory, I would understand. But this is a plain C program, where I imagine the variables are simply located in data, with their default value provided there. So, even if the program hasn't started at all, GDB should be able to fetch it from the binary. That being said, I don't want to hold your patch. I think it's fine to run the program till main. I was just curious as to why this was sometimes necessary. Still can't get it :-). -- Joel