[lldb-dev] lldb patches for FreeBSD

Amit Kulkarni amitkulz at gmail.com
Thu May 12 15:00:28 PDT 2011


Hi,

I installed FreeBSD 8.2 amd64 and trying to see how far lldb compiles,
seeing as OpenBSD lacks shm_open/shm_unlink and some posix shared
memory functionality right now. Note: FreeBSD 8.2 amd64 has system gcc
of 4.2.1, the last GPLv2 gcc with some patches before the switch to
GPLv3, if I am not mistaken.

It seems FreeBSD is also affected like OpenBSD about the thread id
issue discussed a month before in this thread. I am cc'ing matthew@
just to keep him in the loop.
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2011-April/000444.html

and it was resolved to fix it like so
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2011-April/000452.html

I don't know what should be the replacement for FreeBSD, as that
particular piece of code in lldb/source/Host/common/Host.cpp is a
dirty hack to allow compile to proceed.

This is not okay to include otherwise.
http://svnweb.FreeBSD.org/base/head/lib/libc/include/namespace.h?r1=214093&r2=218414
Can somebody from freebsd-hackers speak up? Or just give the correct
diff for FreeBSD?

I am stuck in this for now. I will take it up later.
/stuff/llvm/tools/lldb/source/Symbol/ClangASTContext.cpp:1471: error:
ISO C++ forbids variable-size array 'params'

Here's what I got so far, small things all related to compile.

Thanks,
amit

Index: include/lldb/Host/Host.h
===================================================================
--- include/lldb/Host/Host.h	(revision 131240)
+++ include/lldb/Host/Host.h	(working copy)
@@ -352,6 +352,15 @@
     static lldb::pid_t
     LaunchApplication (const FileSpec &app_file_spec);

+    static lldb::pid_t
+    LaunchInNewTerminal (const char *tty_name,
+		 	const char **argv,
+		 	const char **envp,
+		 	const char *working_dir,
+			const ArchSpec *arch_spec,
+			bool stop_at_entry,
+			bool disable_aslr);
+
     static Error
     LaunchProcess (ProcessLaunchInfo &launch_info);

Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
===================================================================
--- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h	(revision
131240)
+++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h	(working copy)
@@ -11,6 +11,9 @@
 #define liblldb_PlatformRemoteGDBServer_h_

 // C Includes
+#if defined (__OpenBSD__)
+  #include <sys/param.h>
+#endif
 // C++ Includes
 #include <string>

Index: source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
===================================================================
--- source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h	(revision 131240)
+++ source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h	(working copy)
@@ -72,7 +72,7 @@
         dwarf_ymm4 = dwarf_xmm4,
         dwarf_ymm5 = dwarf_xmm5,
         dwarf_ymm6 = dwarf_xmm6,
-        dwarf_ymm7 = dwarf_xmm7,
+        dwarf_ymm7 = dwarf_xmm7
     };

     enum
Index: source/Interpreter/OptionGroupFormat.cpp
===================================================================
--- source/Interpreter/OptionGroupFormat.cpp	(revision 131240)
+++ source/Interpreter/OptionGroupFormat.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//

-#include "OptionGroupFormat.h"
+#include "lldb/Interpreter/OptionGroupFormat.h"

 // C Includes
 // C++ Includes
Index: source/Interpreter/OptionGroupValueObjectDisplay.cpp
===================================================================
--- source/Interpreter/OptionGroupValueObjectDisplay.cpp	(revision 131240)
+++ source/Interpreter/OptionGroupValueObjectDisplay.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//

-#include "OptionGroupValueObjectDisplay.h"
+#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"

 // C Includes
 // C++ Includes
@@ -123,4 +123,4 @@
         // If we don't have any targets, then dynamic values won't do
us much good.
         use_dynamic = lldb::eNoDynamicValues;
     }
-}
\ No newline at end of file
+}
Index: source/Interpreter/OptionGroupUInt64.cpp
===================================================================
--- source/Interpreter/OptionGroupUInt64.cpp	(revision 131240)
+++ source/Interpreter/OptionGroupUInt64.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//

-#include "OptionGroupUInt64.h"
+#include "lldb/Interpreter/OptionGroupUInt64.h"

 // C Includes
 // C++ Includes
Index: source/Interpreter/OptionGroupOutputFile.cpp
===================================================================
--- source/Interpreter/OptionGroupOutputFile.cpp	(revision 131240)
+++ source/Interpreter/OptionGroupOutputFile.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//

-#include "OptionGroupOutputFile.h"
+#include "lldb/Interpreter/OptionGroupOutputFile.h"

 // C Includes
 // C++ Includes
Index: source/Interpreter/OptionGroupUUID.cpp
===================================================================
--- source/Interpreter/OptionGroupUUID.cpp	(revision 131240)
+++ source/Interpreter/OptionGroupUUID.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//

-#include "OptionGroupUUID.h"
+#include "lldb/Interpreter/OptionGroupUUID.h"

 // C Includes
 // C++ Includes
Index: source/Interpreter/OptionGroupBoolean.cpp
===================================================================
--- source/Interpreter/OptionGroupBoolean.cpp	(revision 131240)
+++ source/Interpreter/OptionGroupBoolean.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//

-#include "OptionGroupBoolean.h"
+#include "lldb/Interpreter/OptionGroupBoolean.h"

 // C Includes
 // C++ Includes
Index: source/Interpreter/OptionGroupFile.cpp
===================================================================
--- source/Interpreter/OptionGroupFile.cpp	(revision 131240)
+++ source/Interpreter/OptionGroupFile.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//

-#include "OptionGroupFile.h"
+#include "lldb/Interpreter/OptionGroupFile.h"

 // C Includes
 // C++ Includes
Index: source/Interpreter/OptionGroupArchitecture.cpp
===================================================================
--- source/Interpreter/OptionGroupArchitecture.cpp	(revision 131240)
+++ source/Interpreter/OptionGroupArchitecture.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//

-#include "OptionGroupArchitecture.h"
+#include "lldb/Interpreter/OptionGroupArchitecture.h"

 // C Includes
 // C++ Includes
Index: source/Host/common/Host.cpp
===================================================================
--- source/Host/common/Host.cpp	(revision 131240)
+++ source/Host/common/Host.cpp	(working copy)
@@ -39,9 +39,10 @@
 #include <sys/sysctl.h>


-#elif defined (__linux__)
+#elif defined (__linux__) || defined (__OpenBSD__) || defined (__FreeBSD__)

 #include <sys/wait.h>
+#include <sys/sysctl.h>

 #endif

@@ -410,6 +411,8 @@
 {
 #if defined (__APPLE__)
     return ::mach_thread_self();
+#elif defined (__OpenBSD__) || defined (__FreeBSD__)
+    return (uint64_t) (pthread_self());
 #else
     return lldb::tid_t(pthread_self());
 #endif
Index: source/lldb.cpp
===================================================================
--- source/lldb.cpp	(revision 131240)
+++ source/lldb.cpp	(working copy)
@@ -85,14 +85,14 @@
         UnwindAssemblyInstEmulation::Initialize();
         UnwindAssembly_x86::Initialize();
         EmulateInstructionARM::Initialize ();
-        ABIMacOSX_i386::Initialize();
-        ABIMacOSX_arm::Initialize();
-        ABISysV_x86_64::Initialize();

 #if defined (__APPLE__)
         //----------------------------------------------------------------------
         // Apple/Darwin hosted plugins
         //----------------------------------------------------------------------
+        ABIMacOSX_i386::Initialize();
+        ABIMacOSX_arm::Initialize();
+        ABISysV_x86_64::Initialize();
         DynamicLoaderMacOSXDYLD::Initialize();
         SymbolFileDWARFDebugMap::Initialize();
         ItaniumABILanguageRuntime::Initialize();
@@ -152,11 +152,11 @@
     UnwindAssembly_x86::Terminate();
     UnwindAssemblyInstEmulation::Terminate();
     EmulateInstructionARM::Terminate ();
+
+#if defined (__APPLE__)
     ABIMacOSX_i386::Terminate();
     ABIMacOSX_arm::Terminate();
     ABISysV_x86_64::Terminate();
-
-#if defined (__APPLE__)
     DynamicLoaderMacOSXDYLD::Terminate();
     SymbolFileDWARFDebugMap::Terminate();
     ItaniumABILanguageRuntime::Terminate();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lldb.diff
Type: application/octet-stream
Size: 7519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110512/92249749/attachment.obj>


More information about the lldb-dev mailing list