This package provides the functions to output text to debuggers on Windows
( Renamed and simplified from go-outputdebug )
- On Windows, the functions call the OutputDebugStringW API
- With the compile option
-tags=ndebug
, debug strings are discarded - On non-Windows operating systems, the functions do nothing
- You can check if debugging is enabled or disabled by referring to
dbg.Enabled
package main
import (
"github.com/nyaosorg/go-windows-dbg"
)
func main() {
dbg.Print("output", 1, "text")
dbg.Printf("output<%d>text", 1)
dbg.Println("output", 1, "text")
println("Enabled=", dbg.Enabled)
}
> start dbgview.exe
> go run example.go
Screenshot of DebugView for Windows
dbg.X
is the small function similar with dbg!
on Rust.
package main
import (
"github.com/nyaosorg/go-windows-dbg"
)
func main() {
println(dbg.X(1 + 2))
}
> start dbgview.exe
> go run example2.go
3