mib created this revision.
mib added reviewers: bulbazord, jingham, JDevlieghere.
mib added a project: LLDB.
Herald added a subscriber: pengfei.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.
This patch should address the failure of TestStackCoreScriptedProcess
that is happening specifically on x86_64.
It turns out that in 1370a1cb5b97
<https://reviews.llvm.org/rG1370a1cb5b97ecfc4fd2cb550159db9c9ebd3a68>, 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]>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152848
Files:
lldb/include/lldb/Utility/StructuredData.h
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
Index: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
===================================================================
--- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -250,10 +250,12 @@
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());
Index: lldb/include/lldb/Utility/StructuredData.h
===================================================================
--- lldb/include/lldb/Utility/StructuredData.h
+++ lldb/include/lldb/Utility/StructuredData.h
@@ -484,6 +484,7 @@
}
return success;
}
+
template <class IntType>
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const {
ObjectSP value_sp = GetValueForKey(key);
Index: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
===================================================================
--- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -250,10 +250,12 @@
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());
Index: lldb/include/lldb/Utility/StructuredData.h
===================================================================
--- lldb/include/lldb/Utility/StructuredData.h
+++ lldb/include/lldb/Utility/StructuredData.h
@@ -484,6 +484,7 @@
}
return success;
}
+
template <class IntType>
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const {
ObjectSP value_sp = GetValueForKey(key);
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits