[Lldb-commits] [lldb] r107501 - in /lldb/trunk/source/Host/linux: ./ Host.cpp Symbols.cpp TimeValue.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Jul 2 12:28:45 PDT 2010
Author: efriedma
Date: Fri Jul 2 14:28:44 2010
New Revision: 107501
URL: http://llvm.org/viewvc/llvm-project?rev=107501&view=rev
Log:
Add hacky, incomplete Linux host implementation; barely enough to allow
compiling lldb. Someone else might try to improve it, though. :)
Added:
lldb/trunk/source/Host/linux/
lldb/trunk/source/Host/linux/Host.cpp
- copied, changed from r105721, lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Host/linux/Symbols.cpp
lldb/trunk/source/Host/linux/TimeValue.cpp
- copied unchanged from r105814, lldb/trunk/source/Host/macosx/TimeValue.cpp
Copied: lldb/trunk/source/Host/linux/Host.cpp (from r105721, lldb/trunk/source/Host/macosx/Host.mm)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/Host.cpp?p2=lldb/trunk/source/Host/linux/Host.cpp&p1=lldb/trunk/source/Host/macosx/Host.mm&r1=105721&r2=107501&rev=107501&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/linux/Host.cpp Fri Jul 2 14:28:44 2010
@@ -9,24 +9,16 @@
#include <dlfcn.h>
#include <libgen.h>
-#include <mach/mach.h>
-#include <mach-o/dyld.h>
#include <signal.h>
#include <stddef.h>
#include <sys/sysctl.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include <map>
#include <string>
-#include <objc/objc-auto.h>
-
-#include <Foundation/Foundation.h>
-
-#include "CFCBundle.h"
-#include "CFCReleaser.h"
-#include "CFCString.h"
-
#include "lldb/Host/Host.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ConstString.h"
@@ -82,7 +74,7 @@
lldb::pid_t
Host::GetCurrentThreadID()
{
- return ::mach_thread_self();
+ return pthread_self();
}
@@ -90,6 +82,7 @@
Host::GetArchitecture ()
{
static ArchSpec g_host_arch;
+#if 0
if (!g_host_arch.IsValid())
{
uint32_t cputype, cpusubtype;
@@ -114,6 +107,9 @@
}
}
}
+#else
+ g_host_arch.SetArch(7u, 144u);
+#endif
return g_host_arch;
}
@@ -123,10 +119,14 @@
static ConstString g_vendor;
if (!g_vendor)
{
+#if 0
char ostype[64];
size_t len = sizeof(ostype);
if (::sysctlbyname("kern.ostype", &ostype, &len, NULL, 0) == 0)
g_vendor.SetCString (ostype);
+#else
+ g_vendor.SetCString("gnu");
+#endif
}
return g_vendor;
}
@@ -134,7 +134,7 @@
const ConstString &
Host::GetOSString()
{
- static ConstString g_os_string("apple");
+ static ConstString g_os_string("linux");
return g_os_string;
}
@@ -160,60 +160,16 @@
return g_host_triple;
}
-class MacOSXDarwinThread
-{
-public:
- MacOSXDarwinThread(const char *thread_name) :
- m_pool (nil)
- {
- // Register our thread with the collector if garbage collection is enabled.
- if (objc_collectingEnabled())
- {
-#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
- // On Leopard and earlier there is no way objc_registerThreadWithCollector
- // function, so we do it manually.
- auto_zone_register_thread(auto_zone());
-#else
- // On SnowLoepard and later we just call the thread registration function.
- objc_registerThreadWithCollector();
-#endif
- }
- else
- {
- m_pool = [[NSAutoreleasePool alloc] init];
- }
-
-
- Host::SetThreadName (LLDB_INVALID_PROCESS_ID, LLDB_INVALID_THREAD_ID, thread_name);
- }
-
- ~MacOSXDarwinThread()
- {
- if (m_pool)
- [m_pool release];
- }
-
- static void PThreadDestructor (void *v)
- {
- delete (MacOSXDarwinThread*)v;
- }
-
-protected:
- NSAutoreleasePool * m_pool;
-private:
- DISALLOW_COPY_AND_ASSIGN (MacOSXDarwinThread);
-};
-
static pthread_once_t g_thread_create_once = PTHREAD_ONCE_INIT;
static pthread_key_t g_thread_create_key = 0;
static void
InitThreadCreated()
{
- ::pthread_key_create (&g_thread_create_key, MacOSXDarwinThread::PThreadDestructor);
+ ::pthread_key_create (&g_thread_create_key, 0);
}
-typedef struct HostThreadCreateInfo
+struct HostThreadCreateInfo
{
std::string thread_name;
thread_func_t thread_fptr;
@@ -305,7 +261,7 @@
::pthread_once (&g_thread_create_once, InitThreadCreated);
if (g_thread_create_key)
{
- ::pthread_setspecific (g_thread_create_key, new MacOSXDarwinThread(thread_name));
+ //::pthread_setspecific (g_thread_create_key, new MacOSXDarwinThread(thread_name));
}
}
@@ -446,6 +402,7 @@
static FileSpec g_program_filepsec;
if (!g_program_filepsec)
{
+#if 0
std::string program_fullpath;
program_fullpath.resize (PATH_MAX);
// If DST is NULL, then return the number of bytes needed.
@@ -461,6 +418,7 @@
}
if (err == 0)
g_program_filepsec.SetFile(program_fullpath.data());
+#endif
}
return g_program_filepsec;
}
@@ -483,6 +441,7 @@
bool
Host::ResolveExecutableInBundle (FileSpec *file)
{
+#if 0
if (file->GetFileType () == FileSpec::eFileTypeDirectory)
{
char path[PATH_MAX];
@@ -500,10 +459,11 @@
}
}
}
+#endif
return false;
}
-typedef struct MonitorInfo
+struct MonitorInfo
{
int handle;
pthread_t thread;
@@ -554,7 +514,7 @@
Mutex::Locker locker(&g_monitor_map_mutex);
if (!g_monitor_thread)
{
- pid_t wait_pid = -1;
+ ::pid_t wait_pid = -1;
g_monitor_thread = ThreadCreate ("<lldb.host.wait4>",
MonitorChildProcessThreadFunction,
&wait_pid,
@@ -640,7 +600,7 @@
if (log)
log->Printf ("%s (arg = %p) thread starting...", function, arg);
- const pid_t wait_pid = -1;//*((pid_t*)arg);
+ const ::pid_t wait_pid = -1;//*((pid_t*)arg);
int status = -1;
const int options = 0;
struct rusage *rusage = NULL;
@@ -722,7 +682,7 @@
}
else
{
- status_cstr = "(???)";
+ status_cstr = "(???"")";
}
if (log)
Added: lldb/trunk/source/Host/linux/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/Symbols.cpp?rev=107501&view=auto
==============================================================================
--- lldb/trunk/source/Host/linux/Symbols.cpp (added)
+++ lldb/trunk/source/Host/linux/Symbols.cpp Fri Jul 2 14:28:44 2010
@@ -0,0 +1,27 @@
+//===-- Symbols.cpp ---------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/Symbols.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+FileSpec
+Symbols::LocateExecutableObjectFile (const FileSpec *exec_fspec, const ArchSpec* arch, const UUID *uuid)
+{
+ // FIXME: Proper impliementation?
+ return FileSpec();
+}
+
+FileSpec
+Symbols::LocateExecutableSymbolFile (const FileSpec *exec_fspec, const ArchSpec* arch, const UUID *uuid)
+{
+ // FIXME: Proper impliementation?
+ return FileSpec();
+}
More information about the lldb-commits
mailing list