From 6823e15cf08c68ca67f688159536f7a506d1969e Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Mon, 6 Feb 2017 14:51:24 +0100 Subject: [PATCH 1/7] fix #1484: position of while incorrect in debug --- .gitignore | 1 + bin/dotr | 17 +- .../src/dotty/tools/dotc/ast/Desugar.scala | 4 +- compiler/test/debug/Gen | 175 ++++++++++++++++++ compiler/test/debug/test | 17 ++ tests/debug/while.scala | 14 ++ 6 files changed, 225 insertions(+), 3 deletions(-) create mode 100755 compiler/test/debug/Gen create mode 100755 compiler/test/debug/test create mode 100644 tests/debug/while.scala diff --git a/.gitignore b/.gitignore index 1a0b1b6a76fa..9842e0c6bbaa 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,5 @@ build/ # Put local stuff here local/ +compiler/test/debug/Gen.jar diff --git a/bin/dotr b/bin/dotr index f00760006d94..e5a632565cf7 100755 --- a/bin/dotr +++ b/bin/dotr @@ -8,6 +8,10 @@ fi DOTTY_ROOT="$(dirname "$DOTTY_ROOT")" DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute +# debug +DEBUG_STR=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 +DEBUG= + # Load common functions and variables source "$DOTTY_ROOT"/bin/common @@ -24,10 +28,21 @@ function runMain { echo "java bin not detected - please specify with \$JAVA_BIN or install java to a default location" exit 1 else - eval "$jbin $CLASS_PATH $@" + eval "$jbin $DEBUG $CLASS_PATH $@" fi } +# parse command line params -d to enable debugging +while getopts "dx" opt; do + case "$opt" in + d) + DEBUG="$DEBUG_STR" + ;; + esac +done + +shift $((OPTIND-1)) + first_arg="$1" if [ -z "$1" ]; then diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index eda4a12dc82a..e3102fda2fb3 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -991,12 +991,12 @@ object desugar { else Apply(ref(tupleTypeRef.classSymbol.companionModule.valRef), ts) case WhileDo(cond, body) => // {