Currently the 'memory write' command allows specifying the values when
writing the file contents to memory but the values are actually ignored. This
patch fixes that by erroring out when values are specified in such cases.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/source/Interpreter/CommandObject.cpp | ||
---|---|---|
457 | (like I said on the other diff) What does it mean for an arg_entry to be empty? (please add the answer as a comment in the code as well) I think this is avoiding trying to index [0] on an empty arg lower down: } else { StreamString names; for (int j = 0; j < num_alternatives; ++j) { if (j > 0) names.Printf(" | "); names.Printf("%s", GetArgumentName(arg_entry[j].arg_type)); } std::string name_str = std::string(names.GetString()); switch (arg_entry[0].arg_repetition) { Which is fine but I'm not sure if arg_entry being empty is unusual enough to prefer an assert rather than skipping over it. | |
lldb/test/API/commands/memory/write/TestMemoryWrite.py | ||
2 | I wasn't expecting such thorough tests, this is great! | |
50 | You don't need to add these comments. The output is clear enough from the expect parameters. | |
58 | I think error=False is the default so you can leave it out here. We tend to add error=True for the few times we want a failure. | |
82 | So here I'd remove the comment and add "error: " to the start of the substr. | |
95 | Again this is the default, the vast majority of the time we want a match so we only call out the few where we don't. | |
97 | You could skip this line. Small thing but we're not testing the general usage printing infrastructure here just the specifics in the following 2 lines. | |
lldb/test/API/commands/memory/write/main.cpp | ||
1 ↗ | (On Diff #389533) | Trivial thing, but this file has no need to be .cpp since it's plain c. |
Thanks for the comments.
I wasn't familiar with the Pyhton test infrastructure so I took the files from commands/memory/read and updated as needed here. All the comments etc came from that.
I think I addressed all the feedback.
All the comments etc came from that.
Yeah it's a bit of a judgement call so it's a safe bet to add them and see what review thinks. I know for sure there are plenty of tests with way more cryptic expectations that don't have comments :)
This LGTM.
lldb/test/API/commands/memory/write/Makefile | ||
---|---|---|
3 | I was gonna say you can drop this but I see a few other tests with it, and it won't harm anything. |
(like I said on the other diff)
What does it mean for an arg_entry to be empty? (please add the answer as a comment in the code as well)
I think this is avoiding trying to index [0] on an empty arg lower down:
Which is fine but I'm not sure if arg_entry being empty is unusual enough to prefer an assert rather than skipping over it.