Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add debugger build for JVM backend.
  • Loading branch information
jnthn committed Feb 19, 2014
1 parent 9660042 commit 23ecfa4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
17 changes: 15 additions & 2 deletions tools/build/Makefile-JVM.in
Expand Up @@ -168,6 +168,9 @@ J_CORE_SOURCES = \
src/core/OS.pm \
src/core/core_epilogue.pm \

PERL6_DEBUG_JAR = perl6-debug.jar
J_DEBUG_RUNNER = perl6-debug-m@runner_suffix@

J_CLEANUPS = \
*.manifest \
blib/Perl6/*.jar \
Expand All @@ -184,12 +187,14 @@ J_CLEANUPS = \
perl6-eval-server \
perl6-jdb-server \
eval-client.pl \
$(J_RUNNER)
$(J_RUNNER) \
$(PERL6_DEBUG_JAR) \
$(J_DEBUG_RUNNER) \

J_HARNESS_WITH_FUDGE = $(PERL) t/harness --fudge --keep-exit-code --jvm
J_HARNESS = $(PERL) t/harness --jvm

j-all: $(PERL6_JAR) $(SETTING_JAR) $(J_RUNNER) lib/Test.jar blib/lib.jar blib/Pod/To/Text.jar
j-all: $(PERL6_JAR) $(SETTING_JAR) $(J_RUNNER) lib/Test.jar blib/lib.jar blib/Pod/To/Text.jar $(PERL6_DEBUG_JAR) $(J_DEBUG_RUNNER)

$(RUNTIME_JAR): $(RUNTIME_JAVAS)
$(PERL) -MExtUtils::Command -e mkpath bin
Expand Down Expand Up @@ -257,6 +262,12 @@ j-runner-default: j-all
$(CP) $(J_RUNNER) perl6$(BAT)
$(CHMOD) 755 perl6$(BAT)

$(PERL6_DEBUG_JAR): src/perl6-debug.nqp $(PERL6_JVM)
$(J_NQP) --target=jar --javaclass=perl6-debug --output=$(PERL6_DEBUG_JAR) \
src/perl6-debug.nqp

$(J_DEBUG_RUNNER): tools/build/create-jvm-runner.pl $(PERL6_DEBUG_JAR)
$(PERL) tools/build/create-jvm-runner.pl dev-debug . . $(NQP_PREFIX) $(NQP_JARS)

## testing targets
lib/Test.jar: lib/Test.pm $(PERL6_JAR) $(SETTING_JAR) $(J_RUNNER)
Expand Down Expand Up @@ -318,12 +329,14 @@ j-install: j-all tools/build/create-jvm-runner.pl
$(CP) $(PERL6_LANG_JARS) $(DESTDIR)$(PERL6_LANG_DIR)/lib/Perl6
$(CP) $(SETTING_JAR) $(DESTDIR)$(PERL6_LANG_DIR)/runtime
$(CP) $(PERL6_JAR) $(DESTDIR)$(PERL6_LANG_DIR)/runtime
$(CP) $(PERL6_DEBUG_JAR) $(DESTDIR)$(PERL6_LANG_DIR)/runtime
$(CP) $(RUNTIME_JAR) $(DESTDIR)$(PERL6_LANG_DIR)/runtime
$(CP) lib/Test.jar $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(CP) blib/lib.jar $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/lib/Pod/To
$(CP) blib/Pod/To/Text.jar $(DESTDIR)$(PERL6_LANG_DIR)/lib/Pod/To
$(PERL) tools/build/create-jvm-runner.pl install "$(DESTDIR)" $(PREFIX) $(NQP_PREFIX) $(NQP_JARS)
$(PERL) tools/build/create-jvm-runner.pl install-debug "$(DESTDIR)" $(PREFIX) $(NQP_PREFIX) $(NQP_JARS)

j-runner-default-install: j-install
$(PERL) tools/build/create-jvm-runner.pl install "$(DESTDIR)" $(PREFIX) $(NQP_PREFIX) $(NQP_JARS)
Expand Down
23 changes: 17 additions & 6 deletions tools/build/create-jvm-runner.pl
Expand Up @@ -12,6 +12,12 @@
my ($type, $destdir, $prefix, $nqpprefix, $thirdpartyjars) = @ARGV
or die $USAGE;

my $debugger = 0;
if ($type =~ /^(\w+)\-debug$/) {
$type = $1;
$debugger = 1;
}

die "Invalid target type $type" unless $type eq 'dev' || $type eq 'install';

my $cpsep = $^O eq 'MSWin32' ? ';' : ':';
Expand Down Expand Up @@ -44,15 +50,20 @@ sub install {
my $bootclasspath = join($cpsep,
($thirdpartyjars,
File::Spec->catfile($jardir, 'rakudo-runtime.jar'),
File::Spec->catfile($jardir, 'perl6.jar')));
File::Spec->catfile($jardir, $debugger ? 'perl6-debug.jar' : 'perl6.jar')));

my $classpath = join($cpsep, ($jardir, $libdir, $nqplibdir));
my $jopts = '-Xms100m -Xbootclasspath/a:' . $bootclasspath
. ' -cp ' . $classpath
. ' -Dperl6.prefix=' . $prefix;

install "perl6-j", "java $jopts perl6";
install "perl6-jdb-server", "java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n $jopts perl6";
install "perl6-eval-server", "java $jopts org.perl6.nqp.tools.EvalServer";
cp(File::Spec->catfile($nqpprefix,'bin','eval-client.pl'), '.')
or die "Couldn't copy 'eval-client.pl' from $nqpprefix: $!";
if ($debugger) {
install "perl6-debug-j", "java $jopts perl6-debug";
}
else {
install "perl6-j", "java $jopts perl6";
install "perl6-jdb-server", "java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n $jopts perl6";
install "perl6-eval-server", "java $jopts org.perl6.nqp.tools.EvalServer";
cp(File::Spec->catfile($nqpprefix,'bin','eval-client.pl'), '.')
or die "Couldn't copy 'eval-client.pl' from $nqpprefix: $!";
}

0 comments on commit 23ecfa4

Please sign in to comment.