summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorquantimnot <54247259+quantimnot@users.noreply.github.com>2022-06-10 14:40:08 -0400
committerGitHub <noreply@github.com>2022-06-10 20:40:08 +0200
commit6f4bacff67e2e219ef914e24d9f9aaf34a6d1eb1 (patch)
treea77b7708c6405f672dc7d105bc60cd0bf0f185a5 /compiler
parent1e5dd9022b0d86d63d616431a0f9959ca4c10f40 (diff)
downloadNim-6f4bacff67e2e219ef914e24d9f9aaf34a6d1eb1.tar.gz
Extend and document compiler debugging utilities (#19841)
* Add two debugutils procs that native debuggers can break on use to
  execute commands when code of interest is being compiled.
* Add GDB and LLDB programs to disable and enable breakpoints and
  watchpoints when code of interest is being compiled.
* Extend the `intern.rst` docs regarding debugging the compiler.

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/debugutils.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/debugutils.nim b/compiler/debugutils.nim
index d109d2121..adbb0517f 100644
--- a/compiler/debugutils.nim
+++ b/compiler/debugutils.nim
@@ -54,3 +54,19 @@ proc isCompilerDebug*(): bool =
       {.undef(nimCompilerDebug).}
       echo 'x'
   conf0.isDefined("nimCompilerDebug")
+
+proc enteringDebugSection*() {.exportc, dynlib.} =
+  ## Provides a way for native debuggers to enable breakpoints, watchpoints, etc
+  ## when code of interest is being compiled.
+  ## 
+  ## Set your debugger to break on entering `nimCompilerIsEnteringDebugSection`
+  ## and then execute a desired command.
+  discard
+
+proc exitingDebugSection*() {.exportc, dynlib.} =
+  ## Provides a way for native debuggers to disable breakpoints, watchpoints, etc
+  ## when code of interest is no longer being compiled.
+  ## 
+  ## Set your debugger to break on entering `exitingDebugSection`
+  ## and then execute a desired command.
+  discard