Skip to content

Commit 1e9105f

Browse files
committed
fix: sigconts in multi-thread
1 parent 190a8da commit 1e9105f

2 files changed

Lines changed: 15 additions & 17 deletions

File tree

edbgserver-cli/src/target/breakpoint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ impl EdbgTarget {
593593
context.tid,
594594
context.pc()
595595
);
596+
self.bound_tid = Some(context.tid);
596597
if let Some((addr, link_id)) = self.temp_step_breakpoints.take() {
597598
if addr == context.pc() {
598599
debug!(

edbgserver-cli/src/target/multithread.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,14 @@ impl MultiThreadResume for EdbgTarget {
8888
let target_pid = self.get_pid()?;
8989
debug!("start handling resuming process {}", target_pid);
9090

91-
let dispatch_signal = |tid: u32, signal: Option<&Signal>| {
91+
let mut done_cont: HashSet<u32> = HashSet::new();
92+
93+
let mut dispatch_signal = |tid: u32, signal: Option<&Signal>| {
9294
if let Some(sig) = signal {
9395
send_sig_to_thread(target_pid, tid, sig);
9496
} else {
9597
send_sigcont_to_thread(target_pid, tid);
98+
done_cont.insert(tid);
9699
}
97100
};
98101

@@ -116,20 +119,14 @@ impl MultiThreadResume for EdbgTarget {
116119
return Ok(());
117120
}
118121

119-
let handled_tids: HashSet<u32> = self
120-
.resume_actions
121-
.iter()
122-
.map(|(tid, _)| tid.get() as u32)
123-
.collect();
124-
125-
self.get_active_threads()?
126-
.iter()
127-
.map(|t| t.get() as u32)
128-
.filter(|tid| !handled_tids.contains(tid))
129-
.for_each(|tid| {
130-
debug!("Continuing thread {} (implicit)", tid);
131-
send_sigcont_to_thread(target_pid, tid);
132-
});
122+
if let Some(tid) = self.bound_tid
123+
&& !done_cont.contains(&tid)
124+
{
125+
debug!("implicitly continue thread {}", tid);
126+
send_sigcont_to_thread(target_pid, tid);
127+
} else {
128+
debug!("no target need implicitly continue");
129+
}
133130
Ok(())
134131
}
135132
}
@@ -281,12 +278,12 @@ impl EdbgTarget {
281278
};
282279
match add_breakpoint_func(self, next_pc) {
283280
Ok(link_id) => {
284-
info!("Successfully attached UProbe at {:#x}", next_pc);
281+
info!("Successfully attached step breakpoint at {:#x}", next_pc);
285282
self.temp_step_breakpoints = Some((next_pc, link_id));
286283
}
287284
Err(e) => {
288285
info!(
289-
"Failed to attach UProbe at {:#x}: {}. Checking for special cases...",
286+
"Failed to attach step breakpoint at {:#x}: {}. Checking for special cases...",
290287
next_pc, e
291288
);
292289
if next_pc == curr_pc {

0 commit comments

Comments
 (0)