Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in PE/COFF plugin and ValueObjectVariable.
There are two bugs here. The first is that MSVC and clang-cl emit their bss section under the name '.data' instead of '.bss' but with the size and file offset set to 0. ObjectFilePECOFF didn't handle this, and would only recognize a section as bss if it was actually called '.bss'. The effect of this is that if we tried to print the value of a variable that lived in BSS we would fail. The second bug is that ValueObjectVariable was only returning the forward type, which is insufficient to print the value of an enum. So we bump this up to the layout type. Differential Revision: https://reviews.llvm.org/D54241 llvm-svn: 346430
- Loading branch information
Zachary Turner
committed
Nov 8, 2018
1 parent
056e4ab
commit 91dbd52
Showing
5 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target variable GlobalVariable | ||
|
||
quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters