Skip to content

Commit 2f223c4

Browse files
committed
[lldb] Fix failure in TestStackCoreScriptedProcess on x86_64
This patch should address the failure of TestStackCoreScriptedProcess that is happening specifically on x86_64. It turns out that in 1370a1c, I changed the way we extract integers from a `StructuredData::Dictionary` and in order to get a stop info from the scripted process, we call a method that returns a `SBStructuredData` containing the stop reason data. TestStackCoreScriptedProcess` was failing specifically on x86_64 because the stop info dictionary contains the signal number, that the `Scripted Thread` was trying to extract as a signed integer where it was actually parsed as an unsigned integer. That caused `GetValueForKeyAsInteger` to return the default value parameter, `LLDB_INVALID_SIGNAL_NUMBER`. This patch address the issue by extracting the signal number with the appropriate type and re-enables the test. Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent fd4e711 commit 2f223c4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lldb/include/lldb/Utility/StructuredData.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ class StructuredData {
484484
}
485485
return success;
486486
}
487+
487488
template <class IntType>
488489
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const {
489490
ObjectSP value_sp = GetValueForKey(key);

lldb/source/Plugins/Process/scripted/ScriptedThread.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,12 @@ bool ScriptedThread::CalculateStopInfo() {
249249
StopInfo::CreateStopReasonWithBreakpointSiteID(*this, break_id);
250250
} break;
251251
case lldb::eStopReasonSignal: {
252-
int signal;
252+
unsigned int signal;
253253
llvm::StringRef description;
254-
data_dict->GetValueForKeyAsInteger("signal", signal,
255-
LLDB_INVALID_SIGNAL_NUMBER);
254+
if (!data_dict->GetValueForKeyAsInteger("signal", signal)) {
255+
signal = LLDB_INVALID_SIGNAL_NUMBER;
256+
return false;
257+
}
256258
data_dict->GetValueForKeyAsString("desc", description);
257259
stop_info_sp =
258260
StopInfo::CreateStopReasonWithSignal(*this, signal, description.data());

0 commit comments

Comments
 (0)