Beispiel #1
0
void
DynamicLoader::UpdateLoadedSectionsCommon(ModuleSP module, addr_t base_addr)
{
    bool changed;
    const bool base_addr_is_offset = true;
    module->SetLoadAddress(m_process->GetTarget(), base_addr, base_addr_is_offset, changed);
}
Beispiel #2
0
void
ProcessWindows::OnLoadDll(const ModuleSpec &module_spec, lldb::addr_t module_addr)
{
    // Confusingly, there is no Target::AddSharedModule.  Instead, calling GetSharedModule() with
    // a new module will add it to the module list and return a corresponding ModuleSP.
    Error error;
    ModuleSP module = GetTarget().GetSharedModule(module_spec, &error);
    bool load_addr_changed = false;
    module->SetLoadAddress(GetTarget(), module_addr, false, load_addr_changed);

    ModuleList loaded_modules;
    loaded_modules.Append(module);
    GetTarget().ModulesDidLoad(loaded_modules);
}
Beispiel #3
0
void
ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base)
{
    DebuggerThreadSP debugger = m_session_data->m_debugger;

    WINLOG_IFALL(WINDOWS_LOG_PROCESS, "Debugger connected to process %I64u.  Image base = 0x%I64x",
                 debugger->GetProcess().GetProcessId(), image_base);

    ModuleSP module = GetTarget().GetExecutableModule();
    if (!module)
    {
        // During attach, we won't have the executable module, so find it now.
        const DWORD pid = debugger->GetProcess().GetProcessId();
        const std::string file_name = GetProcessExecutableName(pid);
        if (file_name.empty())
        {
            return;
        }

        FileSpec executable_file(file_name, true);
        ModuleSpec module_spec(executable_file);
        Error error;
        module = GetTarget().GetSharedModule(module_spec, &error);
        if (!module)
        {
            return;
        }

        GetTarget().SetExecutableModule(module, false);
    }

    bool load_addr_changed;
    module->SetLoadAddress(GetTarget(), image_base, false, load_addr_changed);

    ModuleList loaded_modules;
    loaded_modules.Append(module);
    GetTarget().ModulesDidLoad(loaded_modules);

    // Add the main executable module to the list of pending module loads.  We can't call
    // GetTarget().ModulesDidLoad() here because we still haven't returned from DoLaunch() / DoAttach() yet
    // so the target may not have set the process instance to `this` yet.
    llvm::sys::ScopedLock lock(m_mutex);
    const HostThreadWindows &wmain_thread = debugger->GetMainThread().GetNativeThread();
    m_session_data->m_new_threads[wmain_thread.GetThreadId()] = debugger->GetMainThread();
}
Beispiel #4
0
void
ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base)
{
    // Either we successfully attached to an existing process, or we successfully launched a new
    // process under the debugger.
    ModuleSP module = GetTarget().GetExecutableModule();
    bool load_addr_changed;
    module->SetLoadAddress(GetTarget(), image_base, false, load_addr_changed);

    // Notify the target that the executable module has loaded.  This will cause any pending
    // breakpoints to be resolved to explicit brekapoint sites.
    ModuleList loaded_modules;
    loaded_modules.Append(module);
    GetTarget().ModulesDidLoad(loaded_modules);

    llvm::sys::ScopedLock lock(m_mutex);

    DebuggerThreadSP debugger = m_session_data->m_debugger;
    const HostThreadWindows &wmain_thread = debugger->GetMainThread().GetNativeThread();
    m_session_data->m_new_threads[wmain_thread.GetThreadId()] = debugger->GetMainThread();
}