Commands attached to breakpoints

Joel Brobecker brobecker@adacore.com
Tue Sep 22 22:35:00 GMT 2009


Andrew,

> 2008-07-31  Andrew Stubbs  <andrew.stubbs@st.com>
> 
> 	* top.c (command_loop): Move call to bpstat_do_actions ...
> 	(execute_command): ... to here, for other callers' benefit.

My sincere apologies for not looking at this patch any earlier.
Sadly, I don't think many people in the GDB group are familiar
with the main loop, especially when it touches inferior execution
at the same time :-(.  We're trying to be better maintainers, so
do ping us after a week or two. If you still do not get any answer
within a week or two, you are hereby authorized to harass me until
it gets reviewed ;-).

> I'm not sure what the right solution is here. Presumably the best place  
> to do it would be in the breakpoint handling code (normal_stop?), but  
> I'm guessing that there's issues with recursion there.

Yeah, it would have been ideal to be able to execute the breakpoints'
commands at normal_stop.  But I think you might be right. normal_stop
is called inside proceed, for instance, and I'm not sure how kindly
this routine would take it to be called recursively...

The simplest, and safest, it appears, since to be to call this routine
at the end of execute_command, like you just did in your patch. However,
The patch is not sufficient as it is, as it causes the commands to be
executed twice in a couple of situations.  Have a look at
event-top.c:command_handler and python/python.c:execute_gdb_command,
where bpstat_do_actions is called right after calling execute_command.
So you need to remove these calls from there to complete your patch.

I am not entirely certain about the call to bpstat_do_actions in
loop.c:inferior_event_handler [INF_EXEC_COMPLETE]. I *think* we need
to retain that call, but I am not 100% sure.

If you post a patch that has your changes and removes the two calls
mentioned above, and if it passes the testsuite, I would approve
that patch for the HEAD (but not the 7.0 branch, unfortunately, too
risky).

-- 
Joel



More information about the Gdb-patches mailing list