-
Notifications
You must be signed in to change notification settings - Fork 1
[LLDB][GPU] Handle GPUAction errors #9
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -876,7 +876,11 @@ bool ProcessGDBRemote::GPUBreakpointHit(void *baton, | |
| if (bp_sp) | ||
| bp_sp->SetEnabled(false); | ||
| } | ||
| HandleGPUActions(response->actions); | ||
| if (Status err = HandleGPUActions(response->actions); err.Fail()) { | ||
| Debugger::ReportError( | ||
| llvm::formatv("HandleGPUActions failed. Error: {0}\nActions:\n{1}\n", | ||
| err.AsCString(), toJSON(response->actions))); | ||
| } | ||
| } | ||
| return false; // Don't stop, auto continue. | ||
| } | ||
|
|
@@ -1062,8 +1066,13 @@ Status ProcessGDBRemote::ConnectToDebugserver(llvm::StringRef connect_url) { | |
| m_gdb_comm.GetVAttachOrWaitSupported(); | ||
| m_gdb_comm.EnableErrorStringInPacket(); | ||
| if (auto init_actions = m_gdb_comm.GetGPUInitializeActions()) { | ||
| for (const auto &init_action: *init_actions) | ||
| HandleGPUActions(init_action); | ||
| for (const auto &init_action : *init_actions) { | ||
| if (Status err = HandleGPUActions(init_action); err.Fail()) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| Debugger::ReportError(llvm::formatv( | ||
| "HandleGPUActions failed. Error: {0}\nActions:\n{1}\n", | ||
| err.AsCString(), toJSON(init_action))); | ||
| } | ||
| } | ||
| } | ||
| // First dispatch any commands from the platform: | ||
| auto handle_cmds = [&] (const Args &args) -> void { | ||
|
|
@@ -2611,7 +2620,11 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) { | |
| StringExtractorGDBRemote extractor(value); | ||
| if (std::optional<GPUActions> gpu_actions = | ||
| extractor.GetFromJSONHexASCII<GPUActions>()) { | ||
| HandleGPUActions(*gpu_actions); | ||
| if (Status err = HandleGPUActions(*gpu_actions); err.Fail()) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. initializer syntax should be fine on MSCV. That has been around for many years already. |
||
| Debugger::ReportError(llvm::formatv( | ||
| "HandleGPUActions failed. Error: {0}\nActions:\n{1}\n", | ||
| err.AsCString(), toJSON(*gpu_actions))); | ||
| } | ||
| } | ||
| } else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) { | ||
| uint32_t reg = UINT32_MAX; | ||
|
|
||
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.
TIL about "if with initializer syntax" that was added in c++17. Cool feature and keeps the error nicely scoped.
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.
yeah, it's very useful, especially when everything fits in one line
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.
You might consider simplifying this to:
for clarity