Index: contrib/llvm/tools/lldb/include/lldb/Host/freebsd/Config.h =================================================================== --- contrib/llvm/tools/lldb/include/lldb/Host/freebsd/Config.h +++ contrib/llvm/tools/lldb/include/lldb/Host/freebsd/Config.h @@ -17,6 +17,8 @@ #ifndef liblldb_Platform_Config_h_ #define liblldb_Platform_Config_h_ +#include // for __FreeBSD_version + #define LLDB_CONFIG_TERMIOS_SUPPORTED 1 #define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 @@ -25,4 +27,10 @@ //#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 +#if (__FreeBSD_version >= 1200018 ) || \ + (__FreeBSD_version >= 1100507 && __FreeBSD_version < 1200000) || \ + (__FreeBSD_version >= 1003511 && __FreeBSD_version < 1100000) +#define LLDB_CONFIG_MORE_THREAD_NAME_PRESENT 1 +#endif + #endif // #ifndef liblldb_Platform_Config_h_ Index: contrib/llvm/tools/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp =================================================================== --- contrib/llvm/tools/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp +++ contrib/llvm/tools/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp @@ -8,16 +8,28 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/freebsd/HostInfoFreeBSD.h" +#include "lldb/Host/freebsd/Config.h" #include #include #include #include +#include #include using namespace lldb_private; -uint32_t HostInfoFreeBSD::GetMaxThreadNameLength() { return 16; } +uint32_t HostInfoFreeBSD::GetMaxThreadNameLength() { + struct kinfo_proc *kp = nullptr; + size_t len; + + len = sizeof(kp->ki_tdname) - 1; +#ifdef LLDB_CONFIG_MORE_THREAD_NAME_PRESENT + len += sizeof(kp->ki_moretdname) - 1; +#endif + + return (static_cast(len)); +} bool HostInfoFreeBSD::GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update) { @@ -74,4 +86,4 @@ } } return g_program_filespec; -} \ No newline at end of file +} Index: contrib/llvm/tools/lldb/source/Host/freebsd/HostThreadFreeBSD.cpp =================================================================== --- contrib/llvm/tools/lldb/source/Host/freebsd/HostThreadFreeBSD.cpp +++ contrib/llvm/tools/lldb/source/Host/freebsd/HostThreadFreeBSD.cpp @@ -9,15 +9,13 @@ // lldb Includes #include "lldb/Host/freebsd/HostThreadFreeBSD.h" +#include "lldb/Host/freebsd/Config.h" #include "lldb/Host/Host.h" // C includes #include -#include -#if defined(__FreeBSD__) -#include -#endif #include +#include #include #include @@ -63,6 +61,10 @@ for (size_t i = 0; i < len / sizeof(*kp); i++) { if (kp[i].ki_tid == (lwpid_t)tid) { name.append(kp[i].ki_tdname, kp[i].ki_tdname + strlen(kp[i].ki_tdname)); +#ifdef LLDB_CONFIG_MORE_THREAD_NAME_PRESENT + name.append(kp[i].ki_moretdname, + kp[i].ki_moretdname + strlen(kp[i].ki_moretdname)); +#endif break; } }