From bb775f145721fba5683307a6089269e19396b597 Mon Sep 17 00:00:00 2001 From: chunseok lee Date: Wed, 27 Sep 2017 01:15:38 -0400 Subject: 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. 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. Change-Id: I06e8dce6bf9b2506e62edaa6b2629cd5cfacfc0d --- ...ify-C-language-in-DWARF-debug-information.patch | 39 +++++++++++++ .../0034-Introduce-FEATURE_GDBJIT_LANGID_CS.patch | 68 ++++++++++++++++++++++ packaging/coreclr.spec | 7 ++- 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 packaging/0033-Specify-C-language-in-DWARF-debug-information.patch create mode 100644 packaging/0034-Introduce-FEATURE_GDBJIT_LANGID_CS.patch diff --git a/packaging/0033-Specify-C-language-in-DWARF-debug-information.patch b/packaging/0033-Specify-C-language-in-DWARF-debug-information.patch new file mode 100644 index 0000000000..b06a4f0588 --- /dev/null +++ b/packaging/0033-Specify-C-language-in-DWARF-debug-information.patch @@ -0,0 +1,39 @@ +From 8a9a359a078b0332bf1ba5cf0dd7c538177527f0 Mon Sep 17 00:00:00 2001 +From: Konstantin Baladurin +Date: Thu, 31 Aug 2017 15:09:32 +0300 +Subject: [PATCH] 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. +--- + src/vm/gdbjit.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/vm/gdbjit.cpp b/src/vm/gdbjit.cpp +index 50f1bb2..9b70a6b 100644 +--- a/src/vm/gdbjit.cpp ++++ b/src/vm/gdbjit.cpp +@@ -740,6 +740,9 @@ const int AbbrevTableSize = sizeof(AbbrevTable); + #define DWARF_LINE_RANGE 14 + #define DWARF_OPCODE_BASE 13 + ++/* TODO: use corresponding constant when it will be added to llvm */ ++#define DW_LANG_MICROSOFT_CSHARP 0x9e57 ++ + 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} + }; +@@ -753,7 +756,7 @@ struct __attribute__((packed)) DebugInfoCU + uint32_t m_cu_name; + uint32_t m_line_num; + } debugInfoCU = { +- 1, 0, DW_LANG_C89, 0, 0 ++ 1, 0, DW_LANG_MICROSOFT_CSHARP, 0, 0 + }; + + struct __attribute__((packed)) DebugInfoTryCatchSub +-- +2.7.4 + diff --git a/packaging/0034-Introduce-FEATURE_GDBJIT_LANGID_CS.patch b/packaging/0034-Introduce-FEATURE_GDBJIT_LANGID_CS.patch new file mode 100644 index 0000000000..9a9be0911e --- /dev/null +++ b/packaging/0034-Introduce-FEATURE_GDBJIT_LANGID_CS.patch @@ -0,0 +1,68 @@ +From 1e96f53060b04c63877c607684066baa421145e3 Mon Sep 17 00:00:00 2001 +From: Konstantin Baladurin +Date: Thu, 7 Sep 2017 18:24:01 +0300 +Subject: [PATCH] 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. +--- + clrdefinitions.cmake | 3 +++ + clrfeatures.cmake | 1 + + src/vm/gdbjit.cpp | 6 ++++++ + 3 files changed, 10 insertions(+) + +diff --git a/clrdefinitions.cmake b/clrdefinitions.cmake +index 6db2b24..627cfff 100644 +--- a/clrdefinitions.cmake ++++ b/clrdefinitions.cmake +@@ -113,6 +113,9 @@ if(FEATURE_EVENT_TRACE) + endif(FEATURE_EVENT_TRACE) + if(CLR_CMAKE_PLATFORM_LINUX) + add_definitions(-DFEATURE_PERFTRACING) ++if(FEATURE_GDBJIT_LANGID_CS) ++ add_definitions(-DFEATURE_GDBJIT_LANGID_CS) ++endif(FEATURE_GDBJIT_LANGID_CS) + endif(CLR_CMAKE_PLATFORM_LINUX) + if(CLR_CMAKE_PLATFORM_UNIX) + add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1) +diff --git a/clrfeatures.cmake b/clrfeatures.cmake +index 0e2801c..b9261f6 100644 +--- a/clrfeatures.cmake ++++ b/clrfeatures.cmake +@@ -1,5 +1,6 @@ + if(CLR_CMAKE_TARGET_TIZEN_LINUX) + set(FEATURE_EVENT_TRACE 1) ++ set(FEATURE_GDBJIT_LANGID_CS 1) + endif() + + if(NOT DEFINED FEATURE_EVENT_TRACE) +diff --git a/src/vm/gdbjit.cpp b/src/vm/gdbjit.cpp +index 9b70a6b..37466e3 100644 +--- a/src/vm/gdbjit.cpp ++++ b/src/vm/gdbjit.cpp +@@ -740,8 +740,10 @@ 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} +@@ -756,7 +758,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 +-- +2.7.4 + diff --git a/packaging/coreclr.spec b/packaging/coreclr.spec index 18de9a8542..b3f664f1d9 100644 --- a/packaging/coreclr.spec +++ b/packaging/coreclr.spec @@ -23,7 +23,7 @@ Source1000: downloaded_files.tar.gz Source1001: %{name}.manifest Source1002: libicu.tar.gz Source1003: dep_libs.tar.gz -# Gbp-Ignore-Patches: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 +# Gbp-Ignore-Patches: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Patch0: 0001-Add-project.assets.json-files.patch Patch1: 0001-ARM-Linux-Support-unaligned-struct-read-write-11290.patch Patch2: 0002-x86-Linux-Thread-safe-UMThunkMarshInfo-RunTimeInit-1.patch @@ -58,7 +58,8 @@ Patch30: 0029-Fix-calculation-of-debuginfo-s-size.-13899.patch Patch31: 0030-Force-O3-build-with-clang3.8.patch Patch32: 0031-Port-to-2.0.0-Fix-ARM32-secure-delegate-bug.patch Patch33: 0032-Disable-VSD-Stub-Kind-Prediction-on-H-W-Exception-14.patch - +Patch34: 0033-Specify-C-language-in-DWARF-debug-information.patch +Patch35: 0034-Introduce-FEATURE_GDBJIT_LANGID_CS.patch ExcludeArch: aarch64 @@ -191,6 +192,8 @@ cp %{SOURCE1001} . %patch31 -p1 %patch32 -p1 %patch33 -p1 +%patch34 -p1 +%patch35 -p1 %if 0%{skipmscorlib} %else -- cgit v1.2.3