Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing debug information #350

Closed
bbbshaw opened this issue Sep 21, 2023 · 6 comments
Closed

Missing debug information #350

bbbshaw opened this issue Sep 21, 2023 · 6 comments

Comments

@bbbshaw
Copy link

bbbshaw commented Sep 21, 2023

Hi,

I use wasi-sdk to compile a simple c program and use objdump to print the .wasm file information. I found that when using -O0 as the optimization level, the debug information can be seen. However, when using -O2 as the optimization level, the debug information would be lost.

Here is the simple c program:

#include <stdio.h>

int main(void){
    printf("helloworld");
}

I use the following command to compile:

/wasi-sdk-20.0/bin/clang --sysroot /wasi-sdk-20.0/share/wasi-sysroot helloworld.c -g -O2 -o hello.wasm

I use the following command to dump the .wasm file:

llvm-objdump -S -l hello.wasm

The result doesn't show any debug information.

@abrown
Copy link
Collaborator

abrown commented Sep 21, 2023

Is it possible you're running into llvm/llvm-project#55781?

@sbc100
Copy link
Member

sbc100 commented Sep 21, 2023

Do you have wasm-opt in your path?

@bbbshaw
Copy link
Author

bbbshaw commented Sep 21, 2023

Is it possible you're running into llvm/llvm-project#55781?

Thanks for sharing this issue. I believe it's the reason why debug information is missing.

@bbbshaw
Copy link
Author

bbbshaw commented Sep 21, 2023

Do you have wasm-opt in your path?

Yes, I got wasm-opt in my path.

@abrown
Copy link
Collaborator

abrown commented Sep 21, 2023

We really need to fix that issue. In the meantime, how do you feel about closing this one to avoid duplicates?

@bbbshaw
Copy link
Author

bbbshaw commented Sep 21, 2023

We really need to fix that issue. In the meantime, how do you feel about closing this one to avoid duplicates?

Sure, I appreciate your help and will close this issue.

@bbbshaw bbbshaw closed this as completed Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants