This revision was automatically updated to reflect the committed changes. Closed by commit rGb945b62cf35e: [lldb] Add a function to check if lldb is running in an interactive session (authored by JDevlieghere). Herald added a project: LLDB.
Changed prior to commit: https://reviews.llvm.org/D124872?vs=426822&id=426857#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124872/new/ https://reviews.llvm.org/D124872 Files: lldb/include/lldb/Host/Host.h lldb/source/Host/common/Host.cpp lldb/source/Host/macosx/objcxx/Host.mm Index: lldb/source/Host/macosx/objcxx/Host.mm =================================================================== --- lldb/source/Host/macosx/objcxx/Host.mm +++ lldb/source/Host/macosx/objcxx/Host.mm @@ -32,6 +32,8 @@ #define LauncherXPCServiceErrorTypeKey "errorType" #define LauncherXPCServiceCodeTypeKey "errorCode" +#include <bsm/audit.h> +#include <bsm/audit_session.h> #endif #include "llvm/Support/Host.h" @@ -406,6 +408,16 @@ #endif // TARGET_OS_OSX } +bool Host::IsInteractiveGraphicSession() { +#if !TARGET_OS_OSX + return false; +#else + auditinfo_addr_t info; + getaudit_addr(&info, sizeof(info)); + return info.ai_flags & AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS; +#endif +} + Environment Host::GetEnvironment() { return Environment(*_NSGetEnviron()); } static bool GetMacOSXProcessCPUType(ProcessInstanceInfo &process_info) { Index: lldb/source/Host/common/Host.cpp =================================================================== --- lldb/source/Host/common/Host.cpp +++ lldb/source/Host/common/Host.cpp @@ -575,6 +575,7 @@ return false; } +bool Host::IsInteractiveGraphicSession() { return false; } #endif std::unique_ptr<Connection> Host::CreateDefaultConnection(llvm::StringRef url) { Index: lldb/include/lldb/Host/Host.h =================================================================== --- lldb/include/lldb/Host/Host.h +++ lldb/include/lldb/Host/Host.h @@ -242,6 +242,13 @@ static bool OpenFileInExternalEditor(const FileSpec &file_spec, uint32_t line_no); + /// Check if we're running in an interactive graphical session. + /// + /// \return + /// True if we're running in an interactive graphical session. False if + /// we're not or don't know. + static bool IsInteractiveGraphicSession(); + static Environment GetEnvironment(); static std::unique_ptr<Connection>
Index: lldb/source/Host/macosx/objcxx/Host.mm =================================================================== --- lldb/source/Host/macosx/objcxx/Host.mm +++ lldb/source/Host/macosx/objcxx/Host.mm @@ -32,6 +32,8 @@ #define LauncherXPCServiceErrorTypeKey "errorType" #define LauncherXPCServiceCodeTypeKey "errorCode" +#include <bsm/audit.h> +#include <bsm/audit_session.h> #endif #include "llvm/Support/Host.h" @@ -406,6 +408,16 @@ #endif // TARGET_OS_OSX } +bool Host::IsInteractiveGraphicSession() { +#if !TARGET_OS_OSX + return false; +#else + auditinfo_addr_t info; + getaudit_addr(&info, sizeof(info)); + return info.ai_flags & AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS; +#endif +} + Environment Host::GetEnvironment() { return Environment(*_NSGetEnviron()); } static bool GetMacOSXProcessCPUType(ProcessInstanceInfo &process_info) { Index: lldb/source/Host/common/Host.cpp =================================================================== --- lldb/source/Host/common/Host.cpp +++ lldb/source/Host/common/Host.cpp @@ -575,6 +575,7 @@ return false; } +bool Host::IsInteractiveGraphicSession() { return false; } #endif std::unique_ptr<Connection> Host::CreateDefaultConnection(llvm::StringRef url) { Index: lldb/include/lldb/Host/Host.h =================================================================== --- lldb/include/lldb/Host/Host.h +++ lldb/include/lldb/Host/Host.h @@ -242,6 +242,13 @@ static bool OpenFileInExternalEditor(const FileSpec &file_spec, uint32_t line_no); + /// Check if we're running in an interactive graphical session. + /// + /// \return + /// True if we're running in an interactive graphical session. False if + /// we're not or don't know. + static bool IsInteractiveGraphicSession(); + static Environment GetEnvironment(); static std::unique_ptr<Connection>
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits