https://github.com/fireflycons/go-debugger
Debugger utilities for Go projects
https://github.com/fireflycons/go-debugger
Last synced: 5 months ago
JSON representation
Debugger utilities for Go projects
- Host: GitHub
- URL: https://github.com/fireflycons/go-debugger
- Owner: fireflycons
- License: mit
- Created: 2025-12-30T08:38:19.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-12-31T07:42:14.000Z (6 months ago)
- Last Synced: 2026-01-03T00:57:35.237Z (6 months ago)
- Language: Go
- Size: 19.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# debugger
```go
import "github.com/fireflycons/go-debugger"
```
Package debugger contains utilities for managing debug sessions of the application this package is imported into.
Supported archtectures and what's detected:
- Linux: any debugger
- Windows: any debugger
- MacOS: dlv or gdb
- FreeBSD \(64 bit\): dlv or gdb
## Index
- [func Attached\(\) bool](<#Attached>)
- [func Poll\(ctx context.Context, freq time.Duration\)](<#Poll>)
```go
func Attached() bool
```
Attached returns true if this process has an attached debugger.
This reads from a variable that is initialized asynchronously, therefore there is zero cost to call it. It is initialized when the process starts, therefore will start as true if launched by a debugger, e.g. an IDE interactive session.
Example use case would be to dynamically set a longer context timeout such that it does not cancel in the middle of a debugging session.
Note that the value will not become true if you attach a debugger to an already running process, unless you have started a poll.
```go
func Poll(ctx context.Context, freq time.Duration)
```
Poll starts a background task to continuously poll at the frequency specified for a debugger attaching after the process has started, and stop polling when the context is cancelled. The value returned by Attached\(\) is updated accordingly.
This function returns immediately upon starting the poll goroutine.
Currently only supported for Linux and Windows. It is a no\-op for any other OS. You probably don't want to do this in production builds.
Generated by [gomarkdoc]()