This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: break on C++ global objects ctors
- From: Daniel Gutson <daniel dot gutson at tallertechnologies dot com>
- To: Paul_Koning at dell dot com
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Mon, 31 Mar 2014 11:41:15 -0300
- Subject: Re: break on C++ global objects ctors
- Authentication-results: sourceware.org; auth=none
- References: <CAF5HaEU_5DhgydC0B7Ucx+owH3+PqsztZphAARzc80+9VBBtBA at mail dot gmail dot com> <CAF5HaEU3nmr9Ak5dGByUPfe0JGn4NwHu_5JUpB7Fsn6CjfuzOw at mail dot gmail dot com> <C75A84166056C94F84D238A44AF9F6AD16C9B3FB at AUSX10MPC103 dot AMER dot DELL dot COM> <CAF5HaEW8iNZHEx+SA=MBu26XMZO+ENwqXhoJwLtZSMCHc_jNcA at mail dot gmail dot com> <C75A84166056C94F84D238A44AF9F6AD16C9B531 at AUSX10MPC103 dot AMER dot DELL dot COM>
On Mon, Mar 31, 2014 at 11:15 AM, <Paul_Koning@dell.com> wrote:
>
> On Mar 31, 2014, at 10:10 AM, Daniel Gutson <daniel.gutson@tallertechnologies.com> wrote:
>
>> On Mon, Mar 31, 2014 at 10:56 AM, <Paul_Koning@dell.com> 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" to 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.
>
> I don't know what problem you're referring to. A constructor is just a function, which has a name, and you can set a breakpoint on it.
>
> If for some reason that's not working, that would be a bug, but I've used breakpoints on constructors for a long time and it seems to work when I try it.
The issue I need to add is to make gdb break at the beginning of the
construction of each (all) global object of the program.
Breaking at the beginning of the program does not solve this. Please
see my original with this clarification, so maybe I can be clearer.
One possible solution is: add breaks in the ctors of ALL types, run,
and at main delete all those breakpoints.
Another solution is to do some handling of each
__static_initialization_and_destruction_0 which varies depending on
the context.
>
> paul
--
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