Skip to content

Commit 0c5b632

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. Differential Revision: https://reviews.llvm.org/D152848 Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent 63538a0 commit 0c5b632

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
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
@@ -250,10 +250,12 @@ bool ScriptedThread::CalculateStopInfo() {
250250
StopInfo::CreateStopReasonWithBreakpointSiteID(*this, break_id);
251251
} break;
252252
case lldb::eStopReasonSignal: {
253-
int signal;
253+
uint32_t signal;
254254
llvm::StringRef description;
255-
data_dict->GetValueForKeyAsInteger("signal", signal,
256-
LLDB_INVALID_SIGNAL_NUMBER);
255+
if (!data_dict->GetValueForKeyAsInteger("signal", signal)) {
256+
signal = LLDB_INVALID_SIGNAL_NUMBER;
257+
return false;
258+
}
257259
data_dict->GetValueForKeyAsString("desc", description);
258260
stop_info_sp =
259261
StopInfo::CreateStopReasonWithSignal(*this, signal, description.data());

lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def get_module_with_name(self, target, name):
3535
@skipIfOutOfTreeDebugserver
3636
@skipIfRemote
3737
@skipIfAsan # On ASAN builds, this test times-out (rdar://98678134)
38-
@skipIfDarwin
3938
def test_launch_scripted_process_stack_frames(self):
4039
"""Test that we can launch an lldb scripted process from the command
4140
line, check its process ID and read string from memory."""

0 commit comments

Comments
 (0)