Skip to content

Conversation

@atticusofsparta
Copy link

The intent with this PR is to enable users and applications like aos-web and betteridea to perform analysis on a live process to view the actual currently running code and variables. It analyzes the lua globals via the_G global, and the packages loaded from the lua package system.

The achieve this, we use the .getinfo utiil from the debug introspective stdlib.

Actually being able to retrieve the function source required modifying how the load method is used in the eval handler. Rather than the function name of "aos" being passed in, we pass the entire expression. This can then be used to traverse the lines where the function is defined in the source file.

A current limitation of this is being able to show modules that are precompiled - for us to have context of the string where the function is defined (those loaded with the eval handler) they must have been loaded into the current program state.

Still need to do some further experimentation in conjunction with the AO dev-cli, in particular here: https://github.com/permaweb/ao/blob/e2088442a399e871db552fb5031ae73bbf36c9b9/dev-cli/container/src/core/main.lua#L15

Where I suspect its just a matter of updating those load uses as well.

check out the ant-state.json for example output for program state :)

Still needs some refining, in particular the Handlers code retrieval, which I hope will become more visible with dev-cli updates.

Hopefully this will grant greater debugging utilities and program versioning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant