support a few DWARF-5 only features (#1410)

Support a few DWARF-5 only features:

* read .debug_addr
* read .debug_rnglists
* read .debug_loclists when present
* add dwarf-5 test
* read .debug_addr
* read .debug_rnglists
* read .debug_loclists when present
* support .debug_line_str and .debug_str_offsets

Co-authored-by: Yury Delendik <ydelendik@mozilla.com>
This commit is contained in:
Gabor Greif
2020-04-28 00:27:22 +02:00
committed by GitHub
parent d6b1589926
commit 1639ed0e2e
12 changed files with 202 additions and 99 deletions

Binary file not shown.

View File

@@ -1,10 +1,13 @@
// Compile with:
// clang --target=wasm32 fib-wasm.c -o fib-wasm.wasm -g \
// clang --target=wasm32 fib-wasm.c -o fib-wasm.wasm -gdwarf-4 \
// -Wl,--no-entry,--export=fib -nostdlib -fdebug-prefix-map=$PWD=.
//
// clang --target=wasm32 fib-wasm.c -o fib-wasm-dwarf5.wasm -gdwarf-5 \
// -Wl,--no-entry,--export=fib -nostdlib -fdebug-prefix-map=$PWD=.
int fib(int n) {
int i, t, a = 0, b = 1;
for (i = 0; i < n; i++) {
int t, a = 0, b = 1;
for (int i = 0; i < n; i++) {
t = a;
a = b;
b += t;

View File

@@ -41,17 +41,51 @@ check: DW_AT_name ("fib")
# Accepts one parameter
check: DW_TAG_formal_parameter
check: DW_AT_name ("n")
check: DW_AT_decl_line (5)
# Has four locals: i, t, a, b
check: DW_TAG_variable
check: DW_AT_name ("i")
check: DW_AT_decl_line (6)
check: DW_AT_decl_line (8)
# Has four locals: t, a, b, i
check: DW_TAG_variable
check: DW_AT_name ("t")
check: DW_AT_decl_line (9)
check: DW_TAG_variable
check: DW_AT_name ("a")
check: DW_TAG_variable
check: DW_AT_name ("b")
check: DW_TAG_variable
check: DW_AT_name ("i")
check: DW_AT_decl_line (10)
"##,
)
}
#[test]
#[ignore]
#[cfg(all(
any(target_os = "linux", target_os = "macos"),
target_pointer_width = "64"
))]
fn test_debug_dwarf5_translate() -> Result<()> {
check_wasm(
"tests/debug/testsuite/fib-wasm-dwarf5.wasm",
r##"
check: DW_TAG_compile_unit
# We have "fib" function
check: DW_TAG_subprogram
check: DW_AT_name ("fib")
# Accepts one parameter
check: DW_TAG_formal_parameter
check: DW_AT_name ("n")
check: DW_AT_decl_line (8)
# Has four locals: t, a, b, i
check: DW_TAG_variable
check: DW_AT_name ("t")
check: DW_AT_decl_line (9)
check: DW_TAG_variable
check: DW_AT_name ("a")
check: DW_TAG_variable
check: DW_AT_name ("b")
check: DW_TAG_variable
check: DW_AT_name ("i")
check: DW_AT_decl_line (10)
"##,
)
}

Binary file not shown.