Utility methods for artificial debug types in the generated DWARF (#1482)
* add operator* * add operator-> * add ptr() unwrap method * comments/refactor * macro_rules * external symbols workaround
This commit is contained in:
@@ -92,3 +92,37 @@ check: exited with status
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
#[cfg(all(
|
||||
any(target_os = "linux", target_os = "macos"),
|
||||
target_pointer_width = "64"
|
||||
))]
|
||||
pub fn test_debug_dwarf_ptr() -> Result<()> {
|
||||
let output = lldb_with_script(
|
||||
&[
|
||||
"-g",
|
||||
"--opt-level",
|
||||
"0",
|
||||
"tests/debug/testsuite/reverse-str.wasm",
|
||||
],
|
||||
r#"b reverse-str.c:9
|
||||
r
|
||||
p __vmctx->set(),&*s
|
||||
c"#,
|
||||
)?;
|
||||
|
||||
check_lldb_output(
|
||||
&output,
|
||||
r#"
|
||||
check: Breakpoint 1: no locations (pending)
|
||||
check: stop reason = breakpoint 1.1
|
||||
check: frame #0
|
||||
sameln: reverse(s=(__ptr =
|
||||
check: "Hello, world."
|
||||
check: resuming
|
||||
"#,
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
21
tests/debug/testsuite/reverse-str.c
Normal file
21
tests/debug/testsuite/reverse-str.c
Normal file
@@ -0,0 +1,21 @@
|
||||
// Compile with:
|
||||
// clang --target=wasm32 reverse-str.c -o reverse-str.wasm -g \
|
||||
// -O0 -nostdlib -fdebug-prefix-map=$PWD=.
|
||||
#include <stdlib.h>
|
||||
|
||||
void reverse(char *s, size_t len)
|
||||
{
|
||||
if (!len) return;
|
||||
size_t i = 0, j = len - 1;
|
||||
while (i < j) {
|
||||
char t = s[i];
|
||||
s[i++] = s[j];
|
||||
s[j--] = t;
|
||||
}
|
||||
}
|
||||
|
||||
void _start()
|
||||
{
|
||||
char hello[] = "Hello, world.";
|
||||
reverse(hello, 13);
|
||||
}
|
||||
BIN
tests/debug/testsuite/reverse-str.wasm
Executable file
BIN
tests/debug/testsuite/reverse-str.wasm
Executable file
Binary file not shown.
Reference in New Issue
Block a user