From bda2e9e90207fb9077d07cfbf8d69af2b8e95109 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Wed, 17 Feb 2021 05:56:56 -0800 Subject: [PATCH 1/3] [EH] Change catch_all's opcode We decided to change `catch_all`'s opcode from 0x05, which is the same as `else`, to 0x19, to avoid some complicated handling in the tools. See: https://github.com/WebAssembly/exception-handling/issues/147 --- dwarf_with_exceptions.wasm was added in #3496 but we didn't comment on how that file was created, so I'll add some comment on that here, in case we need to regenerate this file with some modifications. I regenerated dwarf_with_exceptions.wasm, so some variable names and such have changed. cpp file: ```cpp void foo(); void test_debuginfo() { try { foo(); } catch (...) { foo(); } } ``` Run: ``` $ clang++ -std=c++14 -stdlib=libc++ --target=wasm32-unknown-unknown -fwasm-exceptions -Xclang -disable-O0-optnone -c -S -emit-llvm test_debuginfo.cpp -o temp.ll $ opt -S -mem2reg -simplifycfg temp.ll -o test_debuginfo.ll ``` (`opt -mem2reg -simplifycfg` was run to make the code little tidier. This basically promotes stack loads/saves to registers and simplifies the CFG.) Resulting ll file, after modifying some function names and removing personal info in directory names: ```llvm source_filename = "test_debuginfo.cpp" target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" $__clang_call_terminate = comdat any ; Function Attrs: noinline mustprogress define hidden void @test_debuginfo() #0 personality i8* bitcast (i32 (...)* @__gxx_wasm_personality_v0 to i8*) !dbg !7 { entry: invoke void @foo() to label %try.cont unwind label %catch.dispatch, !dbg !10 catch.dispatch: ; preds = %entry %0 = catchswitch within none [label %catch.start] unwind to caller, !dbg !12 catch.start: ; preds = %catch.dispatch %1 = catchpad within %0 [i8* null], !dbg !12 %2 = call i8* @llvm.wasm.get.exception(token %1), !dbg !12 %3 = call i32 @llvm.wasm.get.ehselector(token %1), !dbg !12 %4 = call i8* @__cxa_begin_catch(i8* %2) #2 [ "funclet"(token %1) ], !dbg !12 invoke void @foo() [ "funclet"(token %1) ] to label %invoke.cont1 unwind label %ehcleanup, !dbg !13 invoke.cont1: ; preds = %catch.start call void @__cxa_end_catch() [ "funclet"(token %1) ], !dbg !15 catchret from %1 to label %try.cont, !dbg !15 try.cont: ; preds = %entry, %invoke.cont1 ret void, !dbg !16 ehcleanup: ; preds = %catch.start %5 = cleanuppad within %1 [], !dbg !15 invoke void @__cxa_end_catch() [ "funclet"(token %5) ] to label %invoke.cont2 unwind label %terminate, !dbg !15 invoke.cont2: ; preds = %ehcleanup cleanupret from %5 unwind to caller, !dbg !15 terminate: ; preds = %ehcleanup %6 = cleanuppad within %5 [], !dbg !15 %7 = call i8* @llvm.wasm.get.exception(token %6), !dbg !15 call void @__clang_call_terminate(i8* %7) #5 [ "funclet"(token %6) ], !dbg !15 unreachable, !dbg !15 } declare void @foo() #1 declare i32 @__gxx_wasm_personality_v0(...) ; Function Attrs: nounwind declare i8* @llvm.wasm.get.exception(token) #2 ; Function Attrs: nounwind declare i32 @llvm.wasm.get.ehselector(token) #2 ; Function Attrs: nounwind readnone declare i32 @llvm.eh.typeid.for(i8*) #3 declare i8* @__cxa_begin_catch(i8*) declare void @__cxa_end_catch() ; Function Attrs: noinline noreturn nounwind define linkonce_odr hidden void @__clang_call_terminate(i8* %0) #4 comdat { %2 = call i8* @__cxa_begin_catch(i8* %0) #2 call void @_ZSt9terminatev() #5 unreachable } declare void @_ZSt9terminatev() attributes #0 = { noinline mustprogress "disable-tail-calls"="false" "frame-pointer"="none" "min-legal-vector-width"="0" "no-jump-tables"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+exception-handling" } attributes #1 = { "disable-tail-calls"="false" "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+exception-handling" } attributes #2 = { nounwind } attributes #3 = { nounwind readnone } attributes #4 = { noinline noreturn nounwind } attributes #5 = { noreturn nounwind } !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3, !4, !5} !llvm.ident = !{!6} !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) !1 = !DIFile(filename: "test_debuginfo.cpp", directory: "/") !2 = !{} !3 = !{i32 7, !"Dwarf Version", i32 4} !4 = !{i32 2, !"Debug Info Version", i32 3} !5 = !{i32 1, !"wchar_size", i32 4} !6 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)"} !7 = distinct !DISubprogram(name: "test_debuginfo", linkageName: "test_debuginfo", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) !8 = !DISubroutineType(types: !9) !9 = !{null} !10 = !DILocation(line: 5, column: 5, scope: !11) !11 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 7) !12 = !DILocation(line: 6, column: 3, scope: !11) !13 = !DILocation(line: 7, column: 5, scope: !14) !14 = distinct !DILexicalBlock(scope: !7, file: !1, line: 6, column: 17) !15 = !DILocation(line: 8, column: 3, scope: !14) !16 = !DILocation(line: 9, column: 1, scope: !7) ``` Run: ``` $ llc -exception-model=wasm -mattr=+exception-handling -filetype=obj test_debuginfo.ll -o test_debuginfo.o $ wasm-ld --no-entry --no-gc-sections --allow-undefined test_debuginfo.o -o test_debuginfo.wasm ``` --- src/wasm-binary.h | 4 +- src/wasm/wasm-binary.cpp | 7 +- test/passes/dwarf_with_exceptions.bin.txt | 279 +++++++++++----------- test/passes/dwarf_with_exceptions.wasm | Bin 1072 -> 1029 bytes 4 files changed, 142 insertions(+), 148 deletions(-) diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 811524d2d28..99305acb22e 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1026,7 +1026,7 @@ enum ASTNodes { Try = 0x06, Catch = 0x07, - CatchAll = 0x05, + CatchAll = 0x19, Delegate = 0x18, Throw = 0x08, Rethrow = 0x09, @@ -1617,4 +1617,4 @@ class WasmBinaryBuilder { #undef DEBUG_TYPE -#endif // wasm_wasm_binary_h \ No newline at end of file +#endif // wasm_wasm_binary_h diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index b843aad0363..dc0b1ab21ad 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2967,16 +2967,13 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) { } break; case BinaryConsts::Else: - case BinaryConsts::Catch: { + case BinaryConsts::Catch: + case BinaryConsts::CatchAll: { curr = nullptr; if (DWARF && currFunction) { assert(!controlFlowStack.empty()); auto currControlFlow = controlFlowStack.back(); BinaryLocation delimiterId; - // Else and CatchAll have the same binary ID, so differentiate them - // using the control flow stack. - static_assert(BinaryConsts::CatchAll == BinaryConsts::Else, - "Else and CatchAll should have identical codes"); if (currControlFlow->is()) { delimiterId = BinaryLocations::Else; } else { diff --git a/test/passes/dwarf_with_exceptions.bin.txt b/test/passes/dwarf_with_exceptions.bin.txt index 9b853e17911..257e04bbd69 100644 --- a/test/passes/dwarf_with_exceptions.bin.txt +++ b/test/passes/dwarf_with_exceptions.bin.txt @@ -7,8 +7,7 @@ (import "env" "__cxa_end_catch" (func $__cxa_end_catch)) (import "env" "_ZSt9terminatev" (func $std::terminate\28\29)) (memory $0 2) - (table $0 1 1 funcref) - (global $global$0 (mut i32) (i32.const 66560)) + (global $__stack_pointer (mut i32) (i32.const 66560)) (event $event$0 (attr 0) (param i32)) (export "memory" (memory $0)) (func $__wasm_call_ctors @@ -19,7 +18,7 @@ ;; code offset: 0xe (local.set $0 ;; code offset: 0x8 - (global.get $global$0) + (global.get $__stack_pointer) ) ;; code offset: 0x10 (try $label$9 @@ -34,7 +33,7 @@ (pop i32) ) ;; code offset: 0x22 - (global.set $global$0 + (global.set $__stack_pointer ;; code offset: 0x20 (local.get $0) ) @@ -52,7 +51,7 @@ ;; code offset: 0x33 (call $foo) ;; code offset: 0x3b - (global.set $global$0 + (global.set $__stack_pointer ;; code offset: 0x39 (local.get $0) ) @@ -72,7 +71,7 @@ (pop i32) ) ;; code offset: 0x54 - (global.set $global$0 + (global.set $__stack_pointer ;; code offset: 0x52 (local.get $0) ) @@ -117,18 +116,18 @@ ) ;; custom section ".debug_info", size 63 ;; custom section ".debug_abbrev", size 41 - ;; custom section ".debug_line", size 92 - ;; custom section ".debug_str", size 194 - ;; custom section "producers", size 137 - ;; features section: exception-handling, reference-types + ;; custom section ".debug_line", size 104 + ;; custom section ".debug_str", size 141 + ;; custom section "producers", size 138 + ;; features section: exception-handling ) DWARF debug info ================ Contains section .debug_info (63 bytes) Contains section .debug_abbrev (41 bytes) -Contains section .debug_line (92 bytes) -Contains section .debug_str (194 bytes) +Contains section .debug_line (104 bytes) +Contains section .debug_str (141 bytes) .debug_abbrev contents: Abbrev table for offset: 0x00000000 @@ -156,11 +155,11 @@ Abbrev table for offset: 0x00000000 0x00000000: Compile Unit: length = 0x0000003b version = 0x0004 abbr_offset = 0x0000 addr_size = 0x04 (next unit at 0x0000003f) 0x0000000b: DW_TAG_compile_unit [1] * - DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 12.0.0 (https://github.com/aheejin/llvm-project e74a5010a507b737fcbd40e87cde358f2c9fc812)") + DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)") DW_AT_language [DW_FORM_data2] (DW_LANG_C_plus_plus_14) - DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000068] = "test.cpp") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000069] = "test_debuginfo.cpp") DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) - DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000071] = "/usr/local/google/home/aheejin/llvm-git/llvm/tw") + DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000007c] = "/") DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000072) @@ -168,10 +167,10 @@ Abbrev table for offset: 0x00000000 DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000072) DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_WASM_location 0x0 +0, DW_OP_stack_value) - DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x000000a1] = "test_debuginfo") - DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000b0] = "test_terminatepad") - DW_AT_decl_file [DW_FORM_data1] ("/usr/local/google/home/aheejin/llvm-git/llvm/tw/test.cpp") - DW_AT_decl_line [DW_FORM_data1] (2) + DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "test_debuginfo") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "test_debuginfo") + DW_AT_decl_file [DW_FORM_data1] ("/test_debuginfo.cpp") + DW_AT_decl_line [DW_FORM_data1] (3) DW_AT_external [DW_FORM_flag_present] (true) 0x0000003e: NULL @@ -179,9 +178,9 @@ Abbrev table for offset: 0x00000000 .debug_line contents: debug_line[0x00000000] Line table prologue: - total_length: 0x00000058 + total_length: 0x00000064 version: 4 - prologue_length: 0x00000020 + prologue_length: 0x0000002a min_inst_length: 1 max_ops_per_inst: 1 default_is_stmt: 1 @@ -201,82 +200,82 @@ standard_opcode_lengths[DW_LNS_set_prologue_end] = 0 standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0 standard_opcode_lengths[DW_LNS_set_isa] = 1 file_names[ 1]: - name: "test.cpp" + name: "test_debuginfo.cpp" dir_index: 0 mod_time: 0x00000000 length: 0x00000000 -0x0000002a: 00 DW_LNE_set_address (0x0000000000000005) -0x00000031: 13 address += 0, line += 1 - 0x0000000000000005 2 0 1 0 0 is_stmt - -0x00000032: 05 DW_LNS_set_column (5) -0x00000034: 0a DW_LNS_set_prologue_end -0x00000035: ae address += 11, line += 2 - 0x0000000000000010 4 5 1 0 0 is_stmt prologue_end - -0x00000036: 05 DW_LNS_set_column (3) -0x00000038: 83 address += 8, line += 1 - 0x0000000000000018 5 3 1 0 0 is_stmt - -0x00000039: 05 DW_LNS_set_column (5) -0x0000003b: 08 DW_LNS_const_add_pc (0x0000000000000011) -0x0000003c: 83 address += 8, line += 1 - 0x0000000000000031 6 5 1 0 0 is_stmt - -0x0000003d: 06 DW_LNS_negate_stmt -0x0000003e: 03 DW_LNS_advance_line (0) -0x00000040: 82 address += 8, line += 0 +0x00000034: 00 DW_LNE_set_address (0x0000000000000005) +0x0000003b: 14 address += 0, line += 2 + 0x0000000000000005 3 0 1 0 0 is_stmt + +0x0000003c: 05 DW_LNS_set_column (5) +0x0000003e: 0a DW_LNS_set_prologue_end +0x0000003f: ae address += 11, line += 2 + 0x0000000000000010 5 5 1 0 0 is_stmt prologue_end + +0x00000040: 05 DW_LNS_set_column (3) +0x00000042: 83 address += 8, line += 1 + 0x0000000000000018 6 3 1 0 0 is_stmt + +0x00000043: 05 DW_LNS_set_column (5) +0x00000045: 08 DW_LNS_const_add_pc (0x0000000000000011) +0x00000046: 83 address += 8, line += 1 + 0x0000000000000031 7 5 1 0 0 is_stmt + +0x00000047: 06 DW_LNS_negate_stmt +0x00000048: 03 DW_LNS_advance_line (0) +0x0000004a: 82 address += 8, line += 0 0x0000000000000039 0 5 1 0 0 -0x00000041: 05 DW_LNS_set_column (3) -0x00000043: 06 DW_LNS_negate_stmt -0x00000044: 89 address += 8, line += 7 - 0x0000000000000041 7 3 1 0 0 is_stmt +0x0000004b: 05 DW_LNS_set_column (3) +0x0000004d: 06 DW_LNS_negate_stmt +0x0000004e: 8a address += 8, line += 8 + 0x0000000000000041 8 3 1 0 0 is_stmt -0x00000045: 06 DW_LNS_negate_stmt -0x00000046: 03 DW_LNS_advance_line (0) -0x00000048: 02 DW_LNS_advance_pc (42) -0x0000004a: 01 DW_LNS_copy +0x0000004f: 06 DW_LNS_negate_stmt +0x00000050: 03 DW_LNS_advance_line (0) +0x00000052: 02 DW_LNS_advance_pc (42) +0x00000054: 01 DW_LNS_copy 0x000000000000006b 0 3 1 0 0 -0x0000004b: 27 address += 1, line += 7 - 0x000000000000006c 7 3 1 0 0 +0x00000055: 28 address += 1, line += 8 + 0x000000000000006c 8 3 1 0 0 -0x0000004c: 03 DW_LNS_advance_line (0) -0x0000004e: 2e address += 2, line += 0 +0x00000056: 03 DW_LNS_advance_line (0) +0x00000058: 2e address += 2, line += 0 0x000000000000006e 0 3 1 0 0 -0x0000004f: 27 address += 1, line += 7 - 0x000000000000006f 7 3 1 0 0 +0x00000059: 28 address += 1, line += 8 + 0x000000000000006f 8 3 1 0 0 -0x00000050: 03 DW_LNS_advance_line (0) -0x00000052: 66 address += 6, line += 0 +0x0000005a: 03 DW_LNS_advance_line (0) +0x0000005c: 66 address += 6, line += 0 0x0000000000000075 0 3 1 0 0 -0x00000053: 05 DW_LNS_set_column (1) -0x00000055: 06 DW_LNS_negate_stmt -0x00000056: 28 address += 1, line += 8 - 0x0000000000000076 8 1 1 0 0 is_stmt +0x0000005d: 05 DW_LNS_set_column (1) +0x0000005f: 06 DW_LNS_negate_stmt +0x00000060: 03 DW_LNS_advance_line (9) +0x00000062: 20 address += 1, line += 0 + 0x0000000000000076 9 1 1 0 0 is_stmt -0x00000057: 02 DW_LNS_advance_pc (1) -0x00000059: 00 DW_LNE_end_sequence - 0x0000000000000077 8 1 1 0 0 is_stmt end_sequence +0x00000063: 02 DW_LNS_advance_pc (1) +0x00000065: 00 DW_LNE_end_sequence + 0x0000000000000077 9 1 1 0 0 is_stmt end_sequence .debug_str contents: -0x00000000: "clang version 12.0.0 (https://github.com/aheejin/llvm-project e74a5010a507b737fcbd40e87cde358f2c9fc812)" -0x00000068: "test.cpp" -0x00000071: "/usr/local/google/home/aheejin/llvm-git/llvm/tw" -0x000000a1: "test_debuginfo" -0x000000b0: "test_terminatepad" +0x00000000: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)" +0x00000069: "test_debuginfo.cpp" +0x0000007c: "/" +0x0000007e: "test_debuginfo" DWARF debug info ================ Contains section .debug_info (63 bytes) Contains section .debug_abbrev (41 bytes) -Contains section .debug_line (145 bytes) -Contains section .debug_str (194 bytes) +Contains section .debug_line (155 bytes) +Contains section .debug_str (141 bytes) .debug_abbrev contents: Abbrev table for offset: 0x00000000 @@ -304,11 +303,11 @@ Abbrev table for offset: 0x00000000 0x00000000: Compile Unit: length = 0x0000003b version = 0x0004 abbr_offset = 0x0000 addr_size = 0x04 (next unit at 0x0000003f) 0x0000000b: DW_TAG_compile_unit [1] * - DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 12.0.0 (https://github.com/aheejin/llvm-project e74a5010a507b737fcbd40e87cde358f2c9fc812)") + DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)") DW_AT_language [DW_FORM_data2] (DW_LANG_C_plus_plus_14) - DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000068] = "test.cpp") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000069] = "test_debuginfo.cpp") DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) - DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000071] = "/usr/local/google/home/aheejin/llvm-git/llvm/tw") + DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000007c] = "/") DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000040) @@ -316,10 +315,10 @@ Abbrev table for offset: 0x00000000 DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000040) DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_WASM_location 0x0 +0, DW_OP_stack_value) - DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x000000a1] = "test_debuginfo") - DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000b0] = "test_terminatepad") - DW_AT_decl_file [DW_FORM_data1] ("/usr/local/google/home/aheejin/llvm-git/llvm/tw/test.cpp") - DW_AT_decl_line [DW_FORM_data1] (2) + DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "test_debuginfo") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "test_debuginfo") + DW_AT_decl_file [DW_FORM_data1] ("/test_debuginfo.cpp") + DW_AT_decl_line [DW_FORM_data1] (3) DW_AT_external [DW_FORM_flag_present] (true) 0x0000003e: NULL @@ -327,9 +326,9 @@ Abbrev table for offset: 0x00000000 .debug_line contents: debug_line[0x00000000] Line table prologue: - total_length: 0x0000008d + total_length: 0x00000097 version: 4 - prologue_length: 0x00000020 + prologue_length: 0x0000002a min_inst_length: 1 max_ops_per_inst: 1 default_is_stmt: 1 @@ -349,77 +348,76 @@ standard_opcode_lengths[DW_LNS_set_prologue_end] = 0 standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0 standard_opcode_lengths[DW_LNS_set_isa] = 1 file_names[ 1]: - name: "test.cpp" + name: "test_debuginfo.cpp" dir_index: 0 mod_time: 0x00000000 length: 0x00000000 -0x0000002a: 00 DW_LNE_set_address (0x0000000000000005) -0x00000031: 03 DW_LNS_advance_line (2) -0x00000033: 01 DW_LNS_copy - 0x0000000000000005 2 0 1 0 0 is_stmt +0x00000034: 00 DW_LNE_set_address (0x0000000000000005) +0x0000003b: 03 DW_LNS_advance_line (3) +0x0000003d: 01 DW_LNS_copy + 0x0000000000000005 3 0 1 0 0 is_stmt -0x00000034: 00 DW_LNE_set_address (0x000000000000000e) -0x0000003b: 03 DW_LNS_advance_line (4) -0x0000003d: 05 DW_LNS_set_column (5) -0x0000003f: 0a DW_LNS_set_prologue_end -0x00000040: 01 DW_LNS_copy - 0x000000000000000e 4 5 1 0 0 is_stmt prologue_end +0x0000003e: 00 DW_LNE_set_address (0x000000000000000e) +0x00000045: 03 DW_LNS_advance_line (5) +0x00000047: 05 DW_LNS_set_column (5) +0x00000049: 0a DW_LNS_set_prologue_end +0x0000004a: 01 DW_LNS_copy + 0x000000000000000e 5 5 1 0 0 is_stmt prologue_end -0x00000041: 00 DW_LNE_set_address (0x0000000000000012) -0x00000048: 03 DW_LNS_advance_line (5) -0x0000004a: 05 DW_LNS_set_column (3) -0x0000004c: 01 DW_LNS_copy - 0x0000000000000012 5 3 1 0 0 is_stmt +0x0000004b: 00 DW_LNE_set_address (0x0000000000000012) +0x00000052: 03 DW_LNS_advance_line (6) +0x00000054: 05 DW_LNS_set_column (3) +0x00000056: 01 DW_LNS_copy + 0x0000000000000012 6 3 1 0 0 is_stmt -0x0000004d: 00 DW_LNE_set_address (0x000000000000001f) -0x00000054: 03 DW_LNS_advance_line (6) -0x00000056: 05 DW_LNS_set_column (5) -0x00000058: 01 DW_LNS_copy - 0x000000000000001f 6 5 1 0 0 is_stmt +0x00000057: 00 DW_LNE_set_address (0x000000000000001f) +0x0000005e: 03 DW_LNS_advance_line (7) +0x00000060: 05 DW_LNS_set_column (5) +0x00000062: 01 DW_LNS_copy + 0x000000000000001f 7 5 1 0 0 is_stmt -0x00000059: 00 DW_LNE_set_address (0x000000000000003e) -0x00000060: 03 DW_LNS_advance_line (7) -0x00000062: 05 DW_LNS_set_column (3) -0x00000064: 06 DW_LNS_negate_stmt -0x00000065: 01 DW_LNS_copy - 0x000000000000003e 7 3 1 0 0 +0x00000063: 00 DW_LNE_set_address (0x000000000000003e) +0x0000006a: 03 DW_LNS_advance_line (8) +0x0000006c: 05 DW_LNS_set_column (3) +0x0000006e: 06 DW_LNS_negate_stmt +0x0000006f: 01 DW_LNS_copy + 0x000000000000003e 8 3 1 0 0 -0x00000066: 00 DW_LNE_set_address (0x0000000000000041) -0x0000006d: 01 DW_LNS_copy - 0x0000000000000041 7 3 1 0 0 +0x00000070: 00 DW_LNE_set_address (0x0000000000000041) +0x00000077: 01 DW_LNS_copy + 0x0000000000000041 8 3 1 0 0 -0x0000006e: 00 DW_LNE_set_address (0x0000000000000044) -0x00000075: 03 DW_LNS_advance_line (8) -0x00000077: 05 DW_LNS_set_column (1) -0x00000079: 06 DW_LNS_negate_stmt -0x0000007a: 01 DW_LNS_copy - 0x0000000000000044 8 1 1 0 0 is_stmt +0x00000078: 00 DW_LNE_set_address (0x0000000000000044) +0x0000007f: 03 DW_LNS_advance_line (9) +0x00000081: 05 DW_LNS_set_column (1) +0x00000083: 06 DW_LNS_negate_stmt +0x00000084: 01 DW_LNS_copy + 0x0000000000000044 9 1 1 0 0 is_stmt -0x0000007b: 00 DW_LNE_set_address (0x0000000000000045) -0x00000082: 01 DW_LNS_copy - 0x0000000000000045 8 1 1 0 0 is_stmt +0x00000085: 00 DW_LNE_set_address (0x0000000000000045) +0x0000008c: 01 DW_LNS_copy + 0x0000000000000045 9 1 1 0 0 is_stmt -0x00000083: 00 DW_LNE_set_address (0x00000000ffffff61) -0x0000008a: 03 DW_LNS_advance_line (7) -0x0000008c: 05 DW_LNS_set_column (3) -0x0000008e: 00 DW_LNE_end_sequence - 0x00000000ffffff61 7 3 1 0 0 is_stmt end_sequence +0x0000008d: 00 DW_LNE_set_address (0x00000000ffffff68) +0x00000094: 03 DW_LNS_advance_line (8) +0x00000096: 05 DW_LNS_set_column (3) +0x00000098: 00 DW_LNE_end_sequence + 0x00000000ffffff68 8 3 1 0 0 is_stmt end_sequence .debug_str contents: -0x00000000: "clang version 12.0.0 (https://github.com/aheejin/llvm-project e74a5010a507b737fcbd40e87cde358f2c9fc812)" -0x00000068: "test.cpp" -0x00000071: "/usr/local/google/home/aheejin/llvm-git/llvm/tw" -0x000000a1: "test_debuginfo" -0x000000b0: "test_terminatepad" +0x00000000: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)" +0x00000069: "test_debuginfo.cpp" +0x0000007c: "/" +0x0000007e: "test_debuginfo" (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) @@ -429,8 +427,7 @@ file_names[ 1]: (import "env" "__cxa_end_catch" (func $__cxa_end_catch)) (import "env" "_ZSt9terminatev" (func $std::terminate\28\29)) (memory $0 2) - (table $0 1 1 funcref) - (global $global$0 (mut i32) (i32.const 66560)) + (global $__stack_pointer (mut i32) (i32.const 66560)) (event $event$0 (attr 0) (param i32)) (export "memory" (memory $0)) (func $__wasm_call_ctors @@ -441,7 +438,7 @@ file_names[ 1]: ;; code offset: 0xc (local.set $0 ;; code offset: 0xa - (global.get $global$0) + (global.get $__stack_pointer) ) ;; code offset: 0xe (try $label$9 @@ -456,7 +453,7 @@ file_names[ 1]: (pop i32) ) ;; code offset: 0x18 - (global.set $global$0 + (global.set $__stack_pointer ;; code offset: 0x16 (local.get $0) ) @@ -474,7 +471,7 @@ file_names[ 1]: ;; code offset: 0x21 (call $foo) ;; code offset: 0x25 - (global.set $global$0 + (global.set $__stack_pointer ;; code offset: 0x23 (local.get $0) ) @@ -494,7 +491,7 @@ file_names[ 1]: (pop i32) ) ;; code offset: 0x32 - (global.set $global$0 + (global.set $__stack_pointer ;; code offset: 0x30 (local.get $0) ) @@ -539,8 +536,8 @@ file_names[ 1]: ) ;; custom section ".debug_info", size 63 ;; custom section ".debug_abbrev", size 41 - ;; custom section ".debug_line", size 145 - ;; custom section ".debug_str", size 194 - ;; custom section "producers", size 137 - ;; features section: exception-handling, reference-types + ;; custom section ".debug_line", size 155 + ;; custom section ".debug_str", size 141 + ;; custom section "producers", size 138 + ;; features section: exception-handling ) diff --git a/test/passes/dwarf_with_exceptions.wasm b/test/passes/dwarf_with_exceptions.wasm index c5ab0000c2c724bc05c90e58069a081335e67b0e..983eb40ef616a3d172caa2716c119b6bf84c989c 100755 GIT binary patch delta 449 zcmbtRyH3ME5WMr{oCie&ijYEO3M2@M?Ab2{Ihjlnrv_9YkzfkZ?@MKA>| zKY;iFeuQsHfkUX$veJxpr`Q?oepVhU&vHKDusQ$UEogCC4Zx~y^E242-4(+U5akk{ zG}MO4g*)*{7)Zejy#!kM7u*r#R}Q2XnJkW18?c6prh#$o1EU$nm6?ui9x&3Mbd+f= zxQ{ZkfQO-us)hyugy0R<{v1-3u#igMn2IC~B58E({2ev#!*Dw8EU6tQ(WPL@^aEws ztjCV5zBRCzV>=^GhgM&>!>&89Ip-s4^&H3H!Z`p+q-rf~XH5j)1(qZo3wT`y$crMl zNeIg*afP2RG;h1S1woyVR8e+C;wX?xB;YmY=op=^VtW6LxmQ;-@r5FuplXtc6drDg QjEPtkw`gBb$%_~GKlFxxtpET3 delta 534 zcmcIgOHRWu5RH?%t%?94I6zrZK8@3FO4%cE16Wn5Gx=2c;W$NQ(MnV-*iq#Ghzp=@ zI0h@u!GZ-VHaKY!Ct&0^<2NI}XZyaqEI$UN0!9%+Xc3qQFW&b>`Z_;xq*Yvtf(4j> z{JSZ9NYc}@=qv@0oZ9GY=4_}Y3=@0cxdB{?enF~cQ-r>^HnV~SFdO*50)r Date: Wed, 17 Feb 2021 15:35:13 -0800 Subject: [PATCH 2/3] Update dwarf_with_exceptions.wasm --- test/passes/dwarf_with_exceptions.bin.txt | 143 +++++++++++----------- test/passes/dwarf_with_exceptions.wasm | Bin 1029 -> 1047 bytes 2 files changed, 72 insertions(+), 71 deletions(-) diff --git a/test/passes/dwarf_with_exceptions.bin.txt b/test/passes/dwarf_with_exceptions.bin.txt index 257e04bbd69..a0dfd2d26f5 100644 --- a/test/passes/dwarf_with_exceptions.bin.txt +++ b/test/passes/dwarf_with_exceptions.bin.txt @@ -2,7 +2,7 @@ (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (import "env" "foo" (func $foo)) + (import "env" "_Z3foov" (func $foo\28\29)) (import "env" "__cxa_begin_catch" (func $__cxa_begin_catch (param i32) (result i32))) (import "env" "__cxa_end_catch" (func $__cxa_end_catch)) (import "env" "_ZSt9terminatev" (func $std::terminate\28\29)) @@ -12,7 +12,7 @@ (export "memory" (memory $0)) (func $__wasm_call_ctors ) - (func $test_debuginfo + (func $test_debuginfo\28\29 (local $0 i32) (local $1 i32) ;; code offset: 0xe @@ -24,7 +24,7 @@ (try $label$9 (do ;; code offset: 0x12 - (call $foo) + (call $foo\28\29) ) ;; code offset: 0x18 (catch $event$0 @@ -49,7 +49,7 @@ (try $label$8 (do ;; code offset: 0x33 - (call $foo) + (call $foo\28\29) ;; code offset: 0x3b (global.set $__stack_pointer ;; code offset: 0x39 @@ -116,9 +116,9 @@ ) ;; custom section ".debug_info", size 63 ;; custom section ".debug_abbrev", size 41 - ;; custom section ".debug_line", size 104 - ;; custom section ".debug_str", size 141 - ;; custom section "producers", size 138 + ;; custom section ".debug_line", size 102 + ;; custom section ".debug_str", size 157 + ;; custom section "producers", size 134 ;; features section: exception-handling ) DWARF debug info @@ -126,8 +126,8 @@ DWARF debug info Contains section .debug_info (63 bytes) Contains section .debug_abbrev (41 bytes) -Contains section .debug_line (104 bytes) -Contains section .debug_str (141 bytes) +Contains section .debug_line (102 bytes) +Contains section .debug_str (157 bytes) .debug_abbrev contents: Abbrev table for offset: 0x00000000 @@ -155,11 +155,11 @@ Abbrev table for offset: 0x00000000 0x00000000: Compile Unit: length = 0x0000003b version = 0x0004 abbr_offset = 0x0000 addr_size = 0x04 (next unit at 0x0000003f) 0x0000000b: DW_TAG_compile_unit [1] * - DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)") + DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 13.0.0 (https://github.com/llvm/llvm-project 3c4c205060c9398da705eb71b63ddd8a04999de9)") DW_AT_language [DW_FORM_data2] (DW_LANG_C_plus_plus_14) - DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000069] = "test_debuginfo.cpp") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "test_debuginfo.cpp") DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) - DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000007c] = "/") + DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000078] = "/") DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000072) @@ -167,10 +167,10 @@ Abbrev table for offset: 0x00000000 DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000072) DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_WASM_location 0x0 +0, DW_OP_stack_value) - DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "test_debuginfo") - DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "test_debuginfo") + DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000007a] = "_Z14test_debuginfov") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008e] = "test_debuginfo") DW_AT_decl_file [DW_FORM_data1] ("/test_debuginfo.cpp") - DW_AT_decl_line [DW_FORM_data1] (3) + DW_AT_decl_line [DW_FORM_data1] (2) DW_AT_external [DW_FORM_flag_present] (true) 0x0000003e: NULL @@ -178,7 +178,7 @@ Abbrev table for offset: 0x00000000 .debug_line contents: debug_line[0x00000000] Line table prologue: - total_length: 0x00000064 + total_length: 0x00000062 version: 4 prologue_length: 0x0000002a min_inst_length: 1 @@ -205,22 +205,22 @@ file_names[ 1]: mod_time: 0x00000000 length: 0x00000000 0x00000034: 00 DW_LNE_set_address (0x0000000000000005) -0x0000003b: 14 address += 0, line += 2 - 0x0000000000000005 3 0 1 0 0 is_stmt +0x0000003b: 13 address += 0, line += 1 + 0x0000000000000005 2 0 1 0 0 is_stmt 0x0000003c: 05 DW_LNS_set_column (5) 0x0000003e: 0a DW_LNS_set_prologue_end 0x0000003f: ae address += 11, line += 2 - 0x0000000000000010 5 5 1 0 0 is_stmt prologue_end + 0x0000000000000010 4 5 1 0 0 is_stmt prologue_end 0x00000040: 05 DW_LNS_set_column (3) 0x00000042: 83 address += 8, line += 1 - 0x0000000000000018 6 3 1 0 0 is_stmt + 0x0000000000000018 5 3 1 0 0 is_stmt 0x00000043: 05 DW_LNS_set_column (5) 0x00000045: 08 DW_LNS_const_add_pc (0x0000000000000011) 0x00000046: 83 address += 8, line += 1 - 0x0000000000000031 7 5 1 0 0 is_stmt + 0x0000000000000031 6 5 1 0 0 is_stmt 0x00000047: 06 DW_LNS_negate_stmt 0x00000048: 03 DW_LNS_advance_line (0) @@ -229,8 +229,8 @@ file_names[ 1]: 0x0000004b: 05 DW_LNS_set_column (3) 0x0000004d: 06 DW_LNS_negate_stmt -0x0000004e: 8a address += 8, line += 8 - 0x0000000000000041 8 3 1 0 0 is_stmt +0x0000004e: 89 address += 8, line += 7 + 0x0000000000000041 7 3 1 0 0 is_stmt 0x0000004f: 06 DW_LNS_negate_stmt 0x00000050: 03 DW_LNS_advance_line (0) @@ -239,15 +239,15 @@ file_names[ 1]: 0x000000000000006b 0 3 1 0 0 -0x00000055: 28 address += 1, line += 8 - 0x000000000000006c 8 3 1 0 0 +0x00000055: 27 address += 1, line += 7 + 0x000000000000006c 7 3 1 0 0 0x00000056: 03 DW_LNS_advance_line (0) 0x00000058: 2e address += 2, line += 0 0x000000000000006e 0 3 1 0 0 -0x00000059: 28 address += 1, line += 8 - 0x000000000000006f 8 3 1 0 0 +0x00000059: 27 address += 1, line += 7 + 0x000000000000006f 7 3 1 0 0 0x0000005a: 03 DW_LNS_advance_line (0) 0x0000005c: 66 address += 6, line += 0 @@ -255,27 +255,27 @@ file_names[ 1]: 0x0000005d: 05 DW_LNS_set_column (1) 0x0000005f: 06 DW_LNS_negate_stmt -0x00000060: 03 DW_LNS_advance_line (9) -0x00000062: 20 address += 1, line += 0 - 0x0000000000000076 9 1 1 0 0 is_stmt +0x00000060: 28 address += 1, line += 8 + 0x0000000000000076 8 1 1 0 0 is_stmt -0x00000063: 02 DW_LNS_advance_pc (1) -0x00000065: 00 DW_LNE_end_sequence - 0x0000000000000077 9 1 1 0 0 is_stmt end_sequence +0x00000061: 02 DW_LNS_advance_pc (1) +0x00000063: 00 DW_LNE_end_sequence + 0x0000000000000077 8 1 1 0 0 is_stmt end_sequence .debug_str contents: -0x00000000: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)" -0x00000069: "test_debuginfo.cpp" -0x0000007c: "/" -0x0000007e: "test_debuginfo" +0x00000000: "clang version 13.0.0 (https://github.com/llvm/llvm-project 3c4c205060c9398da705eb71b63ddd8a04999de9)" +0x00000065: "test_debuginfo.cpp" +0x00000078: "/" +0x0000007a: "_Z14test_debuginfov" +0x0000008e: "test_debuginfo" DWARF debug info ================ Contains section .debug_info (63 bytes) Contains section .debug_abbrev (41 bytes) Contains section .debug_line (155 bytes) -Contains section .debug_str (141 bytes) +Contains section .debug_str (157 bytes) .debug_abbrev contents: Abbrev table for offset: 0x00000000 @@ -303,11 +303,11 @@ Abbrev table for offset: 0x00000000 0x00000000: Compile Unit: length = 0x0000003b version = 0x0004 abbr_offset = 0x0000 addr_size = 0x04 (next unit at 0x0000003f) 0x0000000b: DW_TAG_compile_unit [1] * - DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)") + DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 13.0.0 (https://github.com/llvm/llvm-project 3c4c205060c9398da705eb71b63ddd8a04999de9)") DW_AT_language [DW_FORM_data2] (DW_LANG_C_plus_plus_14) - DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000069] = "test_debuginfo.cpp") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "test_debuginfo.cpp") DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) - DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000007c] = "/") + DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000078] = "/") DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000040) @@ -315,10 +315,10 @@ Abbrev table for offset: 0x00000000 DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000040) DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_WASM_location 0x0 +0, DW_OP_stack_value) - DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "test_debuginfo") - DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "test_debuginfo") + DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000007a] = "_Z14test_debuginfov") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008e] = "test_debuginfo") DW_AT_decl_file [DW_FORM_data1] ("/test_debuginfo.cpp") - DW_AT_decl_line [DW_FORM_data1] (3) + DW_AT_decl_line [DW_FORM_data1] (2) DW_AT_external [DW_FORM_flag_present] (true) 0x0000003e: NULL @@ -353,76 +353,77 @@ file_names[ 1]: mod_time: 0x00000000 length: 0x00000000 0x00000034: 00 DW_LNE_set_address (0x0000000000000005) -0x0000003b: 03 DW_LNS_advance_line (3) +0x0000003b: 03 DW_LNS_advance_line (2) 0x0000003d: 01 DW_LNS_copy - 0x0000000000000005 3 0 1 0 0 is_stmt + 0x0000000000000005 2 0 1 0 0 is_stmt 0x0000003e: 00 DW_LNE_set_address (0x000000000000000e) -0x00000045: 03 DW_LNS_advance_line (5) +0x00000045: 03 DW_LNS_advance_line (4) 0x00000047: 05 DW_LNS_set_column (5) 0x00000049: 0a DW_LNS_set_prologue_end 0x0000004a: 01 DW_LNS_copy - 0x000000000000000e 5 5 1 0 0 is_stmt prologue_end + 0x000000000000000e 4 5 1 0 0 is_stmt prologue_end 0x0000004b: 00 DW_LNE_set_address (0x0000000000000012) -0x00000052: 03 DW_LNS_advance_line (6) +0x00000052: 03 DW_LNS_advance_line (5) 0x00000054: 05 DW_LNS_set_column (3) 0x00000056: 01 DW_LNS_copy - 0x0000000000000012 6 3 1 0 0 is_stmt + 0x0000000000000012 5 3 1 0 0 is_stmt 0x00000057: 00 DW_LNE_set_address (0x000000000000001f) -0x0000005e: 03 DW_LNS_advance_line (7) +0x0000005e: 03 DW_LNS_advance_line (6) 0x00000060: 05 DW_LNS_set_column (5) 0x00000062: 01 DW_LNS_copy - 0x000000000000001f 7 5 1 0 0 is_stmt + 0x000000000000001f 6 5 1 0 0 is_stmt 0x00000063: 00 DW_LNE_set_address (0x000000000000003e) -0x0000006a: 03 DW_LNS_advance_line (8) +0x0000006a: 03 DW_LNS_advance_line (7) 0x0000006c: 05 DW_LNS_set_column (3) 0x0000006e: 06 DW_LNS_negate_stmt 0x0000006f: 01 DW_LNS_copy - 0x000000000000003e 8 3 1 0 0 + 0x000000000000003e 7 3 1 0 0 0x00000070: 00 DW_LNE_set_address (0x0000000000000041) 0x00000077: 01 DW_LNS_copy - 0x0000000000000041 8 3 1 0 0 + 0x0000000000000041 7 3 1 0 0 0x00000078: 00 DW_LNE_set_address (0x0000000000000044) -0x0000007f: 03 DW_LNS_advance_line (9) +0x0000007f: 03 DW_LNS_advance_line (8) 0x00000081: 05 DW_LNS_set_column (1) 0x00000083: 06 DW_LNS_negate_stmt 0x00000084: 01 DW_LNS_copy - 0x0000000000000044 9 1 1 0 0 is_stmt + 0x0000000000000044 8 1 1 0 0 is_stmt 0x00000085: 00 DW_LNE_set_address (0x0000000000000045) 0x0000008c: 01 DW_LNS_copy - 0x0000000000000045 9 1 1 0 0 is_stmt + 0x0000000000000045 8 1 1 0 0 is_stmt -0x0000008d: 00 DW_LNE_set_address (0x00000000ffffff68) -0x00000094: 03 DW_LNS_advance_line (8) +0x0000008d: 00 DW_LNE_set_address (0x00000000ffffff64) +0x00000094: 03 DW_LNS_advance_line (7) 0x00000096: 05 DW_LNS_set_column (3) 0x00000098: 00 DW_LNE_end_sequence - 0x00000000ffffff68 8 3 1 0 0 is_stmt end_sequence + 0x00000000ffffff64 7 3 1 0 0 is_stmt end_sequence .debug_str contents: -0x00000000: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 3c4c205060c9398da705eb71b63ddd8a04999de9)" -0x00000069: "test_debuginfo.cpp" -0x0000007c: "/" -0x0000007e: "test_debuginfo" +0x00000000: "clang version 13.0.0 (https://github.com/llvm/llvm-project 3c4c205060c9398da705eb71b63ddd8a04999de9)" +0x00000065: "test_debuginfo.cpp" +0x00000078: "/" +0x0000007a: "_Z14test_debuginfov" +0x0000008e: "test_debuginfo" (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (import "env" "foo" (func $foo)) + (import "env" "_Z3foov" (func $foo\28\29)) (import "env" "__cxa_begin_catch" (func $__cxa_begin_catch (param i32) (result i32))) (import "env" "__cxa_end_catch" (func $__cxa_end_catch)) (import "env" "_ZSt9terminatev" (func $std::terminate\28\29)) @@ -432,7 +433,7 @@ file_names[ 1]: (export "memory" (memory $0)) (func $__wasm_call_ctors ) - (func $test_debuginfo + (func $test_debuginfo\28\29 (local $0 i32) (local $1 i32) ;; code offset: 0xc @@ -444,7 +445,7 @@ file_names[ 1]: (try $label$9 (do ;; code offset: 0x10 - (call $foo) + (call $foo\28\29) ) ;; code offset: 0x12 (catch $event$0 @@ -469,7 +470,7 @@ file_names[ 1]: (try $label$8 (do ;; code offset: 0x21 - (call $foo) + (call $foo\28\29) ;; code offset: 0x25 (global.set $__stack_pointer ;; code offset: 0x23 @@ -537,7 +538,7 @@ file_names[ 1]: ;; custom section ".debug_info", size 63 ;; custom section ".debug_abbrev", size 41 ;; custom section ".debug_line", size 155 - ;; custom section ".debug_str", size 141 - ;; custom section "producers", size 138 + ;; custom section ".debug_str", size 157 + ;; custom section "producers", size 134 ;; features section: exception-handling ) diff --git a/test/passes/dwarf_with_exceptions.wasm b/test/passes/dwarf_with_exceptions.wasm index 983eb40ef616a3d172caa2716c119b6bf84c989c..5246f10bcc3afe6360f8fa3942053ad1ef8540a9 100755 GIT binary patch delta 247 zcmZqWn9ealf-jhbIW@10JwD1fEkD0(qmm?}PAUTgQ~)VfAT9!8CK!X|Ed#^+DxgRo z5Hm7OPG_{{E8^BmNlhwEkI%`>OHG=*fze7=n3a`l9V>G)D=SAc8*^0?D>GXs8*?R- z7Na_Ir5+Hcu`;r0FflSPGBT`~EXm|Hc?+}l Date: Wed, 17 Feb 2021 15:44:05 -0800 Subject: [PATCH 3/3] Change function name + upload cpp file --- test/passes/dwarf_with_exceptions.bin.txt | 198 +++++++++++----------- test/passes/dwarf_with_exceptions.cpp | 14 ++ test/passes/dwarf_with_exceptions.wasm | Bin 1047 -> 1083 bytes 3 files changed, 113 insertions(+), 99 deletions(-) create mode 100644 test/passes/dwarf_with_exceptions.cpp diff --git a/test/passes/dwarf_with_exceptions.bin.txt b/test/passes/dwarf_with_exceptions.bin.txt index a0dfd2d26f5..9e8ed37d54e 100644 --- a/test/passes/dwarf_with_exceptions.bin.txt +++ b/test/passes/dwarf_with_exceptions.bin.txt @@ -12,7 +12,7 @@ (export "memory" (memory $0)) (func $__wasm_call_ctors ) - (func $test_debuginfo\28\29 + (func $dwarf_with_exceptions\28\29 (local $0 i32) (local $1 i32) ;; code offset: 0xe @@ -116,8 +116,8 @@ ) ;; custom section ".debug_info", size 63 ;; custom section ".debug_abbrev", size 41 - ;; custom section ".debug_line", size 102 - ;; custom section ".debug_str", size 157 + ;; custom section ".debug_line", size 109 + ;; custom section ".debug_str", size 178 ;; custom section "producers", size 134 ;; features section: exception-handling ) @@ -126,8 +126,8 @@ DWARF debug info Contains section .debug_info (63 bytes) Contains section .debug_abbrev (41 bytes) -Contains section .debug_line (102 bytes) -Contains section .debug_str (157 bytes) +Contains section .debug_line (109 bytes) +Contains section .debug_str (178 bytes) .debug_abbrev contents: Abbrev table for offset: 0x00000000 @@ -157,9 +157,9 @@ Abbrev table for offset: 0x00000000 0x0000000b: DW_TAG_compile_unit [1] * DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 13.0.0 (https://github.com/llvm/llvm-project 3c4c205060c9398da705eb71b63ddd8a04999de9)") DW_AT_language [DW_FORM_data2] (DW_LANG_C_plus_plus_14) - DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "test_debuginfo.cpp") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "dwarf_with_exceptions.cpp") DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) - DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000078] = "/") + DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000007f] = "/") DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000072) @@ -167,9 +167,9 @@ Abbrev table for offset: 0x00000000 DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000072) DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_WASM_location 0x0 +0, DW_OP_stack_value) - DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000007a] = "_Z14test_debuginfov") - DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008e] = "test_debuginfo") - DW_AT_decl_file [DW_FORM_data1] ("/test_debuginfo.cpp") + DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x00000081] = "_Z21dwarf_with_exceptionsv") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000009c] = "dwarf_with_exceptions") + DW_AT_decl_file [DW_FORM_data1] ("/dwarf_with_exceptions.cpp") DW_AT_decl_line [DW_FORM_data1] (2) DW_AT_external [DW_FORM_flag_present] (true) @@ -178,9 +178,9 @@ Abbrev table for offset: 0x00000000 .debug_line contents: debug_line[0x00000000] Line table prologue: - total_length: 0x00000062 + total_length: 0x00000069 version: 4 - prologue_length: 0x0000002a + prologue_length: 0x00000031 min_inst_length: 1 max_ops_per_inst: 1 default_is_stmt: 1 @@ -200,82 +200,82 @@ standard_opcode_lengths[DW_LNS_set_prologue_end] = 0 standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0 standard_opcode_lengths[DW_LNS_set_isa] = 1 file_names[ 1]: - name: "test_debuginfo.cpp" + name: "dwarf_with_exceptions.cpp" dir_index: 0 mod_time: 0x00000000 length: 0x00000000 -0x00000034: 00 DW_LNE_set_address (0x0000000000000005) -0x0000003b: 13 address += 0, line += 1 +0x0000003b: 00 DW_LNE_set_address (0x0000000000000005) +0x00000042: 13 address += 0, line += 1 0x0000000000000005 2 0 1 0 0 is_stmt -0x0000003c: 05 DW_LNS_set_column (5) -0x0000003e: 0a DW_LNS_set_prologue_end -0x0000003f: ae address += 11, line += 2 +0x00000043: 05 DW_LNS_set_column (5) +0x00000045: 0a DW_LNS_set_prologue_end +0x00000046: ae address += 11, line += 2 0x0000000000000010 4 5 1 0 0 is_stmt prologue_end -0x00000040: 05 DW_LNS_set_column (3) -0x00000042: 83 address += 8, line += 1 +0x00000047: 05 DW_LNS_set_column (3) +0x00000049: 83 address += 8, line += 1 0x0000000000000018 5 3 1 0 0 is_stmt -0x00000043: 05 DW_LNS_set_column (5) -0x00000045: 08 DW_LNS_const_add_pc (0x0000000000000011) -0x00000046: 83 address += 8, line += 1 +0x0000004a: 05 DW_LNS_set_column (5) +0x0000004c: 08 DW_LNS_const_add_pc (0x0000000000000011) +0x0000004d: 83 address += 8, line += 1 0x0000000000000031 6 5 1 0 0 is_stmt -0x00000047: 06 DW_LNS_negate_stmt -0x00000048: 03 DW_LNS_advance_line (0) -0x0000004a: 82 address += 8, line += 0 +0x0000004e: 06 DW_LNS_negate_stmt +0x0000004f: 03 DW_LNS_advance_line (0) +0x00000051: 82 address += 8, line += 0 0x0000000000000039 0 5 1 0 0 -0x0000004b: 05 DW_LNS_set_column (3) -0x0000004d: 06 DW_LNS_negate_stmt -0x0000004e: 89 address += 8, line += 7 +0x00000052: 05 DW_LNS_set_column (3) +0x00000054: 06 DW_LNS_negate_stmt +0x00000055: 89 address += 8, line += 7 0x0000000000000041 7 3 1 0 0 is_stmt -0x0000004f: 06 DW_LNS_negate_stmt -0x00000050: 03 DW_LNS_advance_line (0) -0x00000052: 02 DW_LNS_advance_pc (42) -0x00000054: 01 DW_LNS_copy +0x00000056: 06 DW_LNS_negate_stmt +0x00000057: 03 DW_LNS_advance_line (0) +0x00000059: 02 DW_LNS_advance_pc (42) +0x0000005b: 01 DW_LNS_copy 0x000000000000006b 0 3 1 0 0 -0x00000055: 27 address += 1, line += 7 +0x0000005c: 27 address += 1, line += 7 0x000000000000006c 7 3 1 0 0 -0x00000056: 03 DW_LNS_advance_line (0) -0x00000058: 2e address += 2, line += 0 +0x0000005d: 03 DW_LNS_advance_line (0) +0x0000005f: 2e address += 2, line += 0 0x000000000000006e 0 3 1 0 0 -0x00000059: 27 address += 1, line += 7 +0x00000060: 27 address += 1, line += 7 0x000000000000006f 7 3 1 0 0 -0x0000005a: 03 DW_LNS_advance_line (0) -0x0000005c: 66 address += 6, line += 0 +0x00000061: 03 DW_LNS_advance_line (0) +0x00000063: 66 address += 6, line += 0 0x0000000000000075 0 3 1 0 0 -0x0000005d: 05 DW_LNS_set_column (1) -0x0000005f: 06 DW_LNS_negate_stmt -0x00000060: 28 address += 1, line += 8 +0x00000064: 05 DW_LNS_set_column (1) +0x00000066: 06 DW_LNS_negate_stmt +0x00000067: 28 address += 1, line += 8 0x0000000000000076 8 1 1 0 0 is_stmt -0x00000061: 02 DW_LNS_advance_pc (1) -0x00000063: 00 DW_LNE_end_sequence +0x00000068: 02 DW_LNS_advance_pc (1) +0x0000006a: 00 DW_LNE_end_sequence 0x0000000000000077 8 1 1 0 0 is_stmt end_sequence .debug_str contents: 0x00000000: "clang version 13.0.0 (https://github.com/llvm/llvm-project 3c4c205060c9398da705eb71b63ddd8a04999de9)" -0x00000065: "test_debuginfo.cpp" -0x00000078: "/" -0x0000007a: "_Z14test_debuginfov" -0x0000008e: "test_debuginfo" +0x00000065: "dwarf_with_exceptions.cpp" +0x0000007f: "/" +0x00000081: "_Z21dwarf_with_exceptionsv" +0x0000009c: "dwarf_with_exceptions" DWARF debug info ================ Contains section .debug_info (63 bytes) Contains section .debug_abbrev (41 bytes) -Contains section .debug_line (155 bytes) -Contains section .debug_str (157 bytes) +Contains section .debug_line (162 bytes) +Contains section .debug_str (178 bytes) .debug_abbrev contents: Abbrev table for offset: 0x00000000 @@ -305,9 +305,9 @@ Abbrev table for offset: 0x00000000 0x0000000b: DW_TAG_compile_unit [1] * DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 13.0.0 (https://github.com/llvm/llvm-project 3c4c205060c9398da705eb71b63ddd8a04999de9)") DW_AT_language [DW_FORM_data2] (DW_LANG_C_plus_plus_14) - DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "test_debuginfo.cpp") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "dwarf_with_exceptions.cpp") DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) - DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000078] = "/") + DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000007f] = "/") DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000040) @@ -315,9 +315,9 @@ Abbrev table for offset: 0x00000000 DW_AT_low_pc [DW_FORM_addr] (0x0000000000000005) DW_AT_high_pc [DW_FORM_data4] (0x00000040) DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_WASM_location 0x0 +0, DW_OP_stack_value) - DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0000007a] = "_Z14test_debuginfov") - DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008e] = "test_debuginfo") - DW_AT_decl_file [DW_FORM_data1] ("/test_debuginfo.cpp") + DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x00000081] = "_Z21dwarf_with_exceptionsv") + DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000009c] = "dwarf_with_exceptions") + DW_AT_decl_file [DW_FORM_data1] ("/dwarf_with_exceptions.cpp") DW_AT_decl_line [DW_FORM_data1] (2) DW_AT_external [DW_FORM_flag_present] (true) @@ -326,9 +326,9 @@ Abbrev table for offset: 0x00000000 .debug_line contents: debug_line[0x00000000] Line table prologue: - total_length: 0x00000097 + total_length: 0x0000009e version: 4 - prologue_length: 0x0000002a + prologue_length: 0x00000031 min_inst_length: 1 max_ops_per_inst: 1 default_is_stmt: 1 @@ -348,77 +348,77 @@ standard_opcode_lengths[DW_LNS_set_prologue_end] = 0 standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0 standard_opcode_lengths[DW_LNS_set_isa] = 1 file_names[ 1]: - name: "test_debuginfo.cpp" + name: "dwarf_with_exceptions.cpp" dir_index: 0 mod_time: 0x00000000 length: 0x00000000 -0x00000034: 00 DW_LNE_set_address (0x0000000000000005) -0x0000003b: 03 DW_LNS_advance_line (2) -0x0000003d: 01 DW_LNS_copy +0x0000003b: 00 DW_LNE_set_address (0x0000000000000005) +0x00000042: 03 DW_LNS_advance_line (2) +0x00000044: 01 DW_LNS_copy 0x0000000000000005 2 0 1 0 0 is_stmt -0x0000003e: 00 DW_LNE_set_address (0x000000000000000e) -0x00000045: 03 DW_LNS_advance_line (4) -0x00000047: 05 DW_LNS_set_column (5) -0x00000049: 0a DW_LNS_set_prologue_end -0x0000004a: 01 DW_LNS_copy +0x00000045: 00 DW_LNE_set_address (0x000000000000000e) +0x0000004c: 03 DW_LNS_advance_line (4) +0x0000004e: 05 DW_LNS_set_column (5) +0x00000050: 0a DW_LNS_set_prologue_end +0x00000051: 01 DW_LNS_copy 0x000000000000000e 4 5 1 0 0 is_stmt prologue_end -0x0000004b: 00 DW_LNE_set_address (0x0000000000000012) -0x00000052: 03 DW_LNS_advance_line (5) -0x00000054: 05 DW_LNS_set_column (3) -0x00000056: 01 DW_LNS_copy +0x00000052: 00 DW_LNE_set_address (0x0000000000000012) +0x00000059: 03 DW_LNS_advance_line (5) +0x0000005b: 05 DW_LNS_set_column (3) +0x0000005d: 01 DW_LNS_copy 0x0000000000000012 5 3 1 0 0 is_stmt -0x00000057: 00 DW_LNE_set_address (0x000000000000001f) -0x0000005e: 03 DW_LNS_advance_line (6) -0x00000060: 05 DW_LNS_set_column (5) -0x00000062: 01 DW_LNS_copy +0x0000005e: 00 DW_LNE_set_address (0x000000000000001f) +0x00000065: 03 DW_LNS_advance_line (6) +0x00000067: 05 DW_LNS_set_column (5) +0x00000069: 01 DW_LNS_copy 0x000000000000001f 6 5 1 0 0 is_stmt -0x00000063: 00 DW_LNE_set_address (0x000000000000003e) -0x0000006a: 03 DW_LNS_advance_line (7) -0x0000006c: 05 DW_LNS_set_column (3) -0x0000006e: 06 DW_LNS_negate_stmt -0x0000006f: 01 DW_LNS_copy +0x0000006a: 00 DW_LNE_set_address (0x000000000000003e) +0x00000071: 03 DW_LNS_advance_line (7) +0x00000073: 05 DW_LNS_set_column (3) +0x00000075: 06 DW_LNS_negate_stmt +0x00000076: 01 DW_LNS_copy 0x000000000000003e 7 3 1 0 0 -0x00000070: 00 DW_LNE_set_address (0x0000000000000041) -0x00000077: 01 DW_LNS_copy +0x00000077: 00 DW_LNE_set_address (0x0000000000000041) +0x0000007e: 01 DW_LNS_copy 0x0000000000000041 7 3 1 0 0 -0x00000078: 00 DW_LNE_set_address (0x0000000000000044) -0x0000007f: 03 DW_LNS_advance_line (8) -0x00000081: 05 DW_LNS_set_column (1) -0x00000083: 06 DW_LNS_negate_stmt -0x00000084: 01 DW_LNS_copy +0x0000007f: 00 DW_LNE_set_address (0x0000000000000044) +0x00000086: 03 DW_LNS_advance_line (8) +0x00000088: 05 DW_LNS_set_column (1) +0x0000008a: 06 DW_LNS_negate_stmt +0x0000008b: 01 DW_LNS_copy 0x0000000000000044 8 1 1 0 0 is_stmt -0x00000085: 00 DW_LNE_set_address (0x0000000000000045) -0x0000008c: 01 DW_LNS_copy +0x0000008c: 00 DW_LNE_set_address (0x0000000000000045) +0x00000093: 01 DW_LNS_copy 0x0000000000000045 8 1 1 0 0 is_stmt -0x0000008d: 00 DW_LNE_set_address (0x00000000ffffff64) -0x00000094: 03 DW_LNS_advance_line (7) -0x00000096: 05 DW_LNS_set_column (3) -0x00000098: 00 DW_LNE_end_sequence +0x00000094: 00 DW_LNE_set_address (0x00000000ffffff64) +0x0000009b: 03 DW_LNS_advance_line (7) +0x0000009d: 05 DW_LNS_set_column (3) +0x0000009f: 00 DW_LNE_end_sequence 0x00000000ffffff64 7 3 1 0 0 is_stmt end_sequence .debug_str contents: 0x00000000: "clang version 13.0.0 (https://github.com/llvm/llvm-project 3c4c205060c9398da705eb71b63ddd8a04999de9)" -0x00000065: "test_debuginfo.cpp" -0x00000078: "/" -0x0000007a: "_Z14test_debuginfov" -0x0000008e: "test_debuginfo" +0x00000065: "dwarf_with_exceptions.cpp" +0x0000007f: "/" +0x00000081: "_Z21dwarf_with_exceptionsv" +0x0000009c: "dwarf_with_exceptions" (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) @@ -433,7 +433,7 @@ file_names[ 1]: (export "memory" (memory $0)) (func $__wasm_call_ctors ) - (func $test_debuginfo\28\29 + (func $dwarf_with_exceptions\28\29 (local $0 i32) (local $1 i32) ;; code offset: 0xc @@ -537,8 +537,8 @@ file_names[ 1]: ) ;; custom section ".debug_info", size 63 ;; custom section ".debug_abbrev", size 41 - ;; custom section ".debug_line", size 155 - ;; custom section ".debug_str", size 157 + ;; custom section ".debug_line", size 162 + ;; custom section ".debug_str", size 178 ;; custom section "producers", size 134 ;; features section: exception-handling ) diff --git a/test/passes/dwarf_with_exceptions.cpp b/test/passes/dwarf_with_exceptions.cpp new file mode 100644 index 00000000000..283b3006430 --- /dev/null +++ b/test/passes/dwarf_with_exceptions.cpp @@ -0,0 +1,14 @@ +void foo(); +void dwarf_with_exceptions() { + try { + foo(); + } catch (...) { + foo(); + } +} +// How to generate dwarf_with_exceptions.wasm: +// $ clang++ -std=c++14 --target=wasm32-unknown-unknown -g -fwasm-exceptions -Xclang -disable-O0-optnone -c -S -emit-llvm dwarf_with_exceptions.cpp -o temp.ll +// $ opt -S -mem2reg -simplifycfg temp.ll -o dwarf_with_exceptions.ll +// Remove some personal info from dwarf_with_exceptions.ll +// $ llc -exception-model=wasm -mattr=+exception-handling -filetype=obj dwarf_with_exceptions.ll -o dwarf_with_exceptions.o +// $ wasm-ld --no-entry --no-gc-sections --allow-undefined dwarf_with_exceptions.o -o dwarf_with_exceptions.wasm diff --git a/test/passes/dwarf_with_exceptions.wasm b/test/passes/dwarf_with_exceptions.wasm index 5246f10bcc3afe6360f8fa3942053ad1ef8540a9..d972a5899525ef1753ab7de54bdb5bdd5b3e4a6c 100755 GIT binary patch delta 237 zcmbQvv72LqJEMF(0|Nsq5ElV46O6&~mVse@BT!_{is^!S|2ywpsf zFbjhrkYr?J{LRM;q8LFu5K1XeEJ}+n&n(G^PpwE!Ehx#%&nupMkI{y4?__DF!U(ML uddUR^4EhZ5QAUPX<;$=e%fK*?ktHuNHB)ATe>Qx+m*1zW@NM1V{=1 delta 201 zcmdnZF`Z+BJEMFB0|Nsq5ElV46O6&~mVse@6;PyaavGz9MG?1NN@`MRdVEf1UTP9h zn1w+LNHQ`q{^sKaQH&rS2$iH3m&AkBX6B{kPkzd1!?ufQs)Sy0K>>q4LwuB> i393XHnh6XH(->Lu5_3}-t0%u^3gQ<)RX#bG`2_ XR9w