Re: [PATCH] Fix use of a dangling pointer for Python breakpoint objects

Pedro Alves
2016-06-27T10:03:59Z

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