<div dir="ltr"><div dir="ltr">I don't think it's this particular change that caused it, but every so often this test fails for me locally. <div><br></div><div><div>Command Output (stderr):</div><div>--</div><div>/Users/jonas/llvm/llvm-project/lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s:24:17: error: SYMBOLS-NEXT: is not on the line after the previous match</div><div># SYMBOLS-NEXT: 3fffffff/TYPE/00000018 "ENUM0"</div><div> ^</div><div><stdin>:109:1: note: 'next' match was here</div><div>3fffffff/TYPE/00000018 "ENUM0"</div><div>^</div><div><stdin>:105:7: note: previous match ended here</div><div>Types:</div><div> ^</div><div><stdin>:106:1: note: non-matching line after previous match is here</div><div>3fffffff/TYPE/0000002d "int"</div><div>^</div><div>--</div></div><div><br></div><div>From the output it looks like "int" gets printed before "ENUM0"? </div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 21, 2020 at 7:01 AM Pavel Labath via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
Author: Pavel Labath<br>
Date: 2020-02-21T16:01:17+01:00<br>
New Revision: de8793b9184ece0d24f46bc2d86711092848f938<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/de8793b9184ece0d24f46bc2d86711092848f938" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/de8793b9184ece0d24f46bc2d86711092848f938</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/de8793b9184ece0d24f46bc2d86711092848f938.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/de8793b9184ece0d24f46bc2d86711092848f938.diff</a><br>
<br>
LOG: [lldb/DWARF] Add support for type units in dwp files<br>
<br>
all that was needed was to teach lldb's DWARF context about the<br>
debug_tu_index section.<br>
<br>
Added: <br>
lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s<br>
<br>
Modified: <br>
lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp<br>
lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp<br>
index 79601e3bad0d..37e28a09f3c4 100644<br>
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp<br>
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp<br>
@@ -45,6 +45,11 @@ const DWARFDataExtractor &DWARFContext::getOrLoadCuIndexData() {<br>
m_data_debug_cu_index);<br>
}<br>
<br>
+const DWARFDataExtractor &DWARFContext::getOrLoadTuIndexData() {<br>
+ return LoadOrGetSection(llvm::None, eSectionTypeDWARFDebugTuIndex,<br>
+ m_data_debug_tu_index);<br>
+}<br>
+<br>
const DWARFDataExtractor &DWARFContext::getOrLoadAbbrevData() {<br>
return LoadOrGetSection(eSectionTypeDWARFDebugAbbrev,<br>
eSectionTypeDWARFDebugAbbrevDwo, m_data_debug_abbrev);<br>
@@ -134,6 +139,7 @@ llvm::DWARFContext &DWARFContext::GetAsLLVM() {<br>
<br>
AddSection("debug_line_str", getOrLoadLineStrData());<br>
AddSection("debug_cu_index", getOrLoadCuIndexData());<br>
+ AddSection("debug_tu_index", getOrLoadTuIndexData());<br>
<br>
m_llvm_context = llvm::DWARFContext::create(section_map, addr_size);<br>
}<br>
<br>
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h<br>
index 8de5e9c8a5fb..92161a21d167 100644<br>
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h<br>
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h<br>
@@ -42,6 +42,7 @@ class DWARFContext {<br>
SectionData m_data_debug_rnglists;<br>
SectionData m_data_debug_str;<br>
SectionData m_data_debug_str_offsets;<br>
+ SectionData m_data_debug_tu_index;<br>
SectionData m_data_debug_types;<br>
<br>
const DWARFDataExtractor &<br>
@@ -50,6 +51,7 @@ class DWARFContext {<br>
SectionData &data);<br>
<br>
const DWARFDataExtractor &getOrLoadCuIndexData();<br>
+ const DWARFDataExtractor &getOrLoadTuIndexData();<br>
<br>
public:<br>
explicit DWARFContext(SectionList *main_section_list,<br>
<br>
diff --git a/lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s b/lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s<br>
new file mode 100644<br>
index 000000000000..fd009381b452<br>
--- /dev/null<br>
+++ b/lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s<br>
@@ -0,0 +1,211 @@<br>
+# REQUIRES: x86<br>
+<br>
+# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t --defsym MAIN=0<br>
+# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t.dwp --defsym DWP=0<br>
+# RUN: %lldb %t -o "type lookup ENUM0" -o "target variable A" -b | FileCheck %s<br>
+<br>
+# CHECK-LABEL: type lookup ENUM0<br>
+# CHECK-NEXT: enum ENUM0 {<br>
+# CHECK-NEXT: case0<br>
+# CHECK-NEXT: }<br>
+<br>
+# CHECK-LABEL: target variable A<br>
+# CHECK: (ENUM0) A = case0<br>
+# CHECK: (ENUM1) A = case0<br>
+<br>
+.ifdef MAIN<br>
+ .section .debug_abbrev,"",@progbits<br>
+ .byte 1 # Abbreviation Code<br>
+ .byte 17 # DW_TAG_compile_unit<br>
+ .byte 0 # DW_CHILDREN_no<br>
+ .ascii "\260B" # DW_AT_GNU_dwo_name<br>
+ .byte 8 # DW_FORM_string<br>
+ .ascii "\261B" # DW_AT_GNU_dwo_id<br>
+ .byte 7 # DW_FORM_data8<br>
+ .ascii "\263B" # DW_AT_GNU_addr_base<br>
+ .byte 23 # DW_FORM_sec_offset<br>
+ .byte 0 # EOM(1)<br>
+ .byte 0 # EOM(2)<br>
+ .byte 0 # EOM(3)<br>
+<br>
+.irpc I,01<br>
+ .data<br>
+A\I:<br>
+ .long 0<br>
+<br>
+ .section .debug_info,"",@progbits<br>
+.Lcu_begin\I:<br>
+ .long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit<br>
+.Ldebug_info_start\I:<br>
+ .short 4 # DWARF version number<br>
+ .long .debug_abbrev # Offset Into Abbrev. Section<br>
+ .byte 8 # Address Size (in bytes)<br>
+ .byte 1 # Abbrev [1] DW_TAG_compile_unit<br>
+ .asciz "A.dwo" # DW_AT_GNU_dwo_name<br>
+ .quad \I # DW_AT_GNU_dwo_id<br>
+ .long .debug_addr # DW_AT_GNU_addr_base<br>
+.Ldebug_info_end\I:<br>
+<br>
+ .section .debug_addr,"",@progbits<br>
+ .quad A\I<br>
+<br>
+.endr<br>
+.endif<br>
+<br>
+.ifdef DWP<br>
+.irpc I,01<br>
+ .section .debug_abbrev.dwo,"e",@progbits<br>
+.Labbrev\I:<br>
+ .byte \I*10+1 # Abbreviation Code<br>
+ .byte 17 # DW_TAG_compile_unit<br>
+ .byte 1 # DW_CHILDREN_yes<br>
+ .byte 37 # DW_AT_producer<br>
+ .byte 8 # DW_FORM_string<br>
+ .byte 3 # DW_AT_name<br>
+ .byte 8 # DW_FORM_string<br>
+ .byte 0 # EOM(1)<br>
+ .byte 0 # EOM(2)<br>
+ .byte \I*10+2 # Abbreviation Code<br>
+ .byte 52 # DW_TAG_variable<br>
+ .byte 0 # DW_CHILDREN_no<br>
+ .byte 3 # DW_AT_name<br>
+ .byte 8 # DW_FORM_string<br>
+ .byte 73 # DW_AT_type<br>
+ .byte 19 # DW_FORM_ref4<br>
+ .byte 2 # DW_AT_location<br>
+ .byte 24 # DW_FORM_exprloc<br>
+ .byte 0 # EOM(1)<br>
+ .byte 0 # EOM(2)<br>
+ .byte \I*10+3 # Abbreviation Code<br>
+ .byte 4 # DW_TAG_enumeration_type<br>
+ .byte 0 # DW_CHILDREN_no<br>
+ .byte 60 # DW_AT_declaration<br>
+ .byte 25 # DW_FORM_flag_present<br>
+ .byte 105 # DW_AT_signature<br>
+ .byte 32 # DW_FORM_ref_sig8<br>
+ .byte 0 # EOM(1)<br>
+ .byte 0 # EOM(2)<br>
+ .byte \I*10+4 # Abbreviation Code<br>
+ .byte 4 # DW_TAG_enumeration_type<br>
+ .byte 1 # DW_CHILDREN_yes<br>
+ .byte 73 # DW_AT_type<br>
+ .byte 19 # DW_FORM_ref4<br>
+ .byte 3 # DW_AT_name<br>
+ .byte 8 # DW_FORM_string<br>
+ .byte 11 # DW_AT_byte_size<br>
+ .byte 11 # DW_FORM_data1<br>
+ .byte 0 # EOM(1)<br>
+ .byte 0 # EOM(2)<br>
+ .byte \I*10+5 # Abbreviation Code<br>
+ .byte 40 # DW_TAG_enumerator<br>
+ .byte 0 # DW_CHILDREN_no<br>
+ .byte 3 # DW_AT_name<br>
+ .byte 8 # DW_FORM_string<br>
+ .byte 28 # DW_AT_const_value<br>
+ .byte 15 # DW_FORM_udata<br>
+ .byte 0 # EOM(1)<br>
+ .byte 0 # EOM(2)<br>
+ .byte \I*10+6 # Abbreviation Code<br>
+ .byte 36 # DW_TAG_base_type<br>
+ .byte 0 # DW_CHILDREN_no<br>
+ .byte 3 # DW_AT_name<br>
+ .byte 8 # DW_FORM_string<br>
+ .byte 62 # DW_AT_encoding<br>
+ .byte 11 # DW_FORM_data1<br>
+ .byte 11 # DW_AT_byte_size<br>
+ .byte 11 # DW_FORM_data1<br>
+ .byte 0 # EOM(1)<br>
+ .byte 0 # EOM(2)<br>
+ .byte \I*10+7 # Abbreviation Code<br>
+ .byte 65 # DW_TAG_type_unit<br>
+ .byte 1 # DW_CHILDREN_yes<br>
+ .byte 0 # EOM(1)<br>
+ .byte 0 # EOM(2)<br>
+ .byte 0 # EOM(3)<br>
+.Labbrev_end\I:<br>
+<br>
+ .section .debug_info.dwo,"e",@progbits<br>
+.Lcu_begin\I:<br>
+ .long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit<br>
+.Ldebug_info_start\I:<br>
+ .short 4 # DWARF version number<br>
+ .long 0 # Offset Into Abbrev. Section<br>
+ .byte 8 # Address Size (in bytes)<br>
+ .byte \I*10+1 # Abbrev DW_TAG_compile_unit<br>
+ .asciz "Hand-written DWARF" # DW_AT_producer<br>
+ .byte '0'+\I, '.', 'c', 0 # DW_AT_name<br>
+ .byte \I*10+2 # Abbrev DW_TAG_variable<br>
+ .asciz "A" # DW_AT_name<br>
+ .long .Lenum_ref\I-.Lcu_begin\I# DW_AT_type<br>
+ .byte 2 # DW_AT_location<br>
+ .byte 0xfb # DW_OP_GNU_addr_index<br>
+ .byte \I<br>
+<br>
+.Lenum_ref\I:<br>
+ .byte \I*10+3 # Abbrev DW_TAG_enumeration_type<br>
+ .quad \I # DW_AT_signature<br>
+<br>
+ .byte 0 # End Of Children Mark<br>
+.Ldebug_info_end\I:<br>
+<br>
+ .section .debug_types.dwo,"e",@progbits<br>
+.Ltu_begin\I:<br>
+ .long .Ltype_info_end\I-.Ltype_info_start\I # Length of Unit<br>
+.Ltype_info_start\I:<br>
+ .short 4 # DWARF version number<br>
+ .long 0 # Offset Into Abbrev. Section<br>
+ .byte 8 # Address Size (in bytes)<br>
+ .quad \I # Type Signature<br>
+ .long .Lenum\I-.Ltu_begin\I # Type DIE Offset<br>
+ .byte \I*10+7 # Abbrev DW_TAG_type_unit<br>
+<br>
+.Lenum\I:<br>
+ .byte \I*10+4 # Abbrev DW_TAG_enumeration_type<br>
+ .long .Lint\I-.Ltu_begin\I # DW_AT_type<br>
+ .byte 'E', 'N', 'U', 'M', '0'+\I, 0# DW_AT_name<br>
+ .byte 4 # DW_AT_byte_size<br>
+<br>
+ .byte \I*10+5 # Abbrev DW_TAG_enumerator<br>
+ .asciz "case0" # DW_AT_name<br>
+ .byte 0 # DW_AT_const_value<br>
+ .byte 0 # End Of Children Mark<br>
+<br>
+.Lint\I:<br>
+ .byte \I*10+6 # Abbrev DW_TAG_base_type<br>
+ .asciz "int" # DW_AT_name<br>
+ .byte 7 # DW_AT_encoding<br>
+ .byte 4 # DW_AT_byte_size<br>
+<br>
+ .byte 0 # End Of Children Mark<br>
+.Ltype_info_end\I:<br>
+.endr<br>
+<br>
+.macro index dw_sect, section, contrib, contrib_end<br>
+ .short 2 # DWARF version number<br>
+ .short 0 # Reserved<br>
+ .long 2 # Section count<br>
+ .long 2 # Unit count<br>
+ .long 4 # Slot count<br>
+<br>
+ .quad 0, 1, 0, 0 # Hash table<br>
+ .long 1, 2, 0, 0 # Index table<br>
+<br>
+ .long \dw_sect<br>
+ .long 3 # DW_SECT_ABBREV<br>
+<br>
+.irpc I,01<br>
+ .long \contrib\I-\section<br>
+ .long .Labbrev\I-.debug_abbrev.dwo<br>
+.endr<br>
+.irpc I,01<br>
+ .long \contrib_end\I-\contrib\I<br>
+ .long .Labbrev_end\I-.Labbrev\I<br>
+.endr<br>
+.endmacro<br>
+<br>
+ .section .debug_cu_index,"e",@progbits<br>
+ index 1, .debug_info.dwo, .Lcu_begin, .Ldebug_info_end<br>
+<br>
+ .section .debug_tu_index,"e",@progbits<br>
+ index 2, .debug_types.dwo, .Ltu_begin, .Ltype_info_end<br>
+.endif<br>
<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>