-
Notifications
You must be signed in to change notification settings - Fork 1
GPUActions are ignored on first stop-reply packet fix #46
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
base: llvm-server-plugins
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -916,10 +916,14 @@ lldb::pid_t GDBRemoteCommunicationClient::GetCurrentProcessID(bool allow_lazy) { | |
return LLDB_INVALID_PROCESS_ID; | ||
} | ||
|
||
llvm::Error GDBRemoteCommunicationClient::LaunchProcess(const Args &args) { | ||
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. We might want to change the return value to:
Then we don't need to pass the |
||
llvm::Expected<StringExtractorGDBRemote> | ||
GDBRemoteCommunicationClient::LaunchProcess(const Args &args) { | ||
if (!args.GetArgumentAtIndex(0)) | ||
return llvm::createStringError(llvm::inconvertibleErrorCode(), | ||
"Nothing to launch"); | ||
|
||
StringExtractorGDBRemote response; | ||
|
||
// try vRun first | ||
if (m_supports_vRun) { | ||
StreamString packet; | ||
|
@@ -929,7 +933,6 @@ llvm::Error GDBRemoteCommunicationClient::LaunchProcess(const Args &args) { | |
packet.PutStringAsRawHex8(arg.ref()); | ||
} | ||
|
||
StringExtractorGDBRemote response; | ||
if (SendPacketAndWaitForResponse(packet.GetString(), response) != | ||
PacketResult::Success) | ||
return llvm::createStringError(llvm::inconvertibleErrorCode(), | ||
|
@@ -942,7 +945,7 @@ llvm::Error GDBRemoteCommunicationClient::LaunchProcess(const Args &args) { | |
// FIXME: right now we just discard the packet and LLDB queries | ||
// for stop reason again | ||
if (!response.IsUnsupportedResponse()) | ||
return llvm::Error::success(); | ||
return response; | ||
|
||
m_supports_vRun = false; | ||
} | ||
|
@@ -957,7 +960,6 @@ llvm::Error GDBRemoteCommunicationClient::LaunchProcess(const Args &args) { | |
packet.PutStringAsRawHex8(arg.value().ref()); | ||
} | ||
|
||
StringExtractorGDBRemote response; | ||
if (SendPacketAndWaitForResponse(packet.GetString(), response) != | ||
PacketResult::Success) { | ||
return llvm::createStringError(llvm::inconvertibleErrorCode(), | ||
|
@@ -972,7 +974,7 @@ llvm::Error GDBRemoteCommunicationClient::LaunchProcess(const Args &args) { | |
"Sending qLaunchSuccess packet failed"); | ||
} | ||
if (response.IsOKResponse()) | ||
return llvm::Error::success(); | ||
return response; | ||
if (response.GetChar() == 'E') { | ||
return llvm::createStringError(llvm::inconvertibleErrorCode(), | ||
response.GetStringRef().substr(1)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -496,6 +496,27 @@ bool StringExtractorGDBRemote::IsErrorResponse() const { | |
isxdigit(m_packet[2]); | ||
} | ||
|
||
bool StringExtractorGDBRemote::IsStopReply( | ||
uint32_t mask = StopReplyMask::Any) const { | ||
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. Default values need to go on the declaration not the definition. |
||
if (!IsNormalResponse()) | ||
return false; | ||
|
||
char first_char = m_packet.empty() ? '\0' : m_packet[0]; | ||
if (mask & Signal && (first_char == 'T' || first_char == 'S')) | ||
return true; | ||
if (mask & Exited && (first_char == 'w' || first_char == 'W')) | ||
return true; | ||
if (mask & Terminated && first_char == 'X') | ||
return true; | ||
if (mask & Output && first_char == 'O') | ||
return true; | ||
if (mask & NoResumed && first_char == 'N') | ||
return true; | ||
if (mask & Syscall && first_char == 'F') | ||
return true; | ||
return false; | ||
} | ||
|
||
uint8_t StringExtractorGDBRemote::GetError() { | ||
if (GetResponseType() == eError) { | ||
SetFilePos(1); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,11 +25,12 @@ using namespace lldb_private::lldb_server; | |
using namespace lldb_private::process_gdb_remote; | ||
|
||
enum { | ||
BreakpointIDInitialize = 1, | ||
BreakpointIDShlibLoad = 2, | ||
BreakpointIDThirdStop = 3, | ||
BreakpointIDResumeAndWaitForResume = 4, | ||
BreakpointIDWaitForStop = 5 | ||
BreakpointIDFirstStop = 1, | ||
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. Is it expected that we added a new 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. My bad. We don't really use it for our testing by as you mentioned below, I accidentally used BreakpointIDThirdStop rather than BreakpointIDFirstStop. |
||
BreakpointIDInitialize = 2, | ||
BreakpointIDShlibLoad = 3, | ||
BreakpointIDThirdStop = 4, | ||
BreakpointIDResumeAndWaitForResume = 5, | ||
BreakpointIDWaitForStop = 6 | ||
}; | ||
|
||
LLDBServerPluginMockGPU::LLDBServerPluginMockGPU( | ||
|
@@ -152,6 +153,18 @@ std::optional<GPUPluginConnectionInfo> LLDBServerPluginMockGPU::CreateConnection | |
|
||
std::optional<GPUActions> LLDBServerPluginMockGPU::NativeProcessIsStopping() { | ||
NativeProcessProtocol *native_process = m_native_process.GetCurrentProcess(); | ||
static bool first_time = true; | ||
Log *log = GetLog(GDBRLog::Plugin); | ||
LLDB_LOGF(log, "%d stop id ", native_process->GetStopID()); | ||
if (first_time) { | ||
first_time = false; | ||
GPUActions actions = GetNewGPUAction(); | ||
GPUBreakpointInfo bp; | ||
bp.identifier = BreakpointIDFirstStop; | ||
bp.name_info = {"a.out", "gpu_first_stop"}; | ||
actions.breakpoints.emplace_back(std::move(bp)); | ||
return actions; | ||
} | ||
// Show that we can return a valid GPUActions object from a stop event. | ||
if (native_process->GetStopID() == 3) { | ||
GPUActions actions = GetNewGPUAction(); | ||
|
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.
We don't need this overload (and it is not implemented). Just specify the default value in the declaration below.