Files
clang-p2996/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h
Alexander Shaposhnikov 56138de385 [lldb] Fix initialization of m_debug_cu_index_map
SymbolFileDWARFDwp contains m_debug_cu_index_map which was previously 
initialized incorrectly: before m_debug_cu_index.parse 
is called m_debug_cu_index is empty, thus 
the map was not actually getting populated properly. 
This diff moves this step into a private helper method
and calls it after m_debug_cu_index.parse inside SymbolFileDWARFDwp::Create.

Test plan:

Build a toy test example 
main.cpp
clang -gsplit-dwarf -g -O0 main.cpp -o main.exe
llvm-dwp -e main.exe -o main.exe.dwp
Build LLDB with ENABLE_DEBUG_PRINTF set.
Run: lldb -- ./main.exe
Check that the indexes are now correct 
(before this change they were empty)
Check that debugging works 
(setting breakpoints, printing local variables (this was not working before))

Differential revision: http://reviews.llvm.org/D38492

llvm-svn: 314832
2017-10-03 19:56:21 +00:00

56 lines
1.7 KiB
C++

//===-- SymbolFileDWARFDwp.h ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_
#define SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_
// C Includes
// C++ Includes
#include <memory>
// Other libraries and framework includes
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
// Project includes
#include "lldb/Core/Module.h"
#include "DWARFDataExtractor.h"
#include "SymbolFileDWARFDwo.h"
class SymbolFileDWARFDwp {
public:
static std::unique_ptr<SymbolFileDWARFDwp>
Create(lldb::ModuleSP module_sp, const lldb_private::FileSpec &file_spec);
std::unique_ptr<SymbolFileDWARFDwo>
GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu, uint64_t dwo_id);
bool LoadSectionData(uint64_t dwo_id, lldb::SectionType sect_type,
lldb_private::DWARFDataExtractor &data);
private:
explicit SymbolFileDWARFDwp(lldb::ModuleSP module_sp,
lldb::ObjectFileSP obj_file);
bool LoadRawSectionData(lldb::SectionType sect_type,
lldb_private::DWARFDataExtractor &data);
void InitDebugCUIndexMap();
lldb::ObjectFileSP m_obj_file;
std::mutex m_sections_mutex;
std::map<lldb::SectionType, lldb_private::DWARFDataExtractor> m_sections;
llvm::DWARFUnitIndex m_debug_cu_index;
std::map<uint64_t, const llvm::DWARFUnitIndex::Entry *> m_debug_cu_index_map;
};
#endif // SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_