From: Pedro Alves <pedro@codesourcery.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: fix bug with std::terminate handler
Date: Thu, 25 Feb 2010 19:49:00 -0000 [thread overview]
Message-ID: <201002251949.36154.pedro@codesourcery.com> (raw)
In-Reply-To: <m3sk8pqg1r.fsf@fleche.redhat.com>
On Thursday 25 February 2010 19:19:28, Tom Tromey wrote:
> >>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
>
> Tom> call_function_by_hand installs a momentary breakpoint on std::terminate,
> Tom> and then deletes it later. However, this can cause a double deletion of
> Tom> the breakpoint. In the bug, the called function is dlopen, which causes
> Tom> gdb to enter solib_add, which calls breakpoint_re_set, deleting the
> Tom> momentary breakpoint.
>
> Pedro> Why doesn't stepping over "dlopen", with "(gdb) next" cause the
> Pedro> same problem with step-resume breakpoints?
>
> The step-resume breakpoints have type bp_step_resume, which are handled
> specially by breakpoint_re_set_one. The std::terminate breakpoint is
> just a plain bp_breakpoint.
Yes, that's the problem.
> I suppose I could add a new bptype, though that seems rather heavy for
> this.
No momentary breakpoint should have bp_breakpoint type. All
that do will have the same problem.
I see infcmd.c:finish_backward is also broken in the same way
although finish_forward uses bp_finish. In fact, it's exactly
this abuse of bp_breakpoint that let to the need of the
make_breakpoint_silent call there...
A `gdb_assert (type != bp_breakpoint)' in
set_momentary_breakpoint would be a Nice To Have.
There's also the option of making the breakpoint at
std::terminate be a real internal breakpoint, enabled/disabled
on need, a-la-E.g., enable_overlay_breakpoints or
set_longjmp_breakpoint. The advantage is that if the
dlopen causes the first load of libstdc++ ever in
the binary (quite rare, but possible), the breakpoint
at std::terminate resolves itself magically and you
still catch a call to it. This option requires adding a
breakpoint type as well.
> If you have a particular approach you think would be best, I would be
> happy to implement that.
Thanks. Take your pick from the above. I also though
of adding a flag to the breakpoint struct to tag it as
momentary/temporary, but it feels hackish and a bit
lazy given what I said above. :-) But I wouldn't say
no to such fix.
--
Pedro Alves
next prev parent reply other threads:[~2010-02-25 19:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 18:11 Tom Tromey
2010-02-25 18:26 ` Pedro Alves
2010-02-25 19:19 ` Tom Tromey
2010-02-25 19:49 ` Pedro Alves [this message]
2010-02-26 1:52 ` Pedro Alves
2010-03-16 20:49 ` Tom Tromey
2010-03-25 18:14 ` Pedro Alves
2010-03-25 20:37 ` Tom Tromey
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=201002251949.36154.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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