Skip to content

[GperfTools pperf] How to convert emscripten stack trace to PC and vice-versa #20008

Answered by kripken
gmarella asked this question in Q&A
Discussion options

You must be logged in to vote

It might help to look at the internals of Emscripten's sanitizer support, which does work to convert stack traces to binary offsets. Relevant methods are emscripten_pc_get_function, emscripten_stack_snapshot and others in that area.

In general, you can convert stack traces to binary offsets. For example, here is part of a stack trace in Node 16:

    at _fd_write (/home/azakai/Dev/emscripten/a.out.js:429:7)
    at __wasi_fd_write (wasm://wasm/85545e82:wasm-function[2]:0x98)
    at __stdio_write (wasm://wasm/85545e82:wasm-function[7]:0x57c)
    at main (wasm://wasm/85545e82:wasm-function[5]:0x4fe)

429 is a line number in JS, and 0x98 is a binary offset in wasm. That is parsed by the stack t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gmarella
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants