[Lldb-commits] [lldb] c1f1db8 - [lldb] Add a host-independent test for handling -flimit-debug-info
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 2 06:51:29 PDT 2020
Author: Pavel Labath
Date: 2020-07-02T15:51:20+02:00
New Revision: c1f1db8502f1fc788eefeafd3dc225bd287ee4b9
URL: https://github.com/llvm/llvm-project/commit/c1f1db8502f1fc788eefeafd3dc225bd287ee4b9
DIFF: https://github.com/llvm/llvm-project/commit/c1f1db8502f1fc788eefeafd3dc225bd287ee4b9.diff
LOG: [lldb] Add a host-independent test for handling -flimit-debug-info
This complements the existing TestLimitDebugInfo.py, which tests this
scenario more comprehensively, but is not able to run on all hosts.
Specifically, it's hard to trigger this code from windows because clang
tries hard to ensure that debug info for types marked with
__declspec(dllexport) is emitted even under -flimit-debug-info (and
dllexport is needed to use a type across shared libraries).
This assembly-based test serves two purposes:
- it tests that -flimit-debug-info code path works for windows binaries
(even though the aforementioned feature means its less likely to be
used there)
- it gives basic test coverage for the -flimit-debug-info handling code
when running the test suite on windows hosts.
Added:
lldb/test/Shell/SymbolFile/DWARF/limit-debug-info.s
Modified:
Removed:
################################################################################
diff --git a/lldb/test/Shell/SymbolFile/DWARF/limit-debug-info.s b/lldb/test/Shell/SymbolFile/DWARF/limit-debug-info.s
new file mode 100644
index 000000000000..b14d6106cf06
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/limit-debug-info.s
@@ -0,0 +1,131 @@
+# REQUIRES: lld, x86
+# RUN: llvm-mc --triple=x86_64-pc-windows --filetype=obj --defsym DLL=0 %s >%t.dll.o
+# RUN: llvm-mc --triple=x86_64-pc-windows --filetype=obj --defsym EXE=0 %s >%t.exe.o
+# RUN: lld-link /OUT:%t.dll %t.dll.o /SUBSYSTEM:console /dll /noentry /debug
+# RUN: lld-link /OUT:%t.exe %t.exe.o /SUBSYSTEM:console /debug /force
+# RUN: %lldb %t.exe -o "target modules add %t.dll" -o "p var" \
+# RUN: -o exit 2>&1 | FileCheck %s
+
+# CHECK: (lldb) p var
+# CHECK: (A) $0 = (member = 47)
+
+ .section .debug_abbrev,"dr"
+.Lsection_abbrev:
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 8 # DW_FORM_string
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 52 # DW_TAG_variable
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 2 # DW_AT_location
+ .byte 24 # DW_FORM_exprloc
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 19 # DW_TAG_structure_type
+ .byte 1 # DW_CHILDREN_yes
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 4 # Abbreviation Code
+ .byte 13 # DW_TAG_member
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 56 # DW_AT_data_member_location
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 5 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 6 # Abbreviation Code
+ .byte 19 # DW_TAG_structure_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 8 # DW_FORM_string
+ .byte 60 # DW_AT_declaration
+ .byte 25 # DW_FORM_flag_present
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+
+.ifdef DLL
+ .section .debug_info,"dr"
+.Lsection_info:
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+ .short 4 # DWARF version number
+ .secrel32 .Lsection_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x4a DW_TAG_compile_unit
+ .asciz "Hand-written DWARF" # DW_AT_producer
+ .byte 3 # Abbrev [3] 0x37:0x16 DW_TAG_structure_type
+ .asciz "A" # DW_AT_name
+ .byte 4 # DW_AT_byte_size
+ .byte 4 # Abbrev [4] 0x40:0xc DW_TAG_member
+ .asciz "member" # DW_AT_name
+ .long .Lint-.Lsection_info # DW_AT_type
+ .byte 0 # DW_AT_data_member_location
+ .byte 0 # End Of Children Mark
+.Lint:
+ .byte 5 # Abbrev [5] 0x4d:0x7 DW_TAG_base_type
+ .asciz "int" # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
+.Ldebug_info_end0:
+.endif
+
+.ifdef EXE
+ .data
+ .globl var
+ .p2align 2
+var:
+ .long 47
+
+ .section .debug_info,"dr"
+.Lsection_info:
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+ .short 4 # DWARF version number
+ .secrel32 .Lsection_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x4a DW_TAG_compile_unit
+ .asciz "Hand-written DWARF" # DW_AT_producer
+ .byte 2 # Abbrev [2] 0x1e:0x19 DW_TAG_variable
+ .asciz "var" # DW_AT_name
+ .long .LA-.Lsection_info # DW_AT_type
+ .byte 9 # DW_AT_location
+ .byte 3
+ .quad var
+.LA:
+ .byte 6 # Abbrev [6] 0x37:0x16 DW_TAG_structure_type
+ .asciz "A" # DW_AT_name
+ # DW_AT_declaration
+ .byte 0 # End Of Children Mark
+.Ldebug_info_end0:
+.endif
More information about the lldb-commits
mailing list