forked from OSchip/llvm-project
Revert "[lldb][DWARF5] Enable macro evaluation"
This reverts commit a0fb69d17b
.
This broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/23666
This commit is contained in:
parent
db6a53450f
commit
da459043f8
|
@ -92,8 +92,8 @@ const DWARFDataExtractor &DWARFContext::getOrLoadLocListsData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const DWARFDataExtractor &DWARFContext::getOrLoadMacroData() {
|
const DWARFDataExtractor &DWARFContext::getOrLoadMacroData() {
|
||||||
return LoadOrGetSection(eSectionTypeDWARFDebugMacro,
|
return LoadOrGetSection(eSectionTypeDWARFDebugMacro, llvm::None,
|
||||||
eSectionTypeDWARFDebugMacro, m_data_debug_macro);
|
m_data_debug_macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DWARFDataExtractor &DWARFContext::getOrLoadRangesData() {
|
const DWARFDataExtractor &DWARFContext::getOrLoadRangesData() {
|
||||||
|
|
|
@ -16,11 +16,6 @@
|
||||||
using namespace lldb_private;
|
using namespace lldb_private;
|
||||||
using namespace lldb_private::dwarf;
|
using namespace lldb_private::dwarf;
|
||||||
|
|
||||||
uint64_t DWARFStrOffsetsInfo::GetOffset(uint64_t index) const {
|
|
||||||
uint64_t offset = cu_str_offset + data.GetDWARFSizeOfOffset() * index;
|
|
||||||
return data.GetU32(&offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
DWARFDebugMacroHeader
|
DWARFDebugMacroHeader
|
||||||
DWARFDebugMacroHeader::ParseHeader(const DWARFDataExtractor &debug_macro_data,
|
DWARFDebugMacroHeader::ParseHeader(const DWARFDataExtractor &debug_macro_data,
|
||||||
lldb::offset_t *offset) {
|
lldb::offset_t *offset) {
|
||||||
|
@ -64,8 +59,7 @@ void DWARFDebugMacroHeader::SkipOperandTable(
|
||||||
|
|
||||||
void DWARFDebugMacroEntry::ReadMacroEntries(
|
void DWARFDebugMacroEntry::ReadMacroEntries(
|
||||||
const DWARFDataExtractor &debug_macro_data,
|
const DWARFDataExtractor &debug_macro_data,
|
||||||
const DWARFDataExtractor &debug_str_data,
|
const DWARFDataExtractor &debug_str_data, const bool offset_is_64_bit,
|
||||||
const DWARFStrOffsetsInfo *str_offsets_info, const bool offset_is_64_bit,
|
|
||||||
lldb::offset_t *offset, SymbolFileDWARF *sym_file_dwarf,
|
lldb::offset_t *offset, SymbolFileDWARF *sym_file_dwarf,
|
||||||
DebugMacrosSP &debug_macros_sp) {
|
DebugMacrosSP &debug_macros_sp) {
|
||||||
llvm::dwarf::MacroEntryType type =
|
llvm::dwarf::MacroEntryType type =
|
||||||
|
@ -103,22 +97,6 @@ void DWARFDebugMacroEntry::ReadMacroEntries(
|
||||||
debug_macros_sp->AddMacroEntry(
|
debug_macros_sp->AddMacroEntry(
|
||||||
DebugMacroEntry::CreateUndefEntry(line, macro_str));
|
DebugMacroEntry::CreateUndefEntry(line, macro_str));
|
||||||
break;
|
break;
|
||||||
case DW_MACRO_define_strx:
|
|
||||||
case DW_MACRO_undef_strx:
|
|
||||||
line = debug_macro_data.GetULEB128(offset);
|
|
||||||
str_offset = debug_macro_data.GetULEB128(offset);
|
|
||||||
if (!str_offsets_info)
|
|
||||||
// Can't do much in this case, skip all such entries
|
|
||||||
continue;
|
|
||||||
str_offset = str_offsets_info->GetOffset(str_offset);
|
|
||||||
macro_str = debug_str_data.GetCStr(&str_offset);
|
|
||||||
if (type == DW_MACRO_define_strx)
|
|
||||||
debug_macros_sp->AddMacroEntry(
|
|
||||||
DebugMacroEntry::CreateDefineEntry(line, macro_str));
|
|
||||||
else
|
|
||||||
debug_macros_sp->AddMacroEntry(
|
|
||||||
DebugMacroEntry::CreateUndefEntry(line, macro_str));
|
|
||||||
break;
|
|
||||||
case DW_MACRO_start_file:
|
case DW_MACRO_start_file:
|
||||||
line = debug_macro_data.GetULEB128(offset);
|
line = debug_macro_data.GetULEB128(offset);
|
||||||
debug_line_file_idx = debug_macro_data.GetULEB128(offset);
|
debug_line_file_idx = debug_macro_data.GetULEB128(offset);
|
||||||
|
@ -135,7 +113,7 @@ void DWARFDebugMacroEntry::ReadMacroEntries(
|
||||||
else
|
else
|
||||||
new_offset = debug_macro_data.GetU32(offset);
|
new_offset = debug_macro_data.GetU32(offset);
|
||||||
debug_macros_sp->AddMacroEntry(DebugMacroEntry::CreateIndirectEntry(
|
debug_macros_sp->AddMacroEntry(DebugMacroEntry::CreateIndirectEntry(
|
||||||
sym_file_dwarf->ParseDebugMacros(&new_offset, str_offsets_info)));
|
sym_file_dwarf->ParseDebugMacros(&new_offset)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO: Add support for other standard operations.
|
// TODO: Add support for other standard operations.
|
||||||
|
|
|
@ -24,17 +24,6 @@ class DWARFDataExtractor;
|
||||||
|
|
||||||
class SymbolFileDWARF;
|
class SymbolFileDWARF;
|
||||||
|
|
||||||
class DWARFStrOffsetsInfo {
|
|
||||||
lldb::offset_t cu_str_offset;
|
|
||||||
const lldb_private::DWARFDataExtractor &data;
|
|
||||||
|
|
||||||
public:
|
|
||||||
DWARFStrOffsetsInfo(lldb::offset_t cu_str_offset,
|
|
||||||
const lldb_private::DWARFDataExtractor &data)
|
|
||||||
: cu_str_offset(cu_str_offset), data(data) {}
|
|
||||||
uint64_t GetOffset(uint64_t index) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DWARFDebugMacroHeader {
|
class DWARFDebugMacroHeader {
|
||||||
public:
|
public:
|
||||||
enum HeaderFlagMask {
|
enum HeaderFlagMask {
|
||||||
|
@ -64,7 +53,6 @@ public:
|
||||||
static void
|
static void
|
||||||
ReadMacroEntries(const lldb_private::DWARFDataExtractor &debug_macro_data,
|
ReadMacroEntries(const lldb_private::DWARFDataExtractor &debug_macro_data,
|
||||||
const lldb_private::DWARFDataExtractor &debug_str_data,
|
const lldb_private::DWARFDataExtractor &debug_str_data,
|
||||||
const DWARFStrOffsetsInfo *str_offsets_info,
|
|
||||||
const bool offset_is_64_bit, lldb::offset_t *sect_offset,
|
const bool offset_is_64_bit, lldb::offset_t *sect_offset,
|
||||||
SymbolFileDWARF *sym_file_dwarf,
|
SymbolFileDWARF *sym_file_dwarf,
|
||||||
lldb_private::DebugMacrosSP &debug_macros_sp);
|
lldb_private::DebugMacrosSP &debug_macros_sp);
|
||||||
|
|
|
@ -1194,8 +1194,7 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit &comp_unit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
lldb_private::DebugMacrosSP
|
lldb_private::DebugMacrosSP
|
||||||
SymbolFileDWARF::ParseDebugMacros(lldb::offset_t *offset,
|
SymbolFileDWARF::ParseDebugMacros(lldb::offset_t *offset) {
|
||||||
const DWARFStrOffsetsInfo *str_offsets_info) {
|
|
||||||
auto iter = m_debug_macros_map.find(*offset);
|
auto iter = m_debug_macros_map.find(*offset);
|
||||||
if (iter != m_debug_macros_map.end())
|
if (iter != m_debug_macros_map.end())
|
||||||
return iter->second;
|
return iter->second;
|
||||||
|
@ -1211,8 +1210,8 @@ SymbolFileDWARF::ParseDebugMacros(lldb::offset_t *offset,
|
||||||
const DWARFDebugMacroHeader &header =
|
const DWARFDebugMacroHeader &header =
|
||||||
DWARFDebugMacroHeader::ParseHeader(debug_macro_data, offset);
|
DWARFDebugMacroHeader::ParseHeader(debug_macro_data, offset);
|
||||||
DWARFDebugMacroEntry::ReadMacroEntries(
|
DWARFDebugMacroEntry::ReadMacroEntries(
|
||||||
debug_macro_data, m_context.getOrLoadStrData(), str_offsets_info,
|
debug_macro_data, m_context.getOrLoadStrData(), header.OffsetIs64Bit(),
|
||||||
header.OffsetIs64Bit(), offset, this, debug_macros_sp);
|
offset, this, debug_macros_sp);
|
||||||
|
|
||||||
return debug_macros_sp;
|
return debug_macros_sp;
|
||||||
}
|
}
|
||||||
|
@ -1220,7 +1219,7 @@ SymbolFileDWARF::ParseDebugMacros(lldb::offset_t *offset,
|
||||||
bool SymbolFileDWARF::ParseDebugMacros(CompileUnit &comp_unit) {
|
bool SymbolFileDWARF::ParseDebugMacros(CompileUnit &comp_unit) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
|
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
|
||||||
|
|
||||||
DWARFUnit *dwarf_cu = &GetDWARFCompileUnit(&comp_unit)->GetNonSkeletonUnit();
|
DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
|
||||||
if (dwarf_cu == nullptr)
|
if (dwarf_cu == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1236,15 +1235,8 @@ bool SymbolFileDWARF::ParseDebugMacros(CompileUnit &comp_unit) {
|
||||||
if (sect_offset == DW_INVALID_OFFSET)
|
if (sect_offset == DW_INVALID_OFFSET)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::unique_ptr<DWARFStrOffsetsInfo> str_offsets_info;
|
comp_unit.SetDebugMacros(ParseDebugMacros(§_offset));
|
||||||
lldb::offset_t cu_str_offset = dwarf_cu->GetStrOffsetsBase();
|
|
||||||
SymbolFileDWARF &symfile = dwarf_cu->GetSymbolFileDWARF();
|
|
||||||
if (cu_str_offset && cu_str_offset != DW_INVALID_OFFSET)
|
|
||||||
str_offsets_info = std::make_unique<DWARFStrOffsetsInfo>(
|
|
||||||
cu_str_offset, symfile.GetDWARFContext().getOrLoadStrOffsetsData());
|
|
||||||
|
|
||||||
comp_unit.SetDebugMacros(
|
|
||||||
symfile.ParseDebugMacros(§_offset, str_offsets_info.get()));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,6 @@ class SymbolFileDWARFDebugMap;
|
||||||
class SymbolFileDWARFDwo;
|
class SymbolFileDWARFDwo;
|
||||||
class SymbolFileDWARFDwp;
|
class SymbolFileDWARFDwp;
|
||||||
|
|
||||||
class DWARFStrOffsetsInfo;
|
|
||||||
|
|
||||||
#define DIE_IS_BEING_PARSED ((lldb_private::Type *)1)
|
#define DIE_IS_BEING_PARSED ((lldb_private::Type *)1)
|
||||||
|
|
||||||
class SymbolFileDWARF : public lldb_private::SymbolFileCommon,
|
class SymbolFileDWARF : public lldb_private::SymbolFileCommon,
|
||||||
|
@ -248,9 +246,7 @@ public:
|
||||||
|
|
||||||
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu);
|
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu);
|
||||||
|
|
||||||
lldb_private::DebugMacrosSP
|
lldb_private::DebugMacrosSP ParseDebugMacros(lldb::offset_t *offset);
|
||||||
ParseDebugMacros(lldb::offset_t *offset,
|
|
||||||
const DWARFStrOffsetsInfo *str_offsets_info);
|
|
||||||
|
|
||||||
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die);
|
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,5 @@ DEBUG_INFO_FLAG = -g3 -gdwarf-5
|
||||||
# GCC produces incorrect .debug_macro section when "-include" option is used:
|
# GCC produces incorrect .debug_macro section when "-include" option is used:
|
||||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93075.
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93075.
|
||||||
NO_TEST_COMMON_H := 1
|
NO_TEST_COMMON_H := 1
|
||||||
CFLAGS_EXTRAS := -fdebug-macro
|
|
||||||
|
|
||||||
include Makefile.rules
|
include Makefile.rules
|
||||||
|
|
|
@ -8,6 +8,12 @@ from lldbsuite.test import lldbutil
|
||||||
|
|
||||||
class TestMacros(TestBase):
|
class TestMacros(TestBase):
|
||||||
|
|
||||||
|
@expectedFailureAll(
|
||||||
|
compiler="clang",
|
||||||
|
bugnumber="clang does not emit .debug_macro[.dwo] sections.")
|
||||||
|
@expectedFailureAll(
|
||||||
|
debug_info="dwo",
|
||||||
|
bugnumber="GCC produces multiple .debug_macro.dwo sections and the spec is unclear as to what it means")
|
||||||
@expectedFailureAll(
|
@expectedFailureAll(
|
||||||
hostoslist=["windows"],
|
hostoslist=["windows"],
|
||||||
compiler="gcc",
|
compiler="gcc",
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
C_SOURCES := main.c
|
|
||||||
CFLAGS_EXTRAS := -fdebug-macro
|
|
||||||
|
|
||||||
include Makefile.rules
|
|
|
@ -1,31 +0,0 @@
|
||||||
"""Tests lldb macro evaluation."""
|
|
||||||
|
|
||||||
import lldb
|
|
||||||
from lldbsuite.test.decorators import *
|
|
||||||
from lldbsuite.test.lldbtest import *
|
|
||||||
from lldbsuite.test import lldbutil
|
|
||||||
|
|
||||||
|
|
||||||
class MacroTestCase(TestBase):
|
|
||||||
|
|
||||||
mydir = TestBase.compute_mydir(__file__)
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
# Call super's setUp().
|
|
||||||
TestBase.setUp(self)
|
|
||||||
# Find the line number to break inside main().
|
|
||||||
self.line = line_number('main.c', '// Set break point at this line.')
|
|
||||||
|
|
||||||
def test(self):
|
|
||||||
self.build()
|
|
||||||
exe = self.getBuildArtifact("a.out")
|
|
||||||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
|
||||||
|
|
||||||
# Break inside the main.
|
|
||||||
lldbutil.run_break_set_by_file_and_line(
|
|
||||||
self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
|
|
||||||
|
|
||||||
self.runCmd("run", RUN_SUCCEEDED)
|
|
||||||
self.expect("expr DM + DF(10)", VARIABLES_DISPLAYED_CORRECTLY,
|
|
||||||
substrs=['int', '62'])
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#define DM 10
|
|
||||||
#define DF(x) (42 + (x))
|
|
||||||
|
|
||||||
int main (int argc, char const *argv[])
|
|
||||||
{
|
|
||||||
return 0; //// Set break point at this line.
|
|
||||||
}
|
|
Loading…
Reference in New Issue