summaryrefslogtreecommitdiffstats
path: root/lldb/lit/SymbolFile
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-05-24 08:04:03 +0000
committerPavel Labath <pavel@labath.sk>2019-05-24 08:04:03 +0000
commit8ac0bc9832a251837681b3a1cd53085ed8d594dc (patch)
tree9d06b0fcf6d3ca6066f24f574e1aa6c080b7933f /lldb/lit/SymbolFile
parentb087129b5d3bde08ddaefa021bbefb2f152ed409 (diff)
downloadbcm5719-llvm-8ac0bc9832a251837681b3a1cd53085ed8d594dc.tar.gz
bcm5719-llvm-8ac0bc9832a251837681b3a1cd53085ed8d594dc.zip
DWARFContext: Make loading of sections thread-safe
Summary: SymbolFileDWARF used to load debug sections in a thread-safe manner. When we moved to DWARFContext, we dropped the thread-safe part, because we thought it was not necessary. It turns out this was only mostly correct. The "mostly" part is there because this is a problem only if we use the manual index, as that is the only source of intra-module paralelism. Also, this only seems to occur for extremely simple files (like the ones I've been creating for tests lately), where we've managed to start indexing before loading the debug_str section. Then, two threads start to load the section simultaneously and produce wrong results. On more complex files, something seems to be loading the debug_str section before we start indexing, as I haven't been able to reproduce this there, but I have not investigated what it is. I've tried to come up with a test for this, but I haven't been able to reproduce the problem reliably. Still, while doing so, I created a way to generate many compile units on demand. Given that most of our tests work with only one or two compile units, it seems like this could be useful anyway. Reviewers: aprantl, JDevlieghere, clayborg Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D62316 llvm-svn: 361602
Diffstat (limited to 'lldb/lit/SymbolFile')
-rw-r--r--lldb/lit/SymbolFile/DWARF/parallel-indexing-stress.s82
1 files changed, 82 insertions, 0 deletions
diff --git a/lldb/lit/SymbolFile/DWARF/parallel-indexing-stress.s b/lldb/lit/SymbolFile/DWARF/parallel-indexing-stress.s
new file mode 100644
index 00000000000..46e4c5565fd
--- /dev/null
+++ b/lldb/lit/SymbolFile/DWARF/parallel-indexing-stress.s
@@ -0,0 +1,82 @@
+# Stress-test the parallel indexing of compile units.
+
+# RUN: llvm-mc -triple x86_64-pc-linux %s -o %t -filetype=obj
+# RUN: %lldb %t -o "target variable A" -b | FileCheck %s
+
+# CHECK-COUNT-256: A = 47
+
+ .section .debug_str,"MS",@progbits,1
+.Linfo_string0:
+ .asciz "Hand-written DWARF"
+.Lname:
+ .asciz "A"
+.Linfo_string4:
+ .asciz "int" # string offset=95
+
+ .section .debug_abbrev,"",@progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 14 # DW_FORM_strp
+ .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 14 # DW_FORM_strp
+ .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 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .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 0 # EOM(3)
+
+.macro generate_unit
+ .data
+A\@:
+ .long 47
+
+ .section .debug_str,"MS",@progbits,1
+
+ .section .debug_info,"",@progbits
+.Lcu_begin\@:
+ .long .Ldebug_info_end\@-.Ldebug_info_start\@ # Length of Unit
+.Ldebug_info_start\@:
+ .short 4 # DWARF version number
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x30 DW_TAG_compile_unit
+ .long .Linfo_string0 # DW_AT_producer
+ .byte 2 # Abbrev [2] 0x1e:0x15 DW_TAG_variable
+ .long .Lname # DW_AT_name
+ .long .Ltype\@-.Lcu_begin\@ # DW_AT_type
+ .byte 9 # DW_AT_location
+ .byte 3
+ .quad A\@
+.Ltype\@:
+ .byte 3 # Abbrev [3] 0x33:0x7 DW_TAG_base_type
+ .long .Linfo_string4 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
+.Ldebug_info_end\@:
+
+.endm
+
+.rept 256
+generate_unit
+.endr
OpenPOWER on IntegriCloud