From d1df98ad3e58cd8868222002554173b7c366cc71 Mon Sep 17 00:00:00 2001 From: redanthrax Date: Wed, 15 Jun 2022 14:42:40 -0700 Subject: [PATCH] debug and vscode debug launch --- .gitignore | 1 + .vscode/launch.json | 18 ++++++++++++++++++ agent/rpc.go | 4 ++++ shared/debug.go | 5 +++++ shared/nodebug.go | 5 +++++ 5 files changed, 33 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 shared/debug.go create mode 100644 shared/nodebug.go diff --git a/.gitignore b/.gitignore index 363cf4a..db67ee0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ *.bmp build/Output tacticalagent-v* +tacticalagent \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..da5b13e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch file", + "type": "go", + "request": "launch", + "mode": "debug", + "env": {}, + "args": ["-m", "svc", "-logto", "stdout"], + "buildFlags": "-tags=DEBUG", + "program": "${workspaceRoot}" + } + ] +} \ No newline at end of file diff --git a/agent/rpc.go b/agent/rpc.go index 7d24d0b..79f479f 100644 --- a/agent/rpc.go +++ b/agent/rpc.go @@ -49,6 +49,10 @@ var ( ) func (a *Agent) RunRPC() { + if rmm.DEBUG { + a.Logger.Infoln("DEBUG MODE") + } + a.Logger.Infoln("Agent service started") go a.RunAsService() var wg sync.WaitGroup diff --git a/shared/debug.go b/shared/debug.go new file mode 100644 index 0000000..0893720 --- /dev/null +++ b/shared/debug.go @@ -0,0 +1,5 @@ +//go:build DEBUG + +package shared + +const DEBUG = true \ No newline at end of file diff --git a/shared/nodebug.go b/shared/nodebug.go new file mode 100644 index 0000000..e2032ee --- /dev/null +++ b/shared/nodebug.go @@ -0,0 +1,5 @@ +//go:build !DEBUG + +package shared + +const DEBUG = false \ No newline at end of file