From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26526 invoked by alias); 31 Mar 2014 14:10:13 -0000 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 Received: (qmail 26516 invoked by uid 89); 31 Mar 2014 14:10:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail-la0-f42.google.com Received: from mail-la0-f42.google.com (HELO mail-la0-f42.google.com) (209.85.215.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 31 Mar 2014 14:10:10 +0000 Received: by mail-la0-f42.google.com with SMTP id ec20so5931714lab.29 for ; Mon, 31 Mar 2014 07:10:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7sPnv+QchcMRQE6t6dxbyqba73Ied1RIAx3mdpmlP2w=; b=Az86jq91Xg63mFT7t8+7/xvSpMQhtizVejoz1V1MhkLH8LkJ7BTXKsm6VRwqimG3fW HtJgKE68MlaFCGwyqSdmmQO90u1RG5VxZ4iT4WCZ7/VnQuwtEKE2zmYD1bpHwA3r+Rcu LsFQpH2UySbty1WMMlJCmKTep9Wun8I6VE7X7mr9nwfvNSii8P+g+nOOHjB4zv3VwILQ LCBsiS7e00NgNk/S6ACJzz2kGy93yx/rsfdJYzHxG8lWMIb01JqhiL6lInugsObLAyDb ax3AyUN742qeha2G6gkp4wd8LiEUGEqDxsXIoWXtOGIaGysqSdXM9mdksb1rvLe/wTSi yx8w== X-Gm-Message-State: ALoCoQlHnQ55mfUxV9D6+TndWRt4I7PU4jjJ6ZbP2pshv5LV5SBr/DlzYI51l0EozOjAU3Yt2flo MIME-Version: 1.0 X-Received: by 10.112.50.194 with SMTP id e2mr18225081lbo.4.1396275007052; Mon, 31 Mar 2014 07:10:07 -0700 (PDT) Received: by 10.112.9.40 with HTTP; Mon, 31 Mar 2014 07:10:07 -0700 (PDT) In-Reply-To: References: Date: Mon, 31 Mar 2014 14:10:00 -0000 Message-ID: Subject: Re: break on C++ global objects ctors From: Daniel Gutson To: Paul_Koning@dell.com Cc: gdb-patches Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00693.txt.bz2 On Mon, Mar 31, 2014 at 10:56 AM, wrote: > This certainly should be easily doable, just in gdb. FWIW, if you start = a program with gdbserver and then connect to it from gdb ("target remote" t= o gdbserver), the program is stopped at the first instruction, way before "= main". That doesn't solve how gdb detects the beginning of each ctor function. At that point you should be able to set a breakpoint in a constructor and tell it "continue". > > If such a thing were desirable for gdb, the same logic could be used, I w= ould assume. > > paul > > On Mar 31, 2014, at 8:24 AM, Daniel Gutson wrote: > >> PING for a maintainer please? >> >> Thanks! >> >> Daniel. >> >> On Wed, Mar 26, 2014 at 3:22 PM, Daniel Gutson >> wrote: >>> Hi, >>> >>> AFAIK, there is no command to break and debug the construction of >>> global objects in C++. >>> >>> I'm looking for an equivalent command to "start" but instead of temp >>> breaking at the >>> beginning of main(), breaks at the beginning of every global ctor. >>> >>> The way I'm currently doing this in GNU Linux/x86_64 is: >>> br __static_initialization_and_destruction_0 >>> which is a workaround, with the nice side effect that when asking info = br, gdb >>> shows all the source locations of the global object instances. >>> >>> I'm not sure whether this could supported by a native gdb feature or by= a python >>> extension. >>> If there is consensus about the former, I might create some patch. >>> However, I suspect that this might require some support from collect2 t= oo, >>> or some libc internals knowledge by gdb. >>> >>> Daniel. >> >> >> >> -- >> >> Daniel F. Gutson >> Chief Engineering Officer, SPD >> >> >> San Lorenzo 47, 3rd Floor, Office 5 >> >> C=F3rdoba, Argentina >> >> >> Phone: +54 351 4217888 / +54 351 4218211 >> >> Skype: dgutson --=20 Daniel F. Gutson Chief Engineering Officer, SPD San Lorenzo 47, 3rd Floor, Office 5 C=F3rdoba, Argentina Phone: +54 351 4217888 / +54 351 4218211 Skype: dgutson