예제 #1
0
    virtual bool
    DoExecute (lldb::SBDebugger debugger,
               char** arguments,
               lldb::SBCommandReturnObject &result)
    {
        if (arguments[0] == NULL)
        {
            result.Printf("Load path for sos/dac/dbi: '%s'\n", g_coreclrDirectory == NULL ? "<none>" : g_coreclrDirectory);
        }
        else {
            if (g_coreclrDirectory != NULL)
            {
                free(g_coreclrDirectory);
            }

            std::string path(arguments[0]);
            if (path[path.length() - 1] != '/')
            {
                path.append("/");
            }

            g_coreclrDirectory = strdup(path.c_str());
            result.Printf("Set load path for sos/dac/dbi to '%s'\n", g_coreclrDirectory);
        }
        return result.Succeeded();
    }
예제 #2
0
DebugClient::DebugClient(lldb::SBDebugger &debugger, lldb::SBCommandReturnObject &returnObject, lldb::SBProcess *process, lldb::SBThread *thread) : 
    m_debugger(debugger),
    m_returnObject(returnObject),
    m_currentProcess(process),
    m_currentThread(thread)
{
    returnObject.SetStatus(lldb::eReturnStatusSuccessFinishResult);
}
예제 #3
0
 virtual bool
 DoExecute (lldb::SBDebugger debugger,
            char** arguments,
            lldb::SBCommandReturnObject &result)
 {
     if (arguments)
     {
         int argc = 0;
         char **argv = arguments;
         for (const char* arg = *arguments; arg; arg = *(++arguments))
         {
             ++argc;
         }
         int exitcode = corerun((const int)argc, (const char**)argv);
         if (exitcode != 0)
         {
             result.SetError("corerun failed");
         }
     }
     return result.Succeeded();
 }
예제 #4
0
    virtual bool
    DoExecute (lldb::SBDebugger debugger,
               char** arguments,
               lldb::SBCommandReturnObject &result)
    {
        LLDBServices* services = new LLDBServices(debugger, result);
        LoadSos(services);

        if (m_sosHandle)
        {
            const char* sosCommand = m_command;
            if (sosCommand == NULL) 
            {
                if (arguments == NULL || *arguments == NULL) {
                    sosCommand = "Help";
                }
                else
                {
                    sosCommand = *arguments++;
                }
            }
            CommandFunc commandFunc = (CommandFunc)dlsym(m_sosHandle, sosCommand);
            if (commandFunc)
            {
                std::string str;
                if (arguments != NULL)
                {
                    for (const char* arg = *arguments; arg; arg = *(++arguments))
                    {
                        str.append(arg);
                        str.append(" ");
                    }
                }
                const char* sosArgs = str.c_str();
                HRESULT hr = commandFunc(services, sosArgs);
                if (hr != S_OK)
                {
                    services->Output(DEBUG_OUTPUT_ERROR, "%s %s failed\n", sosCommand, sosArgs);
                }
            }
            else
            {
                services->Output(DEBUG_OUTPUT_ERROR, "SOS command '%s' not found %s\n", sosCommand, dlerror());
            }
        }

        services->Release();
        return result.Succeeded();
    }
예제 #5
0
void
SBCommandInterpreter::HandleCommandsFromFile (lldb::SBFileSpec &file,
                                              lldb::SBExecutionContext &override_context,
                                              lldb::SBCommandInterpreterRunOptions &options,
                                              lldb::SBCommandReturnObject result)
{
    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));

    if (log)
    {
        SBStream s;
        file.GetDescription (s);
        log->Printf ("SBCommandInterpreter(%p)::HandleCommandsFromFile (file=\"%s\", SBCommandReturnObject(%p))",
                     static_cast<void*>(m_opaque_ptr), s.GetData(),
                     static_cast<void*>(result.get()));
    }

    if (!IsValid())
    {
        result->AppendError ("SBCommandInterpreter is not valid.");
        result->SetStatus (eReturnStatusFailed);
        return;
    }

    if (!file.IsValid())
    {
        SBStream s;
        file.GetDescription (s);
        result->AppendErrorWithFormat ("File is not valid: %s.", s.GetData());
        result->SetStatus (eReturnStatusFailed);
    }

    FileSpec tmp_spec = file.ref();
    ExecutionContext ctx, *ctx_ptr;
    if (override_context.get())
    {
        ctx = override_context.get()->Lock(true);
        ctx_ptr = &ctx;
    }
    else
       ctx_ptr = nullptr;

    m_opaque_ptr->HandleCommandsFromFile (tmp_spec, ctx_ptr, options.ref(), result.ref());
}
예제 #6
0
    virtual bool
        DoExecute(lldb::SBDebugger debugger,
        char** arguments,
        lldb::SBCommandReturnObject &result)
    {
        if (arguments[0] == NULL)
        {
            if (g_currentThreadSystemId == -1 || g_currentThreadIndex == -1)
            {
                result.Printf("sos OS tid not mapped\n");
            }
            else {
                result.Printf("sos OS tid 0x%x mapped to lldb thread index %d\n",
                    g_currentThreadSystemId, g_currentThreadIndex);
            }
        }
        else if (strcmp(arguments[0], "-clear") == 0) {
            g_currentThreadIndex = -1;
            g_currentThreadSystemId = -1;
            result.Printf("Cleared sos OS tid/index\n");
        }
        else if (arguments[1] == NULL)
        {
            result.Printf("Need thread index parameter that maps to the OS tid\n");
        }
        else
        {
            ULONG tid = strtoul(arguments[0], NULL, 16);
            g_currentThreadSystemId = tid;

            ULONG index = strtoul(arguments[1], NULL, 16);
            g_currentThreadIndex = index;

            result.Printf("Mapped sos OS tid 0x%x to lldb thread index %d\n", tid, index);
        }
        return result.Succeeded();
    }