Compiling C/C++ code with the -g flag results in debug information in the produced binary file. In particular, there is a mapping of source code to binary code:
add: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <add>:
int add(int a, int b) {
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 89 7d fc mov %edi,-0x4(%rbp)
7: 89 75 f8 mov %esi,-0x8(%rbp)
return a + b;
a: 8b 45 fc mov -0x4(%rbp),%eax
d: 03 45 f8 add -0x8(%rbp),%eax
10: 5d pop %rbp
11: c3 retq
Is there something similar for compiling WebAssembly with clang or emcc?
I tried the -g flag with these but it doesn't have the same behavior.
Ultimately, I'd like a mapping of the .wat code to the C code.