Re: [RFA] GDB/624 - tbreak commands not executed when breakpoint hit

Andrew Cagney
2002-09-27T23:10:17Z

> Joel Brobecker wrote:
>
>>
>> Michael,
>>
>
>> > Joel, this implementation, with its use of delete_at_next_stop,
>> > seems clumsy and, to be frank, scary. Instead, what if you just
>> > made a temporary copy of the tbreak command-list (like you do for
>> > GDB/622), then delete the breakpoint, and later execute the commands?
>
>>
>> Thanks for your review. I need a bit of time to delve into this again,
>> but I'll be quite busy in the next 2 or 3 weeks. You can consider this
>> patch withdrawn in the meantime.
>
>
> Aww, come on. ;-)
>
> OK, maybe it's fresher in my mind now than it is in yours.
> How about this?
>
>
>
> *** breakpoint.joel1.c Thu Aug 22 17:01:02 2002
> --- breakpoint.c Thu Aug 22 17:56:03 2002
> *************** void
> *** 6594,6604 ****
> breakpoint_auto_delete (bpstat bs)
> {
> struct breakpoint *b, *temp;
>
> for (; bs; bs = bs->next)
> if (bs->breakpoint_at && bs->breakpoint_at->disposition == disp_del
> && bs->stop)
> ! delete_breakpoint (bs->breakpoint_at);
>
> ALL_BREAKPOINTS_SAFE (b, temp)
> {
> --- 6594,6614 ----
> breakpoint_auto_delete (bpstat bs)
> {
> struct breakpoint *b, *temp;
> + struct command_line *cmd;
>
> for (; bs; bs = bs->next)
> if (bs->breakpoint_at && bs->breakpoint_at->disposition == disp_del
> && bs->stop)
> ! {
> ! /* Deleting a temp breakpoint. If it has commands associated
> ! with it, preserve them in the in the bpstat list, so they
> ! can be executed by bpstat_do_actions. */
> !
> ! cmd = copy_command_lines (bs->commands);
> ! make_cleanup_free_command_lines (&cmd);
> ! delete_breakpoint (bs->breakpoint_at);

Won't a discard cleanups be needed here?

> ! bs->commands = cmd;
> ! }
>
> ALL_BREAKPOINTS_SAFE (b, temp)
> {