Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
432 changes: 405 additions & 27 deletions src/wasm/wasm-debug.cpp

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions test/passes/class_with_dwarf_noprint.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DWARF debug info

Contains section .debug_info (429 bytes)
Contains section .debug_loc (199 bytes)
Contains section .debug_ranges (24 bytes)
Contains section .debug_ranges (32 bytes)
Contains section .debug_abbrev (337 bytes)
Contains section .debug_line (438 bytes)
Contains section .debug_str (364 bytes)
Expand Down Expand Up @@ -335,8 +335,8 @@ Abbrev table for offset: 0x00000000
DW_AT_type [DW_FORM_ref4] (cu + 0x01a5 => {0x000001a5} "int")

0x0000011f: DW_TAG_lexical_block [22] *
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000030)
DW_AT_high_pc [DW_FORM_data4] (0xffffffd0)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)
DW_AT_high_pc [DW_FORM_data4] (0x00000000)

0x00000128: DW_TAG_variable [21]
DW_AT_location [DW_FORM_sec_offset] (0x00000046:
Expand All @@ -348,8 +348,8 @@ Abbrev table for offset: 0x00000000
DW_AT_type [DW_FORM_ref4] (cu + 0x01a5 => {0x000001a5} "int")

0x00000137: DW_TAG_lexical_block [22] *
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000030)
DW_AT_high_pc [DW_FORM_data4] (0x0000005f)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)
DW_AT_high_pc [DW_FORM_data4] (0x00000000)

0x00000140: DW_TAG_variable [21]
DW_AT_location [DW_FORM_sec_offset] (0x0000009b:
Expand All @@ -369,9 +369,7 @@ Abbrev table for offset: 0x00000000

0x0000015e: DW_TAG_inlined_subroutine [23] *
DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x00c5 => {0x000000c5} "_ZN6Random3getEf")
DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
[0x00000006, 0x00000007)
[0x0000006b, 0x00000074))
DW_AT_ranges [DW_FORM_sec_offset] (0x00000018)
DW_AT_call_file [DW_FORM_data1] ("/tmp/emscripten_test_wasm3_2u9tontv/src.cpp")
DW_AT_call_line [DW_FORM_data1] (28)
DW_AT_call_column [DW_FORM_data1] (0x15)
Expand All @@ -388,8 +386,8 @@ Abbrev table for offset: 0x00000000

0x00000179: DW_TAG_inlined_subroutine [26] *
DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x00c5 => {0x000000c5} "_ZN6Random3getEf")
DW_AT_low_pc [DW_FORM_addr] (0x000000000000004a)
DW_AT_high_pc [DW_FORM_data4] (0x00000019)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)
DW_AT_high_pc [DW_FORM_data4] (0x00000000)
DW_AT_call_file [DW_FORM_data1] ("/tmp/emscripten_test_wasm3_2u9tontv/src.cpp")
DW_AT_call_line [DW_FORM_data1] (29)
DW_AT_call_column [DW_FORM_data1] (0x15)
Expand Down Expand Up @@ -703,6 +701,7 @@ file_names[ 3]:
0x00000169: "x1"

.debug_ranges contents:
00000000 00000000 00000001
00000000 00000001 00000001
00000000 00000065 0000006e
00000000 <End of list>
00000018 <End of list>
2 changes: 1 addition & 1 deletion test/passes/dwarfdump_roundtrip_dwarfdump.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Abbrev table for offset: 0x00000000
DW_AT_high_pc [DW_FORM_data4] (0x00000000)

0x00000026: DW_TAG_subprogram [2]
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)
DW_AT_high_pc [DW_FORM_data4] (0x00000000)
DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x000000c8] = "_Z3foov")
DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000d0] = "foo")
Expand Down
15 changes: 7 additions & 8 deletions test/passes/fannkuch3_manyopts_dwarf.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ DWARF debug info

Contains section .debug_info (851 bytes)
Contains section .debug_loc (1073 bytes)
Contains section .debug_ranges (88 bytes)
Contains section .debug_ranges (96 bytes)
Contains section .debug_abbrev (333 bytes)
Contains section .debug_line (2642 bytes)
Contains section .debug_str (434 bytes)
Expand Down Expand Up @@ -2850,8 +2850,8 @@ Abbrev table for offset: 0x00000000

0x00000278: DW_TAG_inlined_subroutine [24] *
DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x01a8 => {0x000001a8} "_ZL8fannkuchi")
DW_AT_low_pc [DW_FORM_addr] (0x00000000000003c2)
DW_AT_high_pc [DW_FORM_data4] (0xfffffc3e)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)
DW_AT_high_pc [DW_FORM_data4] (0x00000000)
DW_AT_call_file [DW_FORM_data1] ("/usr/local/google/home/azakai/Dev/emscripten/tests/fannkuch.cpp")
DW_AT_call_line [DW_FORM_data1] (159)
DW_AT_call_column [DW_FORM_data1] (0x29)
Expand Down Expand Up @@ -2923,12 +2923,10 @@ Abbrev table for offset: 0x00000000

0x000002da: DW_TAG_label [28]
DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x0226 => {0x00000226} "cleanup")
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000604)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)

0x000002e3: DW_TAG_lexical_block [14] *
DW_AT_ranges [DW_FORM_sec_offset] (0x00000028
[0x000004cd, 0x00000512)
[0x00000585, 0x000005d0))
DW_AT_ranges [DW_FORM_sec_offset] (0x00000058)

0x000002e8: DW_TAG_variable [26]
DW_AT_location [DW_FORM_sec_offset] (0x000003bc:
Expand Down Expand Up @@ -4671,6 +4669,7 @@ file_names[ 4]:
00000040 00000006 00000381
00000040 00000383 00000662
00000040 <End of list>
00000058 <End of list>
(module
(type $0 (func (param i32) (result i32)))
(type $1 (func (param i32 i32) (result i32)))
Expand Down Expand Up @@ -6847,7 +6846,7 @@ file_names[ 4]:
)
;; custom section ".debug_info", size 851
;; custom section ".debug_loc", size 1073
;; custom section ".debug_ranges", size 88
;; custom section ".debug_ranges", size 96
;; custom section ".debug_abbrev", size 333
;; custom section ".debug_line", size 2642
;; custom section ".debug_str", size 434
Expand Down
2 changes: 1 addition & 1 deletion test/passes/fib2_dwarf.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ Abbrev table for offset: 0x00000000
DW_AT_external [DW_FORM_flag_present] (true)

0x0000009a: DW_TAG_GNU_call_site [7]
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)

0x0000009f: NULL

Expand Down
2 changes: 1 addition & 1 deletion test/passes/fib2_emptylocspan_dwarf.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ Abbrev table for offset: 0x00000000
DW_AT_external [DW_FORM_flag_present] (true)

0x0000009a: DW_TAG_GNU_call_site [7]
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)

0x0000009f: NULL

Expand Down
15 changes: 10 additions & 5 deletions test/passes/ignore_missing_func_dwarf.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ DWARF debug info
================

Contains section .debug_info (175 bytes)
Contains section .debug_ranges (32 bytes)
Contains section .debug_ranges (64 bytes)
Contains section .debug_abbrev (117 bytes)
Contains section .debug_line (169 bytes)
Contains section .debug_str (235 bytes)
Expand Down Expand Up @@ -621,8 +621,9 @@ Abbrev table for offset: 0x00000000
DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000009b] = "/home/alon/Dev/emscripten")
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
[0x00000005, 0x0000006d))
DW_AT_ranges [DW_FORM_sec_offset] (0x00000020
[0x00000005, 0x0000006d)
[0x0000006e, 0x000000d3))

0x00000026: DW_TAG_variable [2]
DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000b5] = "quine")
Expand Down Expand Up @@ -668,7 +669,7 @@ Abbrev table for offset: 0x00000000
0x00000074: NULL

0x00000075: DW_TAG_subprogram [6] *
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)
DW_AT_high_pc [DW_FORM_data4] (0x00000000)
DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x000000d2] = "_Z6unusedi")
DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000dd] = "unused")
Expand Down Expand Up @@ -821,6 +822,10 @@ file_names[ 1]:
00000000 <End of list>
00000010 0000006e 000000d3
00000010 <End of list>
00000020 ffffffff 00000000
00000020 00000005 0000006d
00000020 0000006e 000000d3
00000020 <End of list>
(module
(type $0 (func))
(type $1 (func (param i32) (result i32)))
Expand Down Expand Up @@ -1074,7 +1079,7 @@ file_names[ 1]:
)
)
;; custom section ".debug_info", size 175
;; custom section ".debug_ranges", size 32
;; custom section ".debug_ranges", size 64
;; custom section ".debug_abbrev", size 117
;; custom section ".debug_line", size 169
;; custom section ".debug_str", size 235
Expand Down
8 changes: 4 additions & 4 deletions test/passes/inlined_to_start_dwarf.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ Abbrev table for offset: 0x00000000
DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000006f] = "/home/azakai/Dev/emscripten")
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
[0x00000000, 0x00000007)
[0x00000001, 0x00000001)
[0x00000005, 0x00000012)
[0x00000013, 0x0000001b))

0x00000026: DW_TAG_subprogram [2] *
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)
DW_AT_high_pc [DW_FORM_data4] (0x00000000)
DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_WASM_location 0x3 +0, <decoding error> 00 00 9f)
DW_AT_GNU_all_call_sites [DW_FORM_flag_present] (true)
Expand Down Expand Up @@ -260,7 +260,7 @@ Abbrev table for offset: 0x00000000
DW_AT_type [DW_FORM_ref4] (cu + 0x0071 => {0x00000071} "int")

0x00000129: DW_TAG_GNU_call_site [13]
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)

0x0000012e: NULL

Expand Down Expand Up @@ -404,7 +404,7 @@ file_names[ 1]:
0x000000d4: "char"

.debug_ranges contents:
00000000 00000000 00000007
00000000 00000001 00000001
00000000 00000005 00000012
00000000 00000013 0000001b
00000000 <End of list>
Expand Down
4 changes: 2 additions & 2 deletions test/passes/reverse_dwarf_abbrevs.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Abbrev table for offset: 0x00000000
DW_AT_high_pc [DW_FORM_data4] (0x00000000)

0x00000026: DW_TAG_subprogram [3] *
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)
DW_AT_high_pc [DW_FORM_data4] (0x00000000)
DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_WASM_location 0x3 +0, <decoding error> 00 00 9f)
DW_AT_GNU_all_call_sites [DW_FORM_flag_present] (true)
Expand All @@ -61,7 +61,7 @@ Abbrev table for offset: 0x00000000
DW_AT_external [DW_FORM_flag_present] (true)

0x00000041: DW_TAG_GNU_call_site [2]
DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
DW_AT_low_pc [DW_FORM_addr] (0x00000000ffffffff)

0x00000046: NULL

Expand Down