1 // This header is included in all the test programs (C and C++) and provides a
2 // hook for dealing with platform-specifics.
4 #if defined(_WIN32) || defined(_WIN64)
5 #define LLDB_DYLIB_EXPORT __declspec(dllexport)
6 #define LLDB_DYLIB_IMPORT __declspec(dllimport)
8 #define LLDB_DYLIB_EXPORT
9 #define LLDB_DYLIB_IMPORT
12 #ifdef COMPILING_LLDB_TEST_DLL
13 #define LLDB_TEST_API LLDB_DYLIB_EXPORT
15 #define LLDB_TEST_API LLDB_DYLIB_IMPORT
19 #define LLVM_PRETTY_FUNCTION __FUNCSIG__
21 #define LLVM_PRETTY_FUNCTION LLVM_PRETTY_FUNCTION
25 // On some systems (e.g., some versions of linux) it is not possible to attach to a process
26 // without it giving us special permissions. This defines the lldb_enable_attach macro, which
27 // should perform any such actions, if needed by the platform. This is a macro instead of a
28 // function to avoid the need for complex linking of the test programs.
29 #if defined(__linux__)
30 #include <sys/prctl.h>
32 // Android API <= 16 does not have these defined.
33 #ifndef PR_SET_PTRACER
34 #define PR_SET_PTRACER 0x59616d61
36 #ifndef PR_SET_PTRACER_ANY
37 #define PR_SET_PTRACER_ANY ((unsigned long)-1)
40 // For now we execute on best effort basis. If this fails for some reason, so be it.
41 #define lldb_enable_attach() \
44 const int prctl_result = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); \
50 #define lldb_enable_attach()