[lldb-dev] Not able to find process plugin for core file

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Mon Mar 14 10:28:16 PDT 2016


It might be that no one has implemented the deserializing of the MIPS registers yet? Best to step through the code and figure out what is going wrong.

Greg

> On Mar 14, 2016, at 3:14 AM, Bhushan Attarde <bhushan.attarde at imgtec.com> wrote:
> 
> Hi Greg,
> 
> I tried specifying a full triple but it's still the same issue.
> 
> (lldb) target create --arch=mips64el-pc-linux "coredump.elf" --core "core_mips"
> error: Unable to find process plug-in for core file '/home/battarde/test/core_mips'
> 
> LLDB correctly recognises that "core_mips" is a core file and creates an appropriate Process instance (i.e ProcessElfCore).
> But then "ProcessElfCore::CanDebug" fails as it cannot create a complete Module because it cannot find any architecture in that core file.
> 
> Everything in the triple for the core file "core_mips" remains "Unknown" here i.e UnknownArch-UnknownVendor-UnknownOS/UnknownEnvironment.
> 
> What happens here is, "ObjectFileELF::GetModuleSpecifications" has this:
> 
>        const uint32_t sub_type = subTypeFromElfHeader(header);
>        spec.GetArchitecture().SetArchitecture(eArchTypeELF,
>                                               			          header.e_machine,
>                                               			          sub_type,
> 		                                                          header.e_ident[EI_OSABI]);
> 
> subTypeFromElfHeader(header) returns ArchSpec::eMIPSSubType_unknown (as header.e_flags is 0).
> Then SetArchitecture called with cpu=llvm::ELF::EM_MIPS and sub_type=ArchSpec::eMIPSSubType_unknown fails to find a ArchDefinitionEntry because there ins't any ArchDefinitionEntry in g_elf_arch_entries for this cpu/subtype combination.
> This in turn leaves everything in triple as "Unknown" and the ArchSpec created for core file remains Invalid.
> 
> -Bhushan
> 
> -----Original Message-----
> From: Greg Clayton [mailto:gclayton at apple.com] 
> Sent: 11 March 2016 02:31
> To: Bhushan Attarde
> Cc: lldb-dev at lists.llvm.org
> Subject: Re: [lldb-dev] Not able to find process plugin for core file
> 
> 
>> On Mar 10, 2016, at 4:34 AM, Bhushan Attarde via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>> 
>> Hi All,
>> 
>> I am working on adding support for MIPS coredump file in LLDB.
>> 
>> I tried below command:
>> 
>> (lldb) target create "app_mips.elf" --core "core_mips"
>> error: Unable to find process plug-in for core file '/home/battarde/test/ core_mips’
>> 
>> Currently LLDB is not able to find a Process plugin for MIPS core file. I debugged this and found that while finding the process plugin, "ProcessElfCore::CanDebug" calls "ModuleList::GetSharedModule"
>> to create a Module for corefile. But Module constructor in Module.cpp has this:
>> 
>>    // First extract all module specifications from the file using the local
>>    // file path. If there are no specifications, then don't fill anything in
>>    ModuleSpecList modules_specs;
>>    if (ObjectFile::GetModuleSpecifications(module_spec.GetFileSpec(), 0, 0, modules_specs) == 0)
>>        return;
>> 
>> The issue here is that the targets like MIPS depends on elf flags to determine the actual architecture but core file doesn't contain any arch information (header.e_flags is 0) so it can't decide the arch contained in core file.
>> As no specifications are found, Module constructor takes an early exit leaving its members uninitialized.
>> 
>> Going further, Module also fails to get the ObjectFile representation as it doesn't contain enough information (Module::m_file, Module::m_arch) required to get ObjectFile.
>> 
>> So, "ProcessElfCore::CanDebug" returns false and because of this LLDB gives error saying that it is unable to find process plug-in for core file.
>> 
>> I can make mipsVariantFromElfFlags() to return some default architecture (to ensure we always have valid arch when it can't be decided from elf flags) but this won't always work (core's default arch and executable_elf's arch may not "match" always).
>> What could be the proper fix to this issue?
> 
> Try specifying a full triple when creating the target:
> 
> 
> (lldb) target create --arch=mips32-pc-linux "app_mips.elf" --core "core_mips"
> 
> If any ELF file is unable to figure out its file type, it should leave things generic so the triple for the core ELF file should be something like: "mips-*-*". If that is true, then this should match your more specific triple specified in the target of "mips32-pc-linux". 
> 
> Try out specifying the triple and let me know how that goes. 
> 
> Greg Clayton



More information about the lldb-dev mailing list