-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core_impl: fix support for no threads #127
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from that one comment that needs addressing, this LGTM
src/stub/core_impl/base.rs
Outdated
None => { | ||
res.write_str("E01")?; | ||
return Ok(HandlerStatus::Handled); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually have a bit of plumbing in place to streamline returning Exx
-style errors:
None => { | |
res.write_str("E01")?; | |
return Ok(HandlerStatus::Handled); | |
} | |
None => return Err(Error::NonFatalError(1)) |
It's both more concise than invoking write_str + returning early, and also results in some slightly better codegen (wrt. binary size).
Can you switch both blocks over?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've made this change and pushed the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this change got lost somewhere?
Oh, also: can you mark the I'll spin up a tracking issue to remove it entirely in 0.7 |
Alright, I also marked |
741b84a
to
be7439e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you had a bit of a branch-juggling mishap 😅
src/target/ext/base/multithread.rs
Outdated
|
||
/// Allow the target to change the active PID from the default fake one. | ||
#[inline(always)] | ||
fn active_pid(&mut self) -> Result<Pid, Self::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems you lumped together your two PRs and lost some stuff along the way...
Lets keep this PR focused on solving the bug at hand, and leave this stuff to #129
src/stub/core_impl/base.rs
Outdated
None => { | ||
res.write_str("E01")?; | ||
return Ok(HandlerStatus::Handled); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this change got lost somewhere?
This variant is no longer generated, so note that it will be removed. Signed-off-by: Sean Cross <sean@xobs.io>
be7439e
to
55e6ed2
Compare
Sometimes, a target has no threads. This may be the case when a process is not yet selected, or when all threads have terminated in a specific process. Support `None` as a return from `get_sane_any_tid()` and return an error to GDB. This addresses a `NoActiveThreads` error, and closes daniel5151#122. Signed-off-by: Sean Cross <sean@xobs.io>
Since this plumbing exists, use this to return an error. Signed-off-by: Sean Cross <sean@xobs.io>
It's been confusing because I need both PRs on my branch in order to do development, even though they are necessarily different features. I think I've got it sorted now and it should be all set for merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, LGTM!
Sometimes, a target has no threads. This may be the case when a process is not yet selected, or when all threads have terminated in a specific process.
Support
None
as a return fromget_sane_any_tid()
and return an error to GDB. This addresses aNoActiveThreads
error, and closes #122.