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

How to get function name from wasm_frame_t? #3166

Closed
liamappelbe opened this issue Sep 1, 2022 · 1 comment · Fixed by #3222
Closed

How to get function name from wasm_frame_t? #3166

liamappelbe opened this issue Sep 1, 2022 · 1 comment · Fixed by #3222
Assignees
Labels
priority-medium Medium priority issue ❓ question I've a question!
Milestone

Comments

@liamappelbe
Copy link

I'm trying to make my trap handling code show a user friendly stack trace. I'd at least like to show which functions are hit in the trace.

Looking at the C API functions for wasm_frame_t, I can get the function index, function offset, and module offset, for a given frame. Function index sounds useful, but what is it an index into? Is there a way of looking up the name of a function from its index?

@liamappelbe liamappelbe added the ❓ question I've a question! label Sep 1, 2022
@syrusakbary syrusakbary changed the title How do I use wasm_frame_t? How to get function name from wasm_frame_t? Sep 6, 2022
@syrusakbary syrusakbary added the priority-medium Medium priority issue label Sep 6, 2022
@syrusakbary syrusakbary added this to the v3.x milestone Sep 6, 2022
@fschutt
Copy link
Contributor

fschutt commented Oct 10, 2022

@liamappelbe The function index is the index in the function index space of the WebAssembly module that this frame comes from (i.e func 1, func 2, relative to the compiled module).

That will not help you get the function name. Currently we only have these functions:

  • wasm_frame_func_index
  • wasm_frame_func_offset
  • wasm_frame_module_offset

However, the function name is currently inaccessible from the outside (it's stored as an Option<String> on the FrameInfo). I will have to add extra functions to make these fields accessible, should be fixed soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-medium Medium priority issue ❓ question I've a question!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants