summaryrefslogtreecommitdiffstats
path: root/vespamalloc/src/tests/stacktrace
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-06-28 11:21:20 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-06-28 11:21:20 +0000
commit78153ab3b636f1b0642590cfd296ed8e19415c88 (patch)
treea2f69801527086e04b3d4b4eada7f7c64671853c /vespamalloc/src/tests/stacktrace
parent21f1ed5bceb790564918ccb010d60fd85a87497c (diff)
Expose a way to access vespamalloc internals.
Diffstat (limited to 'vespamalloc/src/tests/stacktrace')
-rw-r--r--vespamalloc/src/tests/stacktrace/stacktrace.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/vespamalloc/src/tests/stacktrace/stacktrace.cpp b/vespamalloc/src/tests/stacktrace/stacktrace.cpp
index d13fb6bb59b..e7c53fa5c3f 100644
--- a/vespamalloc/src/tests/stacktrace/stacktrace.cpp
+++ b/vespamalloc/src/tests/stacktrace/stacktrace.cpp
@@ -1,7 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdlib.h>
-#include <stdio.h>
+#include <cstdlib>
+#include <cstdio>
#include <pthread.h>
+#include <dlfcn.h>
+#include <cassert>
void * run(void * arg)
{
@@ -10,7 +12,11 @@ void * run(void * arg)
char * b = new char [1]; // but b should as it not deleted.
(void) b;
delete [] a;
- return NULL;
+ return nullptr;
+}
+
+void verify_that_vespamalloc_datasegment_size_exists() {
+ assert(dlsym(RTLD_NEXT, "vespamalloc_datasegment_size") != nullptr);
}
int main(int argc, char *argv[])
@@ -22,14 +28,16 @@ int main(int argc, char *argv[])
(void) b;
delete [] a;
pthread_t tid;
- int retval = pthread_create(&tid, NULL, run, NULL);
+ int retval = pthread_create(&tid, nullptr, run, nullptr);
if (retval != 0) {
perror("pthread_create failed");
abort();
}
- retval = pthread_join(tid, NULL);
+ retval = pthread_join(tid, nullptr);
if (retval != 0) {
perror("pthread_join failed");
abort();
}
+
+ verify_that_vespamalloc_datasegment_size_exists();
}