summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/offlineasm/config.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/offlineasm/config.rb')
-rw-r--r--Source/JavaScriptCore/offlineasm/config.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/offlineasm/config.rb b/Source/JavaScriptCore/offlineasm/config.rb
index 4c86eeceb..88a0cf5e8 100644
--- a/Source/JavaScriptCore/offlineasm/config.rb
+++ b/Source/JavaScriptCore/offlineasm/config.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Apple Inc. All rights reserved.
+# Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -55,3 +55,26 @@ $enableCodeOriginComments = true
# ...
#
$enableInstrAnnotations = false
+
+# Turns on generation of DWARF2 debug annotions for file and line numbers.
+# Allows for source level debuging of the original .asm files in a debugger.
+#
+def shouldEnableDebugAnnotations()
+ if ENV['GCC_VERSION'] =~ /\.clang\./ and ENV['DT_TOOLCHAIN_DIR'] =~ /Xcode.app/
+ clangVersionOut = %x`xcrun clang --version`
+ if ($? == 0)
+ # clang version 800.0.12 or higher is required for debug annotations
+ versionMatch = /clang-(\d{3,}).(\d{1,3}).(\d{1,3})/.match(clangVersionOut)
+ if versionMatch.length >= 4
+ totalVersion = versionMatch[1].to_i * 1000000 + versionMatch[2].to_i * 1000 + versionMatch[3].to_i
+ if totalVersion >= 800000012
+ return true
+ end
+ end
+ end
+ end
+
+ false
+end
+
+$enableDebugAnnotations = shouldEnableDebugAnnotations()