Dart: Build and Edit DartVM from Eclipse

In previous post I mentioned how to get eclipse debugger hooked up to DartVM. Here I’d like to comment how one could generate Makefiles from the cmake branch and import the C/C++/Dart code into eclipse to edit and build. Here we start off by having the built environment:

git clone git@github.com:syntheticpp/dartruntime.git
cd dartruntime
git checkout -b cmake origin/cmake
cd ..
mkdir build
cd build
cmake ../dartruntime/cmake/
make -j4
echo "main() { print(\"Hello World\!\"); }" > hello.dart
./bin/dart ./hello.dart

Then import the build directory as a “Existing Code as Makefile Project”. We can now build from eclipse by clicking on the build button in the eclipse editor. We would like to import the dart runtime into eclipse so we can get the ability to edit from an IDE and build from an IDE.

Import an “Existing Code as Makefile Project” and choosing the runtime directory. Chose the GNU autotools toolchain when selecting the “Toolchain Indexer Settings”. This should now provide better ability to navigate the code and build from the IDE. Note that the build output will be sent to the build folder and if the Makefiles get wiped out from the build folder you would have to regenerate them from cmake.

Dart: Exploring the DartVM from a debugger on Mac OSX

This may be useless to many, obvious to some and complete wrong for others, but I would like to comment for the wondering dart on how to debug the VM. Goal of this post is to provide a quick and reproducible way to explore the DartVM at runtime on Mac OSX. I personally enjoy watching code from a debugger, so this was helpful to explore what is going on under the hood. We currently have two projects to debug from. dartruntime and dart.googlecode.com. Get this version of Eclipse Mac OSX 32bit cocoa.

I typically use the cmake branch cause I’m working with dart on Mac OSX and I dont want to touch xcode. The main dart project generates xcode projects for builds, you could use xcode to edit the c++ code. Having to choose between eclipse or xcode, I personally pick eclipse. Using the cmake project is a little cleaner/simpiler/complete to import from as Makefile project. (I could be wrong, but didn’t want to invest more time into importing stuff I’m not interested in). Setting up DartVM the song and dance from googlecode goes like this. For using the cmake branch provided by Peter Kümmel is as follows:

git clone git@github.com:syntheticpp/dartruntime.git
cd dartruntime
git checkout -b cmake origin/cmake
cd ..
mkdir build
cd build
cmake ../dartruntime/cmake/
make -j4
echo "main() { print(\"Hello World\!\"); }" > hello.dart
./bin/dart ./hello.dart

After having a debug build on either branch you can target the executable directly by choosing to importing C/C++ Executable. Next select the executable you want to target from either build. The debug builds will provide all the symbols and source code mapping. Name the project and debug launch target as you need. Set the arguments to pass to the dartvm, here we are setting a hello world sample based on an Actor Model. The debugger will break on the main entry point.

It is proabably possible that the dart runtime envionment setup is similar to what chrome is used too, so the instructions on how to setup eclipse for chrome may also apply. I have not tried it out my self. A follow up post will show how to import the c++ code to eclipse and build from generated Makefiles.

Follow

Get every new post delivered to your Inbox.