Conversation
mkeeter
commented
May 4, 2026
|
|
||
| let subargs = DumpArgs::try_parse_from(&context.cli.cmd)?; | ||
| let hubris = &context.cli.archive()?; | ||
| let core = &mut *context.cli.attach_live_match(hubris)?; |
Contributor
Author
There was a problem hiding this comment.
Do we care about the ability to dump from a dump? Probably not, but it was previously possible.
Contributor
There was a problem hiding this comment.
I feel like if we actually want that we're probably going to want other tooling
mkeeter
commented
May 4, 2026
mkeeter
commented
May 4, 2026
e316bab to
a445027
Compare
labbott
reviewed
May 4, 2026
Contributor
labbott
left a comment
There was a problem hiding this comment.
I think this looks okay I want to take another look in a bit
Comment on lines
-74
to
-80
| let core = &mut **context.core.as_mut().unwrap(); | ||
| core.op_start()?; | ||
|
|
||
| let hubris = context.archive.as_ref().unwrap(); | ||
| let hubris = &context.cli.archive()?; | ||
|
|
||
| // Use an archive core to easily read from flash | ||
| let core = &mut *humility::core::attach_archive(hubris)?; | ||
| let regions = hubris.regions(core)?; | ||
| core.op_done()?; |
Contributor
There was a problem hiding this comment.
I guess these were vestigial op_start/op_done?
Contributor
Author
There was a problem hiding this comment.
Yeah, and even more vestigal now that we're reading from the archive directly (which doesn't have a core to start and stop).
01a42b6 to
cfca2fa
Compare
3be77aa to
ecb22b2
Compare
cfca2fa to
b04b030
Compare
72072cb to
fc4af3e
Compare
cc3a0fe to
800da35
Compare
3abe5e4 to
e6d790a
Compare
e6d790a to
73ca69e
Compare
73ca69e to
95a62e9
Compare
95a62e9 to
8f3503b
Compare
8f3503b to
d213698
Compare
d213698 to
a745c57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Staged on #651)
Note: A bunch of the LOC changes are in the test suite, so you may want to just look at the first commit when reviewing. The logic changes are a significant net code reduction (+616/-1144), but a few of the test suite commands now successfully run where they previously exited with an error (+1147/-358), which accounts for the overall LOC increase.
Overview
The
CommandKindtype has confusing, non-orthogonal behavior.It combines two ideas:
HubrisArchive, and if so, does it need to be fully loaded ("cooked") or do we just need the raw ZIP data?These two big ideas ("do we need an archive" and "do we need a core") are combined in unintuitive ways. For example,
CommandKind::Unattached { archive: Archive::Required }tries to attach to both a dump and an archive, but does not fail if the archive is absent (see #564 (comment)).It's also unfortunate that it's defined at the
Commandlevel, because commands may not have consistent behavior across all of their subcommands. For example,humility hiffy -ljust lists Hiffy APIs from an archive, and does not require attaching to a system. Indeed, if you runhumility hiffy -lwith an archive and you have a probe attached to an SP running a different image, it will fail:Some commands work around this by doing an extra parse of the arguments in their
initfunction, then return a differentCommanddepending on arguments:humility/cmd/monorail/src/lib.rs
Lines 1186 to 1221 in 27d1f15
This works, but is annoying to have to do!
I have one more complaint, which is improved but not entirely fixed in this PR: the
HubrisArchiveis default-constructed, then actually populated based onarchiveordumparguments; if neither is present, then archive is not valid! Commands have to work around this (with varying degrees of incredulity), e.g.humility/cmd/reset/src/lib.rs
Lines 33 to 37 in 27d1f15
So, what's to be done?
This PR removes
CommandKindentirely. It is replaced with a set of functions onClito build archives and cores, which can be called by commands when they are needed (instead of before the command is invoked).Archive handling
archivereturns the archive (if available); it does not ever return a default-constructed archivetry_archivereturns an optional archiveraw_archivereturns the bytes of the ZIP fileAll of these return a full
HubrisArchive; it is the caller's responsibility to store it somewhere and hand out references.Attachment
attach_liveattaches to a live system (debugger ornet-based)attach_live_or_dumpattaches to a live system or dumpattach_archiveattaches to an archiveThere are also additional small wrapper functions with suffixes for validation, e.g.
attach_live_bootedchecks that the live system has booted. Each of these functions returns aBox<dyn Core>directly, instead of stashing it in theExecutionContext.Changes to commands
Each command is updated to construct its archive and/or core on-demand. It's mostly mechanical porting, e.g.
becomes
...but there are a few weird edge cases – for example,
humility probenow usesattach_probedirectly.