aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API/SBModule.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-06-12 15:12:55 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2020-06-12 15:17:44 -0700
commitda601ea731ece45d8e4d283942f90dce5b2d386a (patch)
tree5207d8b05fed86c530bd6ec00a472cdb7875f6e2 /lldb/source/API/SBModule.cpp
parentbb2f6f66c7f3189a3f9d2ea22ed9be6a3b8f5458 (diff)
downloadllvm-da601ea731ece45d8e4d283942f90dce5b2d386a.zip
llvm-da601ea731ece45d8e4d283942f90dce5b2d386a.tar.gz
llvm-da601ea731ece45d8e4d283942f90dce5b2d386a.tar.bz2
[lldb/Test] Assert that no targets or modules remain after a test completes.
The reproducer intentionally leak every object allocated during replay, which means that modules never get orphaned. If this were to happen for another reason, we might not be testing what we think we are. Assert that there are no targets left at the end of a test and that the global module cache is empty in the non-reproducer scenario. Differential revision: https://reviews.llvm.org/D81612
Diffstat (limited to 'lldb/source/API/SBModule.cpp')
-rw-r--r--lldb/source/API/SBModule.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index 0811a3a..c30529b 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -683,6 +683,13 @@ lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const {
return LLDB_RECORD_RESULT(sb_addr);
}
+uint32_t SBModule::GetNumberAllocatedModules() {
+ LLDB_RECORD_STATIC_METHOD_NO_ARGS(uint32_t, SBModule,
+ GetNumberAllocatedModules);
+
+ return Module::GetNumberAllocatedModules();
+}
+
namespace lldb_private {
namespace repro {
@@ -757,6 +764,8 @@ void RegisterMethods<SBModule>(Registry &R) {
GetObjectFileHeaderAddress, ());
LLDB_REGISTER_METHOD_CONST(lldb::SBAddress, SBModule,
GetObjectFileEntryPointAddress, ());
+ LLDB_REGISTER_STATIC_METHOD(uint32_t, SBModule, GetNumberAllocatedModules,
+ ());
}
}