[Lldb-commits] [lldb] 58c4fa2 - [lldb/Reproducers] Use LLDB_RECORD_DUMMY for GetStopDescription
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 30 15:52:59 PST 2020
Author: Jonas Devlieghere
Date: 2020-01-30T15:40:58-08:00
New Revision: 58c4fa2c538a73527aeeb4c7535016d9b9a1df18
URL: https://github.com/llvm/llvm-project/commit/58c4fa2c538a73527aeeb4c7535016d9b9a1df18
DIFF: https://github.com/llvm/llvm-project/commit/58c4fa2c538a73527aeeb4c7535016d9b9a1df18.diff
LOG: [lldb/Reproducers] Use LLDB_RECORD_DUMMY for GetStopDescription
GetStopDescription writes to a const char* with a given length. However,
the reproducer instrumentation serialized the char pointer and length
separately.
To serialize the string, we naively look for the first null byte to
determine its length. This can lead to the method overwriting the input
buffer when the assumed string length is smaller than the actual number
of bytes written by GetStopDescription.
The real solution is to have a custom serializer that takes both
arguments into account. However, given that these are output parameters,
they don't affect replay. If the string is passed as input later, it's
is recorded as such. Therefore I've replaced the instrumentation macro
with LLDB_RECORD_DUMMY which skips the serialization.
Added:
Modified:
lldb/source/API/SBThread.cpp
Removed:
################################################################################
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index f90e93130960..6fe4f66763cb 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -313,7 +313,7 @@ SBThread::GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type) {
}
size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
- LLDB_RECORD_METHOD(size_t, SBThread, GetStopDescription, (char *, size_t),
+ LLDB_RECORD_DUMMY(size_t, SBThread, GetStopDescription, (char *, size_t),
dst, dst_len);
std::unique_lock<std::recursive_mutex> lock;
More information about the lldb-commits
mailing list