emscripten-core/emscripten

ASYNCIFY_ADVISE should output a tree

Open

#17.380 aperta il 7 lug 2022

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)C++ (3519 fork)batch import
asyncifygood first bughelp wanted

Metriche repository

Star
 (27.361 star)
Metriche merge PR
 (Merge medio 19g 10h) (147 PR mergiate in 30 g)

Descrizione

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.

Guida contributor