Haiyang-Sun / nodeprof.js

Instrumentation framework for Node.js compliant to ECMAScript 2020 based on GraalVM.
Apache License 2.0
53 stars 22 forks source link

Jalangi analysis CLI arguments #14

Closed LucaFranceschini closed 5 years ago

LucaFranceschini commented 5 years ago

Jalangi supports CLI arguments that end up in J$.initParams. Does NodeProf support anything similar? It would be useful for instance to tell the analysis where to log events.

I didn't dig too much into the code here, maybe it should be in loadAnalysis?

Haiyang-Sun commented 5 years ago

Not yet, it should be something you can implement yourself, or you can simply log with an analysis-specific header to grep with.

LucaFranceschini commented 5 years ago

Not yet, it should be something you can implement yourself, or you can simply log with an analysis-specific header to grep with.

I can implement the parsing by myself, what is not clear to me is what part of NodeProf I should modify to actually pass the arguments array to the analysis. Do you have any suggestion?

Thanks.

Haiyang-Sun commented 5 years ago

Ok. Then it should be loadAnalysis as you found out. Currently, it only processes --analysis jalangiAnalysis. We can add one more option, e.g., "--analysisOpts XXXX" (where XXXX can be a string separated by some delimiter) and then store the extra arguments in J$.initParams as Jalangi does. I can work on this when I will have time, or if you have some patch already, feel free to start a PR.

LucaFranceschini commented 5 years ago

That's fine. If I understand correctly, that would pass the same list of arguments to every analysis, correct? J$ seems global so if I set J$.initParams in loadAnalysis arguments are the same for every analysis.

Haiyang-Sun commented 5 years ago

Yes, they are global as J$ is global. We can keep it like Jalangi: https://github.com/Samsung/jalangi2/blob/master/src/js/commands/direct.js#L30 where they use --initParam and store it in J$.initParam as a global as well.