You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "thread ID" type tells the compiler which process and thread are the GOAL runtime. It is converted to a string in the runtime, sent over the normal TCP DECI2 connection, and received by the compiler.
On windows, I imagine it will be a process ID + thread ID. I think you need to get a process handle, then convert that to a process ID, and the same thing for a thread.
This will need the to/from string functions, and the get_current_thread_id function implemented.
Debugging Permissions
On Linux, it was not possible to debug the GOAL process unless the runtime enabled certain permissions. The allow_debugging function is called when the GOAL process starts and is a good place to put any code required to make debugging possible.
Attach/Break
The attach_and_break function might be DebugActiveProcess to attach and DebugBreakProcess to break. Running (:dbg) in the REPL will cause this to happen
Check Stopped
This function is called by the debug watcher thread periodically to check if the process has crashed or hit a breakpoint. If the process is still running, this function should return quickly. This is probably WaitForDebugEvent with a 0 timeout.
Memory
There are functions to read and write GOAL memory. These can probably use ReadProcessMemory. They are used to read the symbol table, and insert break instructions.
Registers
For now, we only need GPRs + RIP. This is only called once the process is stopped. This should probably use the GetThreadContext function.
Tests
There are unit tests for the debugger in test_debugger that should work on windows once this is implemented.
Missing features
The debugger is still pretty basic. It can display registers, a stacktrace, and disassembly with source lines. It does support breakpoints and reading/saving memory, but so far those haven't been useful. One issue is that the backtraces tend to be huge because it displays the disassembly for each function. You can comment out the disassemble_at_rip inside of Debugger::get_backtrace to get rid of this, if needed.
The text was updated successfully, but these errors were encountered:
Useful reference https://docs.microsoft.com/en-us/windows/win32/debug/debugging-functions
Thread ID
The "thread ID" type tells the compiler which process and thread are the GOAL runtime. It is converted to a string in the runtime, sent over the normal TCP DECI2 connection, and received by the compiler.
On windows, I imagine it will be a process ID + thread ID. I think you need to get a process handle, then convert that to a process ID, and the same thing for a thread.
This will need the to/from string functions, and the
get_current_thread_id
function implemented.Debugging Permissions
On Linux, it was not possible to debug the GOAL process unless the runtime enabled certain permissions. The
allow_debugging
function is called when the GOAL process starts and is a good place to put any code required to make debugging possible.Attach/Break
The
attach_and_break
function might beDebugActiveProcess
to attach andDebugBreakProcess
to break. Running(:dbg)
in the REPL will cause this to happenCheck Stopped
This function is called by the debug watcher thread periodically to check if the process has crashed or hit a breakpoint. If the process is still running, this function should return quickly. This is probably
WaitForDebugEvent
with a 0 timeout.Memory
There are functions to read and write GOAL memory. These can probably use
ReadProcessMemory
. They are used to read the symbol table, and insert break instructions.Registers
For now, we only need GPRs + RIP. This is only called once the process is stopped. This should probably use the
GetThreadContext
function.Tests
There are unit tests for the debugger in
test_debugger
that should work on windows once this is implemented.Missing features
The debugger is still pretty basic. It can display registers, a stacktrace, and disassembly with source lines. It does support breakpoints and reading/saving memory, but so far those haven't been useful. One issue is that the backtraces tend to be huge because it displays the disassembly for each function. You can comment out the
disassemble_at_rip
inside ofDebugger::get_backtrace
to get rid of this, if needed.The text was updated successfully, but these errors were encountered: