Example #1
0
int
main (int argc, char const *argv[], const char *envp[])
{
#if 1 // Enable for debug logging
    lldb::StreamSP logStream(new lldb_private::StreamCallback(LogOutput, 0));
    const char* logCategories[] = { 0 };
    lldb::LogSP log = lldb_private::EnableLog(logStream, 0, logCategories, 0);
    log->GetMask().Reset(LIBLLDB_LOG_ALL);
#endif
    SBDebugger::Initialize();
    
    SBHostOS::ThreadCreated ("<lldb.driver.main-thread>");

	SetupPosixSignals();
    // Create a scope for driver so that the driver object will destroy itself
    // before SBDebugger::Terminate() is called.
    {
        Driver driver;

        bool exit = false;
        SBError error = driver.ParseArgs (argc, argv, stdout, exit);
        if (error.Fail())
        {
            const char *error_cstr = error.GetCString ();
            if (error_cstr)
                ::fprintf (stderr, "error: %s\n", error_cstr);
        }
        else if (!exit)
        {
            driver.Initialize();
        }
    }

    SBDebugger::Terminate();
    return 0;
}