From cabaab5e90e19256ae404970091350bb6f0f7139 Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Fri, 24 Feb 2023 19:45:56 -0800 Subject: [PATCH] Add runtime file version to RuntimeInfo (#82648) The diagnostic tooling needs the runtime file version for single-file applications to: 1) Build the long name DAC on Windows 2) SOS commands and other tooling need the version to adjust for different runtime behavior --- src/coreclr/debug/inc/runtimeinfo.h | 6 ++++-- src/coreclr/debug/runtimeinfo/runtimeinfo.cpp | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/coreclr/debug/inc/runtimeinfo.h b/src/coreclr/debug/inc/runtimeinfo.h index a5484c6b81618b..893f57b59b174d 100644 --- a/src/coreclr/debug/inc/runtimeinfo.h +++ b/src/coreclr/debug/inc/runtimeinfo.h @@ -5,7 +5,8 @@ // The first byte of the index is the count of bytes typedef unsigned char SYMBOL_INDEX; -#define RUNTIME_INFO_SIGNATURE "DotNetRuntimeInfo" +#define RUNTIME_INFO_SIGNATURE "DotNetRuntimeInfo" +#define RUNTIME_INFO_VERSION 2 // Make sure that if you update this structure // - You do so in a in a way that it is backwards compatible. For example, only tail append to this. @@ -14,10 +15,11 @@ typedef unsigned char SYMBOL_INDEX; typedef struct _RuntimeInfo { const char Signature[18]; - int Version; + const int Version; const SYMBOL_INDEX RuntimeModuleIndex[24]; const SYMBOL_INDEX DacModuleIndex[24]; const SYMBOL_INDEX DbiModuleIndex[24]; + const int RuntimeVersion[4]; // major, minor, build, revision } RuntimeInfo; extern RuntimeInfo DotNetRuntimeInfo; diff --git a/src/coreclr/debug/runtimeinfo/runtimeinfo.cpp b/src/coreclr/debug/runtimeinfo/runtimeinfo.cpp index 3102f27375f2d7..7dfd0c2afd4b85 100644 --- a/src/coreclr/debug/runtimeinfo/runtimeinfo.cpp +++ b/src/coreclr/debug/runtimeinfo/runtimeinfo.cpp @@ -10,6 +10,7 @@ #include #include +#include // Runtime information public export #ifdef HOST_UNIX @@ -19,7 +20,7 @@ RuntimeInfo DotNetRuntimeInfo = { { RUNTIME_INFO_SIGNATURE }, - 1, + RUNTIME_INFO_VERSION, { #include }, @@ -29,4 +30,7 @@ RuntimeInfo DotNetRuntimeInfo = { { #include }, + { + RuntimeFileMajorVersion, RuntimeFileMinorVersion, RuntimeFileBuildVersion, RuntimeFileRevisionVersion + }, };