[PATCH] D92958: [gn build] Add gn arg to only emit line numbers for debug info

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 13:01:35 PST 2020


aeubanks updated this revision to Diff 310624.
aeubanks added a comment.

don't pass both /Zi and /Zd


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92958/new/

https://reviews.llvm.org/D92958

Files:
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/build/buildflags.gni


Index: llvm/utils/gn/build/buildflags.gni
===================================================================
--- llvm/utils/gn/build/buildflags.gni
+++ llvm/utils/gn/build/buildflags.gni
@@ -2,6 +2,9 @@
   # Whether to build with debug information.
   is_debug = false
 
+  # Whether to build with debug information only containing line info. Useful for stack traces.
+  is_debug_lines = false
+
   # Whether to build with tsan.
   use_tsan = false
 
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -72,9 +72,12 @@
     ldflags += [ "-mmacosx-version-min=10.10" ]
   }
 
+  assert(!(is_debug && is_debug_lines), "Cannot specify both is_debug and is_debug_lines")
   if (host_os != "win") {
     if (is_debug) {
       cflags += [ "-g" ]
+    } else if (is_debug_lines) {
+      cflags += [ "-g1" ]
     }
     if (is_optimized) {
       cflags += [ "-O3" ]
@@ -88,11 +91,15 @@
       "-fvisibility-inlines-hidden",
     ]
   } else {
-    if (is_debug) {
+    if (is_debug || is_debug_lines) {
       cflags += [
-        "/Zi",
         "/FS",
       ]
+      if (is_debug_lines) {
+        cflags += [ "/Zi" ]
+      } else if (is_debug_lines) {
+        cflags += [ "/Zd" ]
+      }
       ldflags += [ "/DEBUG" ]
 
       # Speed up links with ghash on windows.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92958.310624.patch
Type: text/x-patch
Size: 1392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201209/35dbbe66/attachment.bin>


More information about the llvm-commits mailing list