emscripten-core / emscripten-core/emscripten

ASYNCIFY_ADVISE should output a tree

Open
#17,380 2 comments 0 reactions 0 assignees View on GitHub
asyncify good first bug help wanted
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Currently if you use ASYNCIFY_ADVISE you'll get output that looks like this:

```
[asyncify] emglken_fill_stdin_buffer is an import that can change the state
[asyncify] __wrap_getc can change the state due to emglken_fill_stdin_buffer
[asyncify] data_raw_blockread_sub can change the state due to __wrap_getc
[asyncify] data_raw_blockread can change the state due to data_raw_blockread_sub
[asyncify] glk_select can change the state due to data_raw_blockread
[asyncify] getglkchar can change the state due to glk_select
[asyncify] os_waitc can change the state due to getglkchar
[asyncify] os_getc can change the state due to getglkchar
[asyncify] bifcvtstr can change the state due to initial scan
[asyncify] biffopen can change the state due to initial scan
[asyncify] bifupr can change the state due to bifcvtstr
[asyncify] biflwr can change the state due to bifcvtstr
```

It would be more useable if it could be outputted as a tree, something like this:

```
[Asyncify] Functions that will be instrumented:

emglken_fill_stdin_buffer (EM_ASYNC_JS)
> __wrap_getc
> data_raw_blockread_sub
> data_raw_blockread
> glk_select
> getglkchar
> os_getc (appears 2 times)
> os_get_event
> os_waitc
> os_getc (see above)
bifcvtstr (makes indirect call)
> bifupr
> biflwr
biffopen (makes indirect call)
```

So for each base function give the reason, then put all the callers in a nested tree below them. Some functions are in the tree multiple times - when that happens list them each time, but only display their callers once.

The main advantages would be it would be easier to get a handle on the call tree and which functions might be ASYNCIFY_REMOVE candidates, and that if a function is in the call tree multiple times that information is currently not output.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.