Skip to content

Commit 37cd9ff

Browse files
committed
[lldb] Prefer DW_AT_bit_size over DW_AT_byte_size in GetDIEBitSizeAndSign
1 parent db3c8d6 commit 37cd9ff

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,9 @@ DWARFUnit::GetDIEBitSizeAndSign(uint64_t relative_die_offset) const {
707707
return llvm::createStringError("cannot resolve DW_OP_convert type DIE");
708708
uint64_t encoding =
709709
die.GetAttributeValueAsUnsigned(DW_AT_encoding, DW_ATE_hi_user);
710-
uint64_t bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
710+
uint64_t bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0);
711711
if (!bit_size)
712-
bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0);
712+
bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
713713
if (!bit_size)
714714
return llvm::createStringError("unsupported type size");
715715
bool sign;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %clang_host -O3 -ggdb -o %t %s
2+
// RUN: %lldb %t \
3+
// RUN: -o "b 17" \
4+
// RUN: -o r \
5+
// RUN: -o "p t" \
6+
// RUN: -o exit | FileCheck %s
7+
8+
// CHECK: (lldb) p t
9+
// CHECK-NEXT: (int) 1
10+
11+
int a, b, c;
12+
int d(int e) { return e; }
13+
int main() {
14+
int t;
15+
c = d(1);
16+
t = 1 && c;
17+
b = t & a;
18+
return 0;
19+
}

0 commit comments

Comments
 (0)