public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Gutson <daniel.gutson@tallertechnologies.com>
To: gdb-patches <gdb-patches@sourceware.org>
Subject: break on C++ global objects ctors
Date: Wed, 26 Mar 2014 18:22:00 -0000	[thread overview]
Message-ID: <CAF5HaEU_5DhgydC0B7Ucx+owH3+PqsztZphAARzc80+9VBBtBA@mail.gmail.com> (raw)

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.

             reply	other threads:[~2014-03-26 18:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 18:22 Daniel Gutson [this message]
2014-03-31 12:24 ` Daniel Gutson
2014-03-31 13:56   ` Paul_Koning
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=CAF5HaEU_5DhgydC0B7Ucx+owH3+PqsztZphAARzc80+9VBBtBA@mail.gmail.com \
    --to=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).