Summary: This adds platform code without the cmake/gmake glue to the existing infrastructure. The missing and incompatibility ptrace(2) bits (existing in FreeBSD) are under active research and development and will be submitted once verified to work. This code was tested to build and run on NetBSD-current/amd64. Proper build scripts will be integrated separately as a new commit. Reviewers: joerg Subscribers: tfiala, brucem, labath, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D13334 llvm-svn: 250146
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
//===-- HostThreadNetBSD.cpp -----------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// lldb Includes
|
|
#include "lldb/Host/netbsd/HostThreadNetBSD.h"
|
|
#include "lldb/Host/Host.h"
|
|
|
|
// C includes
|
|
#include <errno.h>
|
|
#include <pthread.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/sysctl.h>
|
|
#include <sys/user.h>
|
|
|
|
// C++ includes
|
|
#include <string>
|
|
|
|
using namespace lldb_private;
|
|
|
|
HostThreadNetBSD::HostThreadNetBSD()
|
|
{
|
|
}
|
|
|
|
HostThreadNetBSD::HostThreadNetBSD(lldb::thread_t thread)
|
|
: HostThreadPosix(thread)
|
|
{
|
|
}
|
|
|
|
void
|
|
HostThreadNetBSD::SetName(lldb::thread_t thread, llvm::StringRef &name)
|
|
{
|
|
::pthread_setname_np(thread, "%s", const_cast<char*>(name.data()));
|
|
}
|
|
|
|
void
|
|
HostThreadNetBSD::GetName(lldb::thread_t thread, llvm::SmallVectorImpl<char> &name)
|
|
{
|
|
char buf[PTHREAD_MAX_NAMELEN_NP];
|
|
::pthread_getname_np(thread, buf, PTHREAD_MAX_NAMELEN_NP);
|
|
|
|
name.clear();
|
|
name.append(buf, buf + strlen(buf));
|
|
}
|