-
Notifications
You must be signed in to change notification settings - Fork 8.3k
runners: promote --no-load argument into common code and add support in stlink_gdbrunner #98798
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
runners: promote --no-load argument into common code and add support in stlink_gdbrunner #98798
Conversation
a472923 to
00cfac4
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.
The formatting fixes belong to a separate commit
This flag functions exactly like its identically-named counterpart in the OpenOCD runner: when present, the "load" command is not added to the GDB client's command line.
... duplication which points at the lack of a common function or class. You probably not interested in changing and testing the OpenOCD runner, but you can still create that common function / class and start using it only in stlink_gdbserver.py. Then it's ready for both existing and future runners to use.
EDIT: as a pure coincidence, here is a current example of moving generic code to generic places, away from product-specific code:
00cfac4 to
6dc9ac6
Compare
|
Moved to common runner code as suggested by @marc-hb and @pdgendt (inspired by #98443). Help message uses a generic wording (instead of "don't send GDB |
pdgendt
left a comment
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, thanks!
6dc9ac6 to
8e5253b
Compare
8e5253b to
da21947
Compare
|
Rebased to resolve conflict |
|
@marc-hb PTAL |
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'm confused by this new debug_load capability: what happens when a future runner does not to have the capability? Does that runner -ex load or not? Does it depend on the specific runner? Inconsistently...
- Developers could assume "loading" is a capability. No capability = no load command issued.
- But they could assume instead that skipping the load is the capability. So, loading when no skip capability (similar to right now before this PR)
Generally speaking, having "two levels" of booleans adds complexity. So you could just drop the capability and force all runners to implement the option. It requires only one line of code in the runner. If some future runners can't support one of the two choices (cause they don't use gdb?), they could just fail when someone tries to unsupported choice.
Except... there isn't really a way to force runners to look at args.load, is there?
This is surprisingly more complicated that I thought.
I do agree the capability name is not great. Maybe something like
Per "specification",
Emphasis on
(to clarify again, the reason why
What I had in mind was instead tools which would (forcefully!) download an image before starting the GDB server, or tools which don't use GDB at all. Looking at tree for runners which support
Yes, hence why it should be a capability if we follow what's already in tree. |
Thanks. I generally hate negative options like Also, So this would become: debug_noload: whether the runner supports the --[no-]load option,
which makes `west debug` skip the gdb `load` command or its equivalent.
.
.
.
parser.add_argument('--load', action=argparse.BooleanOptionalAction,
help=("load image on target before 'west debug' session"
if caps.debug_noload else argparse.SUPPRESS),
default=True)Very small change. Makes sense? |
|
Or, you could call it parser.add_argument('--load', action=argparse.BooleanOptionalAction,
help=("load image on target before 'west debug' session"
if caps.debug_skip_load else argparse.SUPPRESS),
default=True) |
Move the existing "--no-load" argument from the OpenOCD and Intel Cyclone V runners into an argument in the runners base class such that it can be used by all runners. Also update the existing runners to work with the common option instead of their own. Signed-off-by: Mathieu Choplain <[email protected]>
Add support for the --load/--no-load argument from the base runner class. Signed-off-by: Mathieu Choplain <[email protected]>
da21947 to
b3e6aee
Compare
|
Renamed capability from |
|



Promote the existing
--no-loadargument from OpenOCD/Intel Cyclone V runners into common runner code. This argument inhibits loading of image on target before a debug session, allowingwest debugto effectively be used as awest attach-after-reset.Also add support of this argument to the
stlink_gdbserverrunner.