From ca591dea1085a173386771fd07a96e5a23d6d2b6 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Thu, 8 Nov 2018 22:47:40 +0000 Subject: [PATCH] Revert "Fix bug in PE/COFF plugin and ValueObjectVariable." It breaks some tests on MacOS. llvm-svn: 346444 --- .../NativePDB/Inputs/globals-bss.lldbinit | 3 -- .../NativePDB/ast-reconstruction.cpp | 15 ++++---- lldb/lit/SymbolFile/NativePDB/globals-bss.cpp | 35 ------------------- lldb/source/Core/ValueObjectVariable.cpp | 13 ++----- .../ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 6 +--- 5 files changed, 11 insertions(+), 61 deletions(-) delete mode 100644 lldb/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit delete mode 100644 lldb/lit/SymbolFile/NativePDB/globals-bss.cpp diff --git a/lldb/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit b/lldb/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit deleted file mode 100644 index 9bf066ee2af9..000000000000 --- a/lldb/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit +++ /dev/null @@ -1,3 +0,0 @@ -target variable GlobalVariable - -quit diff --git a/lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp b/lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp index 535c316db768..d3d36749e840 100644 --- a/lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp +++ b/lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp @@ -89,23 +89,22 @@ Anonymous>::D AnonABCVoidD; // CHECK: (TrivialC) TC = {} // CHECK: (TrivialS) TS = {} // CHECK: (TrivialU) TU = {} -// CHECK: (TrivialE) TE = TE_A -// CHECK: (A::B::C) ABCInt = (ABCMember = 0) -// CHECK: (A::B::C) ABCFloat = (ABCMember = 0) -// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 0x0000000000000000) +// CHECK: (TrivialE) TE = +// CHECK: (A::B::C) ABCInt = (ABCMember = ) +// CHECK: (A::B::C) ABCFloat = (ABCMember = ) +// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = ) // CHECK: (A::C<0>) AC0 = {} // CHECK: (A::C<-1>) ACNeg1 = {} -// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x0000000000000000) -// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x0000000000000000) +// CHECK: (A::C<0>::D) AC0D = (ACDMember = , CPtr = ) +// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = ) // CHECK: (A::D) AD = {} -// CHECK: (A::D::E) ADE = (ADDMember = 0) +// CHECK: (A::D::E) ADE = (ADDMember = ) // CHECK: Dumping clang ast for 1 modules. // CHECK: TranslationUnitDecl {{.*}} // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition // CHECK: |-EnumDecl {{.*}} TrivialE -// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'int' // CHECK: |-NamespaceDecl {{.*}} A // CHECK: | |-NamespaceDecl {{.*}} B // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition diff --git a/lldb/lit/SymbolFile/NativePDB/globals-bss.cpp b/lldb/lit/SymbolFile/NativePDB/globals-bss.cpp deleted file mode 100644 index 57149b966814..000000000000 --- a/lldb/lit/SymbolFile/NativePDB/globals-bss.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// clang-format off -// REQUIRES: lld - -// Make sure we can read variables from BSS -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s -// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj -// RUN: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s -// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ -// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s - -int GlobalVariable = 0; - -int main(int argc, char **argv) { - return 0; -} - -// BSS: Section { -// BSS: Number: 3 -// BSS: Name: .data -// BSS-NEXT: VirtualSize: 0x4 -// BSS-NEXT: VirtualAddress: -// BSS-NEXT: RawDataSize: 0 -// BSS-NEXT: PointerToRawData: 0x0 -// BSS-NEXT: PointerToRelocations: 0x0 -// BSS-NEXT: PointerToLineNumbers: 0x0 -// BSS-NEXT: RelocationCount: 0 -// BSS-NEXT: LineNumberCount: 0 -// BSS-NEXT: Characteristics [ (0xC0000040) -// BSS-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40) -// BSS-NEXT: IMAGE_SCN_MEM_READ (0x40000000) -// BSS-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000) -// BSS-NEXT: ] -// BSS-NEXT: } - -// CHECK: (int) GlobalVariable = 0 diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 229cdd8bacdc..2f017aa36f7b 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -66,16 +66,9 @@ ValueObjectVariable::~ValueObjectVariable() {} CompilerType ValueObjectVariable::GetCompilerTypeImpl() { Type *var_type = m_variable_sp->GetType(); - if (!var_type) - return CompilerType(); - - // It's important to return the layout type here. If we have an enum then the - // symbol file plugin may have decided to complete it lazily, in which case a - // forward type won't be sufficient to display the variable. On the other - // hand, if we have a pointer to a class type, then getting the full type will - // resolve the class type, which is too much. The layout type is both - // necessary and sufficient. - return var_type->GetLayoutCompilerType(); + if (var_type) + return var_type->GetForwardCompilerType(); + return CompilerType(); } ConstString ValueObjectVariable::GetTypeName() { diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 78d03e27d8f5..40637574e4bf 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -710,10 +710,7 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) { llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA && ((const_sect_name == g_data_sect_name) || (const_sect_name == g_DATA_sect_name))) { - if (m_sect_headers[idx].size == 0 && m_sect_headers[idx].offset == 0) - section_type = eSectionTypeZeroFill; - else - section_type = eSectionTypeData; + section_type = eSectionTypeData; } else if (m_sect_headers[idx].flags & llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA && ((const_sect_name == g_bss_sect_name) || @@ -1056,7 +1053,6 @@ ObjectFile::Type ObjectFilePECOFF::CalculateType() { } ObjectFile::Strata ObjectFilePECOFF::CalculateStrata() { return eStrataUser; } - //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------