lldb patches for FreeBSD

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

lldb.diff (7.34 KB)

Check out this code from FreeBSD's OpenJDK6 port:

#if __FreeBSD_version > 900030
  return pthread_getthreadid_np();
#else
  long tid;
  thr_self(&tid);
  return (pid_t)tid;
#endif

The underlying type of a tid (lwpid_t in kernel) is an int.