[lldb-dev] Using a undeclared free function in lldb Mangled.cpp causes build failure
Du Toit, Stefanus
stefanus.du.toit at intel.com
Thu Aug 15 09:48:49 PDT 2013
> 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?
Mangled.cpp:25 is:
#include <stdlib.h>
--
Stefanus Du Toit <stefanus.du.toit at intel.com>
Intel Waterloo
From: Zack Perry <zack.perry at sbcglobal.net>
Reply-To: Zack Perry <zack.perry at sbcglobal.net>
Date: Thursday, 15 August, 2013 12:41 PM
To: "lldb-dev at cs.uiuc.edu" <lldb-dev at cs.uiuc.edu>
Subject: [lldb-dev] Using a undeclared free function in lldb
Mangled.cpp causes build failure
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.
Not really!
zackp at nb1:~/Downloads/clang3.3/build$ ../llvm/configure --prefix=/usr
--enable-optimized --disable-assertions --enable-targets=host-only
--enable-cxx11=yes
--enable-libcpp=yes --with-extra-ld-options="-lc++abi"
zackp at nb1:~/Downloads/clang3.3/build$ make -j 2
[...]
llvm[4]: Compiling Mangled.cpp for Release build
/home/zackp/Downloads/clang3.3/llvm-3.3.src/tools/lldb/source/Core/Mangled.
cpp:218:21: error: use of undeclared identifier 'free'
free (demangled_name);
^
1 error generated.
make[4]: ***
[/home/zackp/Downloads/clang3.3/build/tools/lldb/source/Core/Release/Mangle
d.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory
`/home/zackp/Downloads/clang3.3/build/tools/lldb/source/Core'
make[3]: *** [all] Error 1
make[3]: Leaving directory
`/home/zackp/Downloads/clang3.3/build/tools/lldb/source'
make[2]: *** [all] Error 1
make[2]: Leaving directory
`/home/zackp/Downloads/clang3.3/build/tools/lldb'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/zackp/Downloads/clang3.3/build/tools'
make: *** [all] Error 1
Questions:
0. why in a C++ code, the C free function is used?
1. Why when using it, the #include <cstdlib> is nowhere in the source?
Regards,
-- Zack
More information about the lldb-dev
mailing list