[lldb-dev] LLDB C++ API causes SIGSEGV
Greg Clayton via lldb-dev
lldb-dev at lists.llvm.org
Mon Mar 9 15:42:33 PDT 2020
You will want to call SBDebugger::Initialize() first before doing anything. Since LLDB is a shared library, we don't want to do a bunch of work when the LLDB shared library is loaded in case LLDB might not always be used right away or at all within a process. So your code can be:
int main() {
SBDebugger::Initialize();
SBDebugger debugger = SBDebugger::Create();
SBDebugger::Terminate();
}
SBDebugger::Initialize() will case all internal interfaces to be initialized and ready for a debug session. Terminate will tear everything down as well. Again, this allows LLDB to be used in processes and ensure minimal impact from just linking against the library. It is ok to call SBDebugger::Initialize() more than once, as the initialize will only happen once.
Greg
> On Mar 8, 2020, at 1:53 PM, Rui Liu via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>
> Hi LLDB devs,
>
> I'm trying to build a debugger integration that uses LLDB C++ API. Due to lack of documentation, I'm basically using the examples in the python API as a guidance.
>
> I had following code, which basically contains one line creating a SBDebugger, but it generates a SIGSEGV fault......
>
> #include <LLDB.h>
> using namespace lldb;
>
> int main()
> {
> SBDebugger debugger = SBDebugger::Create();
> }
>
> Did I do something wrong?
>
> Kind regards,
> Rui
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
More information about the lldb-dev
mailing list