-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug: add interactive debug mode #203
Open
jow-
wants to merge
9
commits into
master
Choose a base branch
from
debugger
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When an inner function invoked exit() in a ucode > native > ucode call stack situation, the VM did end up with an empty callframe stack after the native function returned, leading to subsequent invalid memory accesses. Properly deal with situation similar to how we also check for an empty call stack after processing I_RETURN and additionally translate the current exception type to a status return value. Signed-off-by: Jo-Philipp Wich <[email protected]>
Add missing definition for the SIGWINCH signal number in order to allow ucode programs to subscribe to terminal size change signals. Signed-off-by: Jo-Philipp Wich <[email protected]>
Use a two byte structure to encode { byte offset, insns count } offset info tuples and introduce additional flags plus related api functions to encode statement start- and end boundaries in offsetinfo. The new encoding format more than halves the required memory footprint in many cases, especially for whitespace- and comment heavy sources. Signed-off-by: Jo-Philipp Wich <[email protected]>
Utilize the new chunk offset info facilities to encode the start and end offsets of logical statements in the offset information vector of the debug data area. This information can be used later by debuggers to step through logical statements instead of single instructions. Signed-off-by: Jo-Philipp Wich <[email protected]>
Introduce low level facilities for registering breakpoints in the running VM context. The breakpoint primitives allow invoking provided callback functions when the VM reaches an associated instruction address. This functionality provides the foundation for building more thorough interactive debug functionality on top. Signed-off-by: Jo-Philipp Wich <[email protected]>
Publicly export the instruction format table in order to make it useable for libucode.so users, such as dynamically loaded debug libraries. Signed-off-by: Jo-Philipp Wich <[email protected]>
When additional ucode scripts are loaded through require() or similar means, and the required code invokes exit(), the VM will clear the stack before returning, so we must ensure that the stack size matches our expectation before we're trying to pop values from it after returning from require. Signed-off-by: Jo-Philipp Wich <[email protected]>
Implement an interactive command line debugger within the debug module which can be started by invoking the `debugger()` function. The debugger offers common features such as the ability to set breakpoints, stepping through commands, examining call stacks and variables as well as byte code disassembly source code highlighting. Signed-off-by: Jo-Philipp Wich <[email protected]>
Introduce a new command line switch `-x` which loads the debug module and launches the given program or expression within the interactive debugger. Signed-off-by: Jo-Philipp Wich <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce a new interactive debug cli which can be started by invoking the ucode interpreter with the
-x
flag.The main debugger functionality resides in the debug library while the cli frontend just gains some minimal amount of code to load and instantiate the debug library when the
-x
option is passed.As a precondition for the new debug functionality, the ucode VM has been extended with low level breakpoint support.