Skip to content
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

Set up the compiler to ptrace the runtime #107

Merged
merged 8 commits into from
Oct 31, 2020
Merged

Set up the compiler to ptrace the runtime #107

merged 8 commits into from
Oct 31, 2020

Conversation

water111
Copy link
Collaborator

Add a library xdbg which should hide the details of cross platform debugging.
Implement ptrace attach/detach for linux only in xdbg
Make the runtime send the compiler all the info needed to attach.
Make the Listener remember loads / reset messages for the debugger.
Some very basic logic to attach/detach, and a simple test.

Needs more documentation and a better way to manage debugger state before merging. Maybe we want a Debugger object to hold all this state?

@coveralls
Copy link

coveralls commented Oct 31, 2020

Pull Request Test Coverage Report for Build 339367452

  • 343 of 443 (77.43%) changed or added relevant lines in 19 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 81.909%

Changes Missing Coverage Covered Lines Changed/Added Lines %
game/kernel/ksocket.cpp 8 9 88.89%
test/goalc/framework/test_runner.cpp 1 2 50.0%
game/kernel/klisten.cpp 3 5 60.0%
game/kernel/kprint.cpp 9 12 75.0%
goalc/listener/Listener.cpp 70 74 94.59%
goalc/compiler/Compiler.cpp 24 31 77.42%
goalc/debugger/Debugger.cpp 54 62 87.1%
common/cross_os_debug/xdbg.cpp 74 107 69.16%
goalc/compiler/compilation/Debug.cpp 6 47 12.77%
Totals Coverage Status
Change from base Build 336934547: -0.03%
Covered Lines: 15475
Relevant Lines: 18893

💛 - Coveralls

@water111
Copy link
Collaborator Author

This adds a very basic debugging framework. The C Kernel now sends some info to the compiler so the debugger can find the correct process. The compiler can now "attach" to a target with (dbg), and break/continue with (:break) and (:cont). We can also read/write memory by GOAL address and get x86 GPRs, but this isn't exposed at the compiler REPL yet, other than a (:dump-all-mem <file>) that dumps all GOAL memory to a file for later debugging.

Right now this only works in Linux, but the platform specific stuff is stubbed out in xdbg.cpp. The debugger tests only run in linux.

@water111 water111 merged commit 0451a06 into master Oct 31, 2020
@water111 water111 deleted the w/debugger branch October 31, 2020 18:07
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.

2 participants