aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API/SBThread.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-02-05 19:41:09 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2020-02-05 19:59:38 -0800
commit2f025bb87c33a25e3a0d226cdb663f237ccd602e (patch)
tree0fcb39e09e61df8790ddc762983dca510e88cab4 /lldb/source/API/SBThread.cpp
parent25aa2eef993e17708889abf56ed1ffad5074a9f4 (diff)
downloadllvm-2f025bb87c33a25e3a0d226cdb663f237ccd602e.zip
llvm-2f025bb87c33a25e3a0d226cdb663f237ccd602e.tar.gz
llvm-2f025bb87c33a25e3a0d226cdb663f237ccd602e.tar.bz2
[lldb/Reproducers] Implement custom replayers for (char *, size_t)
Some SB API methods returns strings through a char* and a length. This is a problem for the deserializer, which considers a single type at a time, and therefore cannot know how many bytes to allocate for the character buffer. We can solve this problem by implementing a custom replayer, which ignores the passed-in char* and allocates a buffer of the correct size itself, before invoking the original API method or function. This patch adds three new macros to register a custom replayer for methods that take a char* and a size_t. It supports arbitrary return values (some functions return a bool while others return a size_t).
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
-rw-r--r--lldb/source/API/SBThread.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 6fe4f66..ff1a428 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_DUMMY(size_t, SBThread, GetStopDescription, (char *, size_t),
+ LLDB_RECORD_METHOD(size_t, SBThread, GetStopDescription, (char *, size_t),
dst, dst_len);
std::unique_lock<std::recursive_mutex> lock;
@@ -1444,8 +1444,6 @@ void RegisterMethods<SBThread>(Registry &R) {
LLDB_REGISTER_METHOD(lldb::SBThreadCollection, SBThread,
GetStopReasonExtendedBacktraces,
(lldb::InstrumentationRuntimeType));
- LLDB_REGISTER_METHOD(size_t, SBThread, GetStopDescription,
- (char *, size_t));
LLDB_REGISTER_METHOD(lldb::SBValue, SBThread, GetStopReturnValue, ());
LLDB_REGISTER_METHOD_CONST(lldb::tid_t, SBThread, GetThreadID, ());
LLDB_REGISTER_METHOD_CONST(uint32_t, SBThread, GetIndexID, ());
@@ -1522,6 +1520,7 @@ void RegisterMethods<SBThread>(Registry &R) {
LLDB_REGISTER_METHOD(lldb::SBThread, SBThread, GetCurrentExceptionBacktrace,
());
LLDB_REGISTER_METHOD(bool, SBThread, SafeToCallFunctions, ());
+ LLDB_REGISTER_CHAR_PTR_REDIRECT(size_t, SBThread, GetStopDescription);
}
}