Skip to content

Commit 1f7af24

Browse files
authored
Merge pull request #2705 from dotty-staging/debugging
support debugging for dotc/dotr
2 parents bc9b520 + b416fc7 commit 1f7af24

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

dist/bin/common

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,6 @@ SCALA_ASM=$(find_lib "*scala-asm*")
112112
SCALA_LIB=$(find_lib "*scala-library*")
113113
SCALA_XML=$(find_lib "*scala-xml*")
114114
SBT_INTF=$(find_lib "*sbt-interface*")
115+
116+
# debug
117+
DEBUG_STR=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

dist/bin/dotc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ case "$1" in
7676
--) shift; for arg; do addResidual "$arg"; done; set -- ;;
7777
-h|-help) help=true && shift ;;
7878
-v|-verbose) verbose=true && shift ;;
79-
-debug) debug=true && shift ;;
79+
-debug) DEBUG="$DEBUG_STR" && shift ;;
8080
-q|-quiet) quiet=true && shift ;;
8181

8282
# Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
@@ -103,6 +103,7 @@ classpathArgs
103103

104104
eval exec "\"$JAVACMD\"" \
105105
${JAVA_OPTS:-$default_java_opts} \
106+
"$DEBUG" \
106107
"${java_args[@]}" \
107108
"$jvm_cp_args" \
108109
-Dscala.usejavacp=true \

dist/bin/dotr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ source "$PROG_HOME/bin/common"
3131

3232
CLASS_PATH=".$PSEP$DOTTY_LIB$PSEP$SCALA_LIB"
3333

34+
# -d must be the first option
35+
case "$1" in
36+
-d) DEBUG="$DEBUG_STR" && shift ;;
37+
esac
38+
3439
first_arg="$1"
3540

3641
if [ -z "$1" ]; then
@@ -39,5 +44,5 @@ if [ -z "$1" ]; then
3944
elif [[ ${first_arg:0:1} == "-" ]]; then
4045
eval "$PROG_HOME/bin/dotc -repl $@"
4146
else
42-
eval exec "\"$JAVACMD\"" "-classpath \"$CLASS_PATH\"" $@
47+
eval exec "\"$JAVACMD\"" "$DEBUG" "-classpath \"$CLASS_PATH\"" $@
4348
fi

0 commit comments

Comments
 (0)