[PATCH] D92958: [gn build] Add symbol_level to adjust debug info level

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 17:02:34 PST 2020


aeubanks added inline comments.


================
Comment at: llvm/utils/gn/build/BUILD.gn:99
+      } else if (symbol_level == 1) {
+        cflags += [ "/Zd" ]
+      }
----------------
thakis wrote:
> I think you don't need this. As far as I know, `Zd` is a cl.exe-level option that causes it to pass /DEBUG to `link.exe` and does nothing else. But we don't invoke cl.exe for links, we invoke `link.exe` directly. `link.exe /debug` will produce enough symbol information to create symbolized backtraces, but not enough to have line numbers. So you can either do nothing for symbol_level=1 with cflags and just pass /debug to ldflags like we already do, or you could do `if (symbol_level == 1 && is_clang) cflags += -gline-tables-only` (or -g1, same thing) so that we get the same behavior on linux and windows at least with clang as host compiler.
using clang, `/Zd` (without `/Zi`) does give line info.

In clang/test/Driver/cl-options.c I see
```
// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
// Zi: "-gcodeview"
// Zi: "-debug-info-kind=limited"

// RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
// Z7GMLT: "-gcodeview"
// Z7GMLT: "-debug-info-kind=line-tables-only"
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92958



More information about the llvm-commits mailing list