[GDBJIT] Specify C# language in DWARF debug information (dotnet/coreclr#13720)
authorKonstantin Baladurin <k.baladurin@partner.samsung.com>
Tue, 12 Sep 2017 10:44:24 +0000 (13:44 +0300)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 12 Sep 2017 10:44:24 +0000 (12:44 +0200)
* [GDBJIT] Specify C# language in DWARF debug information

To correctly support C# language in lldb DWARF debug information
should contain correct information about language.

Now we use 0x9e57 constant for specify C# language.

* [GDBJIT] Introduce FEATURE_GDBJIT_LANGID_CS

If this feature is set gdbjit will use 0x9e57 as c# lang id,
otherwise it will use DW_LANG_C89.

Commit migrated from https://github.com/dotnet/coreclr/commit/18ab3567e2ea6e2a385527bb247b0eec32a995cb

src/coreclr/clrdefinitions.cmake
src/coreclr/clrfeatures.cmake
src/coreclr/src/vm/gdbjit.cpp

index c6f4ad6..6cec17b 100644 (file)
@@ -122,6 +122,9 @@ endif()
 if(FEATURE_GDBJIT_FRAME)
     add_definitions(-DFEATURE_GDBJIT_FRAME)
 endif(FEATURE_GDBJIT_FRAME)
+if(FEATURE_GDBJIT_LANGID_CS)
+    add_definitions(-DFEATURE_GDBJIT_LANGID_CS)
+endif(FEATURE_GDBJIT_LANGID_CS)
 if(CLR_CMAKE_PLATFORM_LINUX)
     add_definitions(-DFEATURE_PERFTRACING)
 endif(CLR_CMAKE_PLATFORM_LINUX)
index fde04d2..3d5d155 100644 (file)
@@ -1,5 +1,6 @@
 if(CLR_CMAKE_TARGET_TIZEN_LINUX)
   set(FEATURE_EVENT_TRACE 0)
+  set(FEATURE_GDBJIT_LANGID_CS 1)
 endif()
 
 if(FEATURE_STANDALONE_GC_ONLY)
index f931614..1ffab8a 100644 (file)
@@ -756,6 +756,11 @@ const int AbbrevTableSize = sizeof(AbbrevTable);
 #define DWARF_LINE_RANGE 14
 #define DWARF_OPCODE_BASE 13
 
+#ifdef FEATURE_GDBJIT_LANGID_CS
+/* TODO: use corresponding constant when it will be added to llvm */
+#define DW_LANG_MICROSOFT_CSHARP 0x9e57
+#endif
+
 DwarfLineNumHeader LineNumHeader = {
     0, 2, 0, 1, 1, DWARF_LINE_BASE, DWARF_LINE_RANGE, DWARF_OPCODE_BASE, {0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1}
 };
@@ -769,7 +774,11 @@ struct __attribute__((packed)) DebugInfoCU
     uint32_t m_cu_name;
     uint32_t m_line_num;
 } debugInfoCU = {
+#ifdef FEATURE_GDBJIT_LANGID_CS
+    1, 0, DW_LANG_MICROSOFT_CSHARP, 0, 0
+#else
     1, 0, DW_LANG_C89, 0, 0
+#endif
 };
 
 struct __attribute__((packed)) DebugInfoTryCatchSub