[PATCH] D119326: [clang] [MinGW] Default to DWARF 4

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 9 05:26:51 PST 2022


mstorsjo created this revision.
mstorsjo added reviewers: dblaikie, rnk, mati865.
mstorsjo requested review of this revision.
Herald added a project: clang.

Neither LLDB nor GDB seem to work with DWARF 5 debug information on
Windows right now.

This applies the same change as in
9c6272861032f511a23784ce0c5cc8f6ac2f625b <https://reviews.llvm.org/rG9c6272861032f511a23784ce0c5cc8f6ac2f625b> (Default to DWARFv4 on Windows)
to the MinGW driver too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119326

Files:
  clang/lib/Driver/ToolChains/MinGW.h
  clang/test/CodeGen/dwarf-version.c


Index: clang/test/CodeGen/dwarf-version.c
===================================================================
--- clang/test/CodeGen/dwarf-version.c
+++ clang/test/CodeGen/dwarf-version.c
@@ -32,6 +32,11 @@
 //     Explicitly request both.
 // RUN: %clang -target i686-pc-windows-msvc -gdwarf -gcodeview -S -emit-llvm -o - %s \
 // RUN:     | FileCheck %s --check-prefixes=VER4,CODEVIEW
+
+// Check what version of dwarf is used for MinGW targets.
+// RUN: %clang -target i686-pc-windows-gnu -g -S -emit-llvm -o - %s | \
+// RUN:   FileCheck %s --check-prefixes=VER4
+
 // RUN: %clang -target powerpc-ibm-aix-xcoff -g -S -emit-llvm -o - %s | \
 // RUN:   FileCheck %s --check-prefix=VER3
 // RUN: %clang -target powerpc-ibm-aix-xcoff -gdwarf-2 -S -emit-llvm -o - %s | \
Index: clang/lib/Driver/ToolChains/MinGW.h
===================================================================
--- clang/lib/Driver/ToolChains/MinGW.h
+++ clang/lib/Driver/ToolChains/MinGW.h
@@ -90,6 +90,8 @@
 
   void printVerboseInfo(raw_ostream &OS) const override;
 
+  unsigned GetDefaultDwarfVersion() const override { return 4; }
+
 protected:
   Tool *getTool(Action::ActionClass AC) const override;
   Tool *buildLinker() const override;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119326.407127.patch
Type: text/x-patch
Size: 1217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220209/e32e8135/attachment.bin>


More information about the cfe-commits mailing list