~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "ThreadMachCore.h"
33
33
#include "StopInfoMachException.h"
34
34
 
 
35
// Needed for the plug-in names for the dynamic loaders.
35
36
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
36
37
#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
37
38
 
38
39
using namespace lldb;
39
40
using namespace lldb_private;
40
41
 
41
 
const char *
 
42
ConstString
42
43
ProcessMachCore::GetPluginNameStatic()
43
44
{
44
 
    return "mach-o-core";
 
45
    static ConstString g_name("mach-o-core");
 
46
    return g_name;
45
47
}
46
48
 
47
49
const char *
125
127
//----------------------------------------------------------------------
126
128
// PluginInterface
127
129
//----------------------------------------------------------------------
128
 
const char *
 
130
ConstString
129
131
ProcessMachCore::GetPluginName()
130
132
{
131
 
    return "Process debugging plug-in that loads mach-o core files.";
132
 
}
133
 
 
134
 
const char *
135
 
ProcessMachCore::GetShortPluginName()
136
 
{
137
133
    return GetPluginNameStatic();
138
134
}
139
135
 
301
297
 
302
298
    if (m_dyld_addr == LLDB_INVALID_ADDRESS)
303
299
    {
304
 
        addr_t kernel_load_address = DynamicLoaderDarwinKernel::SearchForDarwinKernel (this);
305
 
        if (kernel_load_address != LLDB_INVALID_ADDRESS)
 
300
        // We need to locate the main executable in the memory ranges
 
301
        // we have in the core file. We already checked the first address
 
302
        // in each memory zone above, so we just need to check each page
 
303
        // except the first page in each range and stop once we have found
 
304
        // our main executable
 
305
        const size_t num_core_aranges = m_core_aranges.GetSize();
 
306
        for (size_t i=0; i<num_core_aranges && m_dyld_addr == LLDB_INVALID_ADDRESS; ++i)
306
307
        {
307
 
            GetDynamicLoaderAddress (kernel_load_address);
 
308
            const VMRangeToFileOffset::Entry *entry = m_core_aranges.GetEntryAtIndex(i);
 
309
            lldb::addr_t section_vm_addr_start = entry->GetRangeBase();
 
310
            lldb::addr_t section_vm_addr_end = entry->GetRangeEnd();
 
311
            for (lldb::addr_t section_vm_addr = section_vm_addr_start + 0x1000;
 
312
                 section_vm_addr < section_vm_addr_end;
 
313
                 section_vm_addr += 0x1000)
 
314
            {
 
315
                if (GetDynamicLoaderAddress (section_vm_addr))
 
316
                {
 
317
                    break;
 
318
                }
 
319
            }
308
320
        }
309
321
    }
310
322
    return error;
314
326
ProcessMachCore::GetDynamicLoader ()
315
327
{
316
328
    if (m_dyld_ap.get() == NULL)
317
 
        m_dyld_ap.reset (DynamicLoader::FindPlugin(this, m_dyld_plugin_name.empty() ? NULL : m_dyld_plugin_name.c_str()));
 
329
        m_dyld_ap.reset (DynamicLoader::FindPlugin(this, m_dyld_plugin_name.IsEmpty() ? NULL : m_dyld_plugin_name.GetCString()));
318
330
    return m_dyld_ap.get();
319
331
}
320
332
 
371
383
    return true;
372
384
}
373
385
 
 
386
bool
 
387
ProcessMachCore::WarnBeforeDetach () const
 
388
{
 
389
    return false;
 
390
}
 
391
 
374
392
//------------------------------------------------------------------
375
393
// Process Memory
376
394
//------------------------------------------------------------------