public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: <Paul_Koning@Dell.com>
To: <daniel.gutson@tallertechnologies.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: break on C++ global objects ctors
Date: Mon, 31 Mar 2014 13:56:00 -0000	[thread overview]
Message-ID: <C75A84166056C94F84D238A44AF9F6AD16C9B3FB@AUSX10MPC103.AMER.DELL.COM> (raw)
In-Reply-To: <CAF5HaEU3nmr9Ak5dGByUPfe0JGn4NwHu_5JUpB7Fsn6CjfuzOw@mail.gmail.com>

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” to gdbserver), the program is stopped at the first instruction, way before “main”.  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 would assume.

	paul

On Mar 31, 2014, at 8:24 AM, Daniel Gutson <daniel.gutson@tallertechnologies.com> wrote:

> PING for a maintainer please?
> 
> Thanks!
> 
>   Daniel.
> 
> On Wed, Mar 26, 2014 at 3:22 PM, Daniel Gutson
> <daniel.gutson@tallertechnologies.com> 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 too,
>> or some libc internals knowledge by gdb.
>> 
>>    Daniel.
> 
> 
> 
> -- 
> 
> Daniel F. Gutson
> Chief Engineering Officer, SPD
> 
> 
> San Lorenzo 47, 3rd Floor, Office 5
> 
> Córdoba, Argentina
> 
> 
> Phone: +54 351 4217888 / +54 351 4218211
> 
> Skype: dgutson

  reply	other threads:[~2014-03-31 13:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 18:22 Daniel Gutson
2014-03-31 12:24 ` Daniel Gutson
2014-03-31 13:56   ` Paul_Koning [this message]
2014-03-31 14:10     ` Daniel Gutson
2014-03-31 14:16       ` Paul_Koning
2014-03-31 14:41         ` Daniel Gutson
2014-09-26 18:00           ` Daniel Gutson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C75A84166056C94F84D238A44AF9F6AD16C9B3FB@AUSX10MPC103.AMER.DELL.COM \
    --to=paul_koning@dell.com \
    --cc=daniel.gutson@tallertechnologies.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).