diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java
index 9739d9b94bf585a6fb7eb5fb8cc433bdc7717396..a6902d271636f89b4a1599f3340f2c0143afa9d6 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java
@@ -42,4 +42,9 @@ public abstract class RRootNode extends RootNode {
     public int getParameterCount() {
         return parameterNames.length;
     }
+
+    public String getSourceCode() {
+        return getSourceSection().getCode();
+    }
+
 }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinNode.java
index 7088ea6b614c42ba6c506e00e96545cc7eb6474f..a214b61b1ac7fa4cda06c0f009c7eb9f6170a22c 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinNode.java
@@ -25,6 +25,7 @@ package com.oracle.truffle.r.nodes.builtin;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.frame.*;
+import com.oracle.truffle.api.impl.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.r.nodes.*;
 import com.oracle.truffle.r.nodes.access.*;
@@ -37,6 +38,10 @@ import com.oracle.truffle.r.runtime.data.*;
 @NodeChild(value = "arguments", type = RNode[].class)
 public abstract class RBuiltinNode extends CallNode {
 
+    public String getSourceCode() {
+        return "<builtin>";
+    }
+
     public abstract RNode[] getArguments();
 
     public abstract RBuiltinFactory getBuiltin();
@@ -234,6 +239,11 @@ public abstract class RBuiltinNode extends CallNode {
             return builtin;
         }
 
+        @Override
+        public String getSourceCode() {
+            return "<custom builtin>";
+        }
+
     }
 
     public static class RSnippetNode extends RCustomBuiltinNode {
@@ -243,11 +253,17 @@ public abstract class RBuiltinNode extends CallNode {
         public RSnippetNode(RNode[] arguments, RBuiltinFactory builtin, FunctionExpressionNode function) {
             super(arguments, builtin);
             snippetCall = adoptChild(CallNode.createCall(function, CallArgumentsNode.create(getArguments(), new String[]{})));
+            assignSourceSection(((DefaultCallTarget) ((FunctionExpressionNode.StaticFunctionExpressionNode) function).getFunction().getTarget()).getRootNode().getSourceSection());
         }
 
         @Override
         public Object execute(VirtualFrame frame) {
             return snippetCall.execute(frame);
         }
+
+        @Override
+        public String getSourceCode() {
+            return getSourceSection().getCode();
+        }
     }
 }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinRootNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinRootNode.java
index e79eb80d2cb7febb7d1c0a827871cae9fdced714..a0427b5acb4b099995d6cd969d5dcc6c57b58208 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinRootNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinRootNode.java
@@ -43,4 +43,10 @@ public final class RBuiltinRootNode extends RRootNode {
     public CallNode inline(CallArgumentsNode args) {
         return builtin.inline(args);
     }
+
+    @Override
+    public String getSourceCode() {
+        return builtin.getSourceCode();
+    }
+
 }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RLibraryLoader.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RLibraryLoader.java
index 4cddc47142b657b136981c87168c9b9003e11eb3..2122f319ad09d089adca3ceabe2a542d5124a9d4 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RLibraryLoader.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RLibraryLoader.java
@@ -56,7 +56,7 @@ public class RLibraryLoader {
                 WriteVariableNode.UnresolvedWriteLocalVariableNode fnDef = (WriteVariableNode.UnresolvedWriteLocalVariableNode) libNode;
                 String builtinName = fnDef.getSymbol().toString();
                 FunctionExpressionNode.DynamicFunctionExpressionNode builtinExpr = (FunctionExpressionNode.DynamicFunctionExpressionNode) fnDef.getRhs();
-                builtinDefs.put(builtinName, new FunctionExpressionNode.StaticFunctionExpressionNode(new RFunction("", builtinExpr.getCallTarget(), false)));
+                builtinDefs.put(builtinName, new FunctionExpressionNode.StaticFunctionExpressionNode(new RFunction(builtinName, builtinExpr.getCallTarget(), false)));
             }
         }
         return builtinDefs;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java
index e1eff2930b45016bb7aff76a99b14f916c602f19..7e4c08e8987950f98ac0338d6cb7c380367d16f7 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java
@@ -100,7 +100,7 @@ public abstract class PrettyPrinterNode extends RNode {
 
     @Specialization
     public String prettyPrint(RFunction operand) {
-        return ((DefaultCallTarget) operand.getTarget()).getRootNode().getSourceSection().getCode();
+        return ((RRootNode) ((DefaultCallTarget) operand.getTarget()).getRootNode()).getSourceCode();
     }
 
     @Specialization