[lldb] Reset breakpoint hit count before new runs

A common debugging pattern is to set a breakpoint that only stops after
a number of hits is recorded. The current implementation never resets
the hit count of breakpoints; as such, if a user re-`run`s their
program, the debugger will never stop on such a breakpoint again.

This behavior is arguably undesirable, as it renders such breakpoints
ineffective on all but the first run. This commit changes the
implementation of the `Will{Launch, Attach}` methods so that they reset
the _target's_ breakpoint hitcounts.

Differential Revision: https://reviews.llvm.org/D133858
This commit is contained in:
Felipe de Azevedo Piovezan
2022-09-13 11:30:07 -04:00
parent 95b3947111
commit 9749587498
20 changed files with 167 additions and 26 deletions

View File

@@ -2760,6 +2760,22 @@ ListenerSP ProcessAttachInfo::GetListenerForProcess(Debugger &debugger) {
return debugger.GetListener();
}
Status Process::WillLaunch(Module *module) {
GetTarget().ResetBreakpointHitCounts();
return DoWillLaunch(module);
}
Status Process::WillAttachToProcessWithID(lldb::pid_t pid) {
GetTarget().ResetBreakpointHitCounts();
return DoWillAttachToProcessWithID(pid);
}
Status Process::WillAttachToProcessWithName(const char *process_name,
bool wait_for_launch) {
GetTarget().ResetBreakpointHitCounts();
return DoWillAttachToProcessWithName(process_name, wait_for_launch);
}
Status Process::Attach(ProcessAttachInfo &attach_info) {
m_abi_sp.reset();
m_process_input_reader.reset();