예제 #1
0
파일: Driver.cpp 프로젝트: czchen/lldb
int
main (int argc, char const *argv[], const char *envp[])
{
    SBDebugger::Initialize();
    
    SBHostOS::ThreadCreated ("<lldb.driver.main-thread>");

    signal (SIGPIPE, SIG_IGN);
    signal (SIGWINCH, sigwinch_handler);
    signal (SIGINT, sigint_handler);
    signal (SIGTSTP, sigtstp_handler);
    signal (SIGCONT, sigcont_handler);

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

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

    SBDebugger::Terminate();
    return 0;
}
예제 #2
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;
}