Re: [PATCH] Switch the inferior too in switch_to_program_space_and_thread (Re: [PATCH v2 08/24] Introduce switch_to_inferior_no_thread)

Pedro Alves
2020-01-10T20:03:39Z

On 1/10/20 2:34 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> The crash happens while doing a breakpoint re-set, called by
> Pedro> clear_symtab_users at the tail end of (3). That is, while recreating
> Pedro> breakpoints for the current program space, which is the program space
> Pedro> we're tearing down. During breakpoint re-set, we try to switch to the
> Pedro> new location's pspace (the current pspace set in (1), so the pspace
> Pedro> we're tearing down) with switch_to_program_space_and_thread, and that
> Pedro> hits the failed assertion.
>
> Whatever happened to fine-grained breakpoint resetting?
> Among other things maybe that would help with this sort of problem.

Yeah... Many years ago Keith gave it a try, and then he had to go do
something else. And then few years later, I gave it another go.
I got to somewhere quite close to useful, but never managed to get back
to finishing it. The branch doesn't look like is on my github, I'd
have to dig it out. This was pre-C++... Maybe starting to scratch
is better...

>
> Pedro> I'm not hard set on this approach though; I can go with adding the
> Pedro> symfile_add_flags parameter to program_space::free_all_objfiles if
> Pedro> people prefer that.
>
> This approach seems fine.
> Longer term I would like to get rid of clear_symtab_users. Maybe it
> could be replaced with more precisely targeted observers instead.

Thanks,
Pedro Alves