[Lldb-commits] [lldb] 4177b49 - [lldb] Fix failure in TestStackCoreScriptedProcess on x86_64
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 13 13:45:20 PDT 2023
Author: Med Ismail Bennani
Date: 2023-06-13T13:44:51-07:00
New Revision: 4177b490358432a457935ba5d6d076ae60de588f
URL: https://github.com/llvm/llvm-project/commit/4177b490358432a457935ba5d6d076ae60de588f
DIFF: https://github.com/llvm/llvm-project/commit/4177b490358432a457935ba5d6d076ae60de588f.diff
LOG: [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 1370a1cb5b97, 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 <ismail at bennani.ma>
Added:
Modified:
lldb/include/lldb/Utility/StructuredData.h
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
Removed:
################################################################################
diff --git a/lldb/include/lldb/Utility/StructuredData.h b/lldb/include/lldb/Utility/StructuredData.h
index d6b51f7c58c12..a9df052605478 100644
--- a/lldb/include/lldb/Utility/StructuredData.h
+++ b/lldb/include/lldb/Utility/StructuredData.h
@@ -484,6 +484,7 @@ class StructuredData {
}
return success;
}
+
template <class IntType>
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const {
ObjectSP value_sp = GetValueForKey(key);
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
index ac707ffb21711..920c66f153ba4 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -250,10 +250,12 @@ bool ScriptedThread::CalculateStopInfo() {
StopInfo::CreateStopReasonWithBreakpointSiteID(*this, break_id);
} break;
case lldb::eStopReasonSignal: {
- int signal;
+ unsigned int signal;
llvm::StringRef description;
- data_dict->GetValueForKeyAsInteger("signal", signal,
- LLDB_INVALID_SIGNAL_NUMBER);
+ if (!data_dict->GetValueForKeyAsInteger("signal", signal)) {
+ signal = LLDB_INVALID_SIGNAL_NUMBER;
+ return false;
+ }
data_dict->GetValueForKeyAsString("desc", description);
stop_info_sp =
StopInfo::CreateStopReasonWithSignal(*this, signal, description.data());
diff --git a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
index bf9681ad678b6..28f8630ba8611 100644
--- a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
@@ -35,7 +35,6 @@ def get_module_with_name(self, target, name):
@skipIfOutOfTreeDebugserver
@skipIfRemote
@skipIfAsan # On ASAN builds, this test times-out (rdar://98678134)
- @skipIfDarwin
def test_launch_scripted_process_stack_frames(self):
"""Test that we can launch an lldb scripted process from the command
line, check its process ID and read string from memory."""
More information about the lldb-commits
mailing list