summaryrefslogtreecommitdiff
path: root/shared/debug.go
diff options
context:
space:
mode:
author Lukacs T. Berki <lberki@google.com> 2021-02-26 14:27:36 +0100
committer Lukacs T. Berki <lberki@google.com> 2021-03-03 09:14:22 +0100
commit7690c099539884c8c4a94429eed54573586321be (patch)
tree6c947227785120140c4bc8fc1b7083833ae58a21 /shared/debug.go
parent3bed960399dad2f97f75ef33e1ab407b84d3e6c7 (diff)
cd to / before running soong_build .
This lets one avoid any decisions as to when to chdir there during its execution and leads to better sandboxing because the pwd doesn't leak to init() functions anymore. Test: Manual. Change-Id: I1560da8ed3a621249426f9e8908aa890c21e13ba
Diffstat (limited to 'shared/debug.go')
-rw-r--r--shared/debug.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/shared/debug.go b/shared/debug.go
new file mode 100644
index 000000000..0c9ba4f95
--- /dev/null
+++ b/shared/debug.go
@@ -0,0 +1,17 @@
+package shared
+
+import (
+ "os"
+ "os/exec"
+)
+
+// Finds the Delve binary to use. Either uses the SOONG_DELVE_PATH environment
+// variable or if that is unset, looks at $PATH.
+func ResolveDelveBinary() string {
+ result := os.Getenv("SOONG_DELVE_PATH")
+ if result == "" {
+ result, _ = exec.LookPath("dlv")
+ }
+
+ return result
+}