I am trying to build lldb on a Ubuntu 12.04 x86_64 box. I have a self-hosted clang 3.3 toolchain successfully built and installed on this box. So, I thought it would be simple just add a symlink lldb to the lldb-3.3-src into the llvm/tools/, redo the configure, make, and make install would do it.
0. why in a C++ code, the C free function is used?
Because it's calling into a C API (cxxabi). demangled_name comes from a
call to abi::__cxa_demangle(), which presumably calls malloc to allocate
its return value.
1. Why when using it, the #include <cstdlib> is nowhere in the source?
Because it’s calling into a C API (cxxabi). demangled_name comes from a
call to abi::__cxa_demangle(), which presumably calls malloc to allocate
its return value.
OK. Got that.
Why when using it, the #include is nowhere in the source?
Mangled.cpp:25 is: #include <stdlib.h>
No. This is incorrect. With lldb 3.3 official release tar ball, the #include that you mentioned is not there.