sbt runEngineDistribution --debug to ease debuggging (#6745)

This commit is contained in:
Jaroslav Tulach 2023-05-18 15:00:52 +02:00 committed by GitHub
parent 9e491e7c0b
commit 2bc7d346a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -7,6 +7,8 @@ import sbt.util.{CacheStore, CacheStoreFactory, FileInfo, Tracked}
import scala.sys.process._
import org.enso.build.WithDebugCommand
object DistributionPackage {
/** File extensions. */
@ -263,6 +265,10 @@ object DistributionPackage {
all.add(enso.getAbsolutePath())
all.addAll(args.asJava)
pb.command(all)
if (args.contains("--debug")) {
all.remove("--debug")
pb.environment().put("JAVA_OPTS", WithDebugCommand.DEBUG_OPTION)
}
pb.inheritIO()
val p = pb.start()
val exitCode = p.waitFor()

View File

@ -15,6 +15,8 @@ import sbt._
* }}}
*/
object WithDebugCommand {
val DEBUG_OPTION =
"-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y";
val truffleNoBackgroundCompilationOptions = Seq(
"-Dpolyglot.engine.BackgroundCompilation=false"
@ -78,9 +80,7 @@ object WithDebugCommand {
else Seq()
val debuggerOpts =
if (debugFlags.contains(debuggerOption))
Seq(
"-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y"
)
Seq(DEBUG_OPTION)
else Seq()
val javaOpts: Seq[String] = Seq(
truffleNoBackgroundCompilationOptions,