
Second attempt at relanding the lldb-rpc-gen tool. This should fix 2 issues: - An assert that was hitting when building on Linux. The assert would hit in the server source emitter, specifically when attemping to determine the storage size for a return type is that is a pointer, but isn't a const char *, const char ** or void pointer. The assert would hit when attempting to generate SBAttachInfo::GetProcessPluginName, which returns a const char * (meaning it shouldn't have been in the code block for the assert at all). The reason that it was hitting the assert when generating this function is that lldb_rpc_gen::TypeIsConstCharPtr was returning false for this function even though it did return a const char *. This was happening because when checking the return type for a const char *, TypeIsConstCharPtr would only check that the underlying type was a signed char. This failed on Linux (but was fine on Darwin), as the underlying type also needs to be checked for being an unsigned char. - Cross compiling support The build for lldb-rpc-gen had no support for cross compiling and as such, the sources generated for lldb-rpc-gen would get compiled too early in phase 2 when cross compiling, before the Clang toolchain was built and this led to an error when trying to include stdlib files. This reland splits this build into 2 by building the tool first and then compiling the sources in the second stage of the cross-compiled build. Original PR Description: This commit upstreams the lldb-rpc-gen tool, a ClangTool that generates the LLDB RPC client and server interfaces. This tool, as well as LLDB RPC itself is built by default. If it needs to be disabled, put -DLLDB_BUILD_LLDBRPC=OFF in your CMake invocation. https://discourse.llvm.org/t/rfc-upstreaming-lldb-rpc/85804 Original PR Link: github.com/llvm/llvm-project/pull/138031
24 lines
498 B
CMake
24 lines
498 B
CMake
add_lldb_tool(lldb-rpc-gen
|
|
RPCCommon.cpp
|
|
server/RPCServerHeaderEmitter.cpp
|
|
server/RPCServerSourceEmitter.cpp
|
|
lldb-rpc-gen.cpp
|
|
|
|
CLANG_LIBS
|
|
clangAST
|
|
clangBasic
|
|
clangCodeGen
|
|
clangFrontend
|
|
clangLex
|
|
clangRewrite
|
|
clangSerialization
|
|
clangTooling
|
|
|
|
LINK_COMPONENTS
|
|
Support
|
|
)
|
|
|
|
if (NOT DEFINED LLDB_RPC_GEN_EXE)
|
|
set(LLDB_RPC_GEN_EXE $<TARGET_FILE:lldb-rpc-gen> CACHE STRING "Executable that generates lldb-rpc-server")
|
|
endif()
|