This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix use of a dangling pointer for Python breakpoint objects
- From: Pedro Alves <palves at redhat dot com>
- To: Pierre-Marie de Rodat <derodat at adacore dot com>, gdb-patches at sourceware dot org
- Date: Mon, 27 Jun 2016 11:03:45 +0100
- Subject: Re: [PATCH] Fix use of a dangling pointer for Python breakpoint objects
- Authentication-results: sourceware.org; auth=none
- References: <20160621104021 dot 15093-1-derodat at adacore dot com> <02138a22-5087-44ad-6023-7c87251f3d19 at redhat dot com> <eb1f09f8-f7cb-b02d-2de0-f42a1bbfdf5b at adacore dot com> <c6cf09df-2966-9571-86c6-8651f909cce5 at redhat dot com> <72fe08f8-6a9f-1c50-ea5a-1ce75f624e6f at adacore dot com>
On 06/27/2016 10:11 AM, Pierre-Marie de Rodat wrote:
> +gdb_test "source py-breakpoint2.py"
This is still sourcing the old filename.
> +
> +# ... and when it did, as a result, the following breakpoint creation (not
> +# initiated by the Python API) would dereference the already-freed Python
> +# breakpoint wrapper, resulting in undefined behavior, sometimes observed as a
> +# gdb crash, and other times causing the next stop to invoke the Python wrapper
> +# "stop" method for the object that is not supposed to exist.
> +gdb_test "break foo"
> +
> +# ... eventually, triggering this breakpoint will invoke the Python wrapper
> +# "stop" method for an object that is not supposed to exist.
Remove this sentence, it no longer makes sense to have it.
> +set test "continuing to foo"
> +gdb_test_multiple "continue" "$test" {
> + -re "MyBP\.stop was invoked\!.*$gdb_prompt $" {
> + fail "$test"
> + }
> + -re "Continuing.*Breakpoint 2, foo.*$gdb_prompt $" {
> + pass "$test"
> + }
> +}
OK with the above fixed.
Thanks,
Pedro Alves