Unverified Commit 365e77b1 authored by lassulus's avatar lassulus Committed by GitHub
Browse files

breakpointHook: support FODs and non-sandboxed builds (#402485)

parents b440606b ee0f7be7
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ elif [ "$(echo "$pids" | wc -l)" -ne 1 ]; then
fi
pid="$(echo "$pids" | head -n1)"


# get the build top level directory inside the sandbox (eg. /build)
buildDir=$(getVar NIX_BUILD_TOP)

# bash is needed to load the env vars, as we do not know the syntax of the debug shell.
# bashInteractive is used instead of bash, as we depend on it anyways, due to it being
#   the default debug shell
@@ -71,11 +75,11 @@ pwd="$(readlink /proc/$pid/cwd)"
# If another shell is chosen via `debugShell`, it will only have simple env vars avaialable.
exec nsenter --mount --ipc --uts --pid  --net --target "$pid" "$bashInteractive" -c "
  set -eu -o pipefail
  source /build/env-vars
  source \"$buildDir/env-vars\"
  cd \"$pwd\"
  if [ -n \"$debugShell\" ]; then
    exec \"$debugShell\"
  else
    exec \"$bashInteractive\" --init-file /build/env-vars
    exec \"$bashInteractive\" --init-file \"$buildDir/env-vars\"
  fi
"