[Lldb-commits] [PATCH] D86436: [lldb] Fix Type::GetByteSize for pointer types

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 27 06:41:32 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0de146337391: [lldb] Fix Type::GetByteSize for pointer types (authored by labath).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86436/new/

https://reviews.llvm.org/D86436

Files:
  lldb/source/Symbol/Type.cpp
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s


Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s
===================================================================
--- lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s
+++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s
@@ -5,10 +5,10 @@
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o %t
 # RUN: %lldb %t \
-# RUN:   -o "target variable udata data1 data2 data4 data8 string strp ref4" \
+# RUN:   -o "target variable udata data1 data2 data4 data8 string strp ref4 udata_ptr" \
 # RUN:   -o exit | FileCheck %s
 
-# CHECK-LABEL: target variable udata data1 data2 data4 data8 string strp ref4
+# CHECK-LABEL: target variable
 ## Variable specified via DW_FORM_udata. This is typical for clang (10).
 # CHECK: (unsigned long) udata = 4742474247424742
 ## Variables specified via fixed-size forms. This is typical for gcc (9).
@@ -22,6 +22,8 @@
 # CHECK: (char [7]) strp = "strp"
 ## Bogus attribute form. Let's make sure we don't crash at least.
 # CHECK: (char [7]) ref4 = <empty constant data>
+## A variable of pointer type.
+# CHECK: (unsigned long *) udata_ptr = 0xdeadbeefbaadf00d
 
         .section        .debug_abbrev,"", at progbits
         .byte   1                       # Abbreviation Code
@@ -33,6 +35,13 @@
         .byte   8                       # DW_FORM_string
         .byte   0                       # EOM(1)
         .byte   0                       # EOM(2)
+        .byte   2                       # Abbreviation Code
+        .byte   15                      # DW_TAG_pointer_type
+        .byte   0                       # DW_CHILDREN_no
+        .byte   73                      # DW_AT_type
+        .byte   19                      # DW_FORM_ref4
+        .byte   0                       # EOM(1)
+        .byte   0                       # EOM(2)
         .byte   4                       # Abbreviation Code
         .byte   1                       # DW_TAG_array_type
         .byte   1                       # DW_CHILDREN_yes
@@ -109,6 +118,9 @@
         .asciz  "unsigned long"         # DW_AT_name
         .byte   8                       # DW_AT_byte_size
         .byte   7                       # DW_AT_encoding
+.Lulong_ptr:
+        .byte   2                       # Abbrev DW_TAG_pointer_type
+        .long   .Lulong-.Lcu_begin0     # DW_AT_type
 
         .byte   10                      # Abbrev DW_TAG_variable
         .asciz  "udata"                 # DW_AT_name
@@ -150,6 +162,11 @@
         .long   .Lchar_arr-.Lcu_begin0  # DW_AT_type
         .long   .Lulong-.Lcu_begin0     # DW_AT_const_value
 
+        .byte   10                      # Abbrev DW_TAG_variable
+        .asciz  "udata_ptr"             # DW_AT_name
+        .long   .Lulong_ptr-.Lcu_begin0 # DW_AT_type
+        .uleb128 0xdeadbeefbaadf00d     # DW_AT_const_value
+
         .byte   0                       # End Of Children Mark
 .Ldebug_info_end0:
 
Index: lldb/source/Symbol/Type.cpp
===================================================================
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -375,6 +375,7 @@
       if (ArchSpec arch = m_symbol_file->GetObjectFile()->GetArchitecture()) {
         m_byte_size = arch.GetAddressByteSize();
         m_byte_size_has_value = true;
+        return m_byte_size;
       }
     } break;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86436.288311.patch
Type: text/x-patch
Size: 3311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200827/4a7fc656/attachment.bin>


More information about the lldb-commits mailing list