From 8b2736c71ca6eb8e62a69f57ad07e4e19a95c936 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Dec 2017 11:23:58 -0500 Subject: server: Revert "Report backtraces in codemodel response" The backtrace information is very repetitive and hugely increases the size of the codemodel object. We need to remove it until an alternative representation can be developed. Revert commit v3.10.0-rc1~393^2 (server: Report backtraces in codemodel response, 2017-06-20), except for the protocol version number (because it indicates other new things). Unfortunately this is incompatible with clients that expect the "crossReferences" field in targets. However, the regression in memory usage is quite serious, especially on large projects, and therefore breaks even older clients that do not use backtraces. Since the "crossReferences" field was only provided by one release (3.10.0), it is simplest to revert it outright for 3.10.1. Fixes: #17502 --- Help/manual/cmake-server.7.rst | 42 +----------------------------------- Help/release/3.10.rst | 12 +++++++++++ Source/cmServerDictionary.h | 5 ----- Source/cmServerProtocol.cxx | 49 ------------------------------------------ 4 files changed, 13 insertions(+), 95 deletions(-) diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index c56e5a7..50a90ee 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -506,9 +506,6 @@ Each target object can have the following keys: with the sysroot path. "fileGroups" contains the source files making up the target. -"crossReferences" - contains the location of the target in the corresponding CMakeLists.txt - file and the locations of the related statements like "target_link_libraries" FileGroups are used to group sources using similar settings together. @@ -534,16 +531,6 @@ Each fileGroup object may contain the following keys: All file paths in the fileGroup are either absolute or relative to the sourceDirectory of the target. -CrossReferences object is used to report the location of the target (including -the entire call stack if the target is defined in a function) and the related -"target_link_libraries", "target_include_directories", "target_compile_definitions" -and "target_compile_options" statements. - -See the example below for details on the internal format of the "crossReferences" object. -Line numbers stated in the "backtrace" entries are 1-based. The last entry of a backtrace -is a special entry with missing "line" and "name" fields that specifies the initial -CMakeLists.txt file. - Example:: [== "CMake Server" ==[ @@ -580,34 +567,7 @@ CMake will reply:: "linkerLanguage": "C", "name": "cmForm", "sourceDirectory": "/home/code/src/cmake/Source/CursesDialog/form", - "type": "STATIC_LIBRARY", - "crossReferences": { - "backtrace": [ - { - "line": 7, - "name": "add_executable", - "path": "C:/full/path/CMakeLists.txt" - }, - { - "path": "c:/full/path/CMakeLists.txt" - } - ], - "relatedStatements": [ - { - "backtrace": [ - { - "line": 8, - "name": "target_link_libraries", - "path": "c:/full/path/CMakeLists.txt" - }, - { - "path": "c:/full/path/CMakeLists.txt" - } - ], - "type": "target_link_libraries" - } - ] - } + "type": "STATIC_LIBRARY" } ] }, diff --git a/Help/release/3.10.rst b/Help/release/3.10.rst index 35fe602..6a19dbf 100644 --- a/Help/release/3.10.rst +++ b/Help/release/3.10.rst @@ -255,3 +255,15 @@ Other Changes incompatible with the old behavior, it is expected that behavior under typical use cases with properly-quoted command-lines has not changed. + +Updates +======= + +Changes made since CMake 3.10.0 include the following. + +3.10.1 +------ + +* The :manual:`cmake-server(7)` ``codemodel`` response ``crossReferences`` + field added by 3.10.0 has been dropped due to excessive memory usage. + Another approach will be needed to provide backtrace information. diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h index 405ff6b..e6a7ae6 100644 --- a/Source/cmServerDictionary.h +++ b/Source/cmServerDictionary.h @@ -89,11 +89,6 @@ static const std::string kWARN_UNUSED_KEY = "warnUnused"; static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories"; static const std::string kWATCHED_FILES_KEY = "watchedFiles"; -static const std::string kTARGET_CROSS_REFERENCES_KEY = "crossReferences"; -static const std::string kLINE_NUMBER_KEY = "line"; -static const std::string kBACKTRACE_KEY = "backtrace"; -static const std::string kRELATED_STATEMENTS_KEY = "relatedStatements"; - static const std::string kSTART_MAGIC = "[== \"CMake Server\" ==["; static const std::string kEND_MAGIC = "]== \"CMake Server\" ==]"; diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index e835b7a..13b18c2 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -9,7 +9,6 @@ #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLinkLineComputer.h" -#include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmServer.h" @@ -20,7 +19,6 @@ #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmTarget.h" #include "cm_uv.h" #include "cmake.h" @@ -732,37 +730,6 @@ static Json::Value DumpSourceFilesList( return result; } -static Json::Value DumpBacktrace(const cmListFileBacktrace& backtrace) -{ - Json::Value result = Json::arrayValue; - - cmListFileBacktrace backtraceCopy = backtrace; - while (!backtraceCopy.Top().FilePath.empty()) { - Json::Value entry = Json::objectValue; - entry[kPATH_KEY] = backtraceCopy.Top().FilePath; - if (backtraceCopy.Top().Line) { - entry[kLINE_NUMBER_KEY] = static_cast(backtraceCopy.Top().Line); - } - if (!backtraceCopy.Top().Name.empty()) { - entry[kNAME_KEY] = backtraceCopy.Top().Name; - } - result.append(entry); - backtraceCopy = backtraceCopy.Pop(); - } - return result; -} - -static void DumpBacktraceRange(Json::Value& result, const std::string& type, - cmBacktraceRange range) -{ - for (auto const& bt : range) { - Json::Value obj = Json::objectValue; - obj[kTYPE_KEY] = type; - obj[kBACKTRACE_KEY] = DumpBacktrace(bt); - result.append(obj); - } -} - static Json::Value DumpTarget(cmGeneratorTarget* target, const std::string& config) { @@ -797,22 +764,6 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, result[kFULL_NAME_KEY] = target->GetFullName(config); - Json::Value crossRefs = Json::objectValue; - crossRefs[kBACKTRACE_KEY] = DumpBacktrace(target->Target->GetBacktrace()); - - Json::Value statements = Json::arrayValue; - DumpBacktraceRange(statements, "target_compile_definitions", - target->Target->GetCompileDefinitionsBacktraces()); - DumpBacktraceRange(statements, "target_include_directories", - target->Target->GetIncludeDirectoriesBacktraces()); - DumpBacktraceRange(statements, "target_compile_options", - target->Target->GetCompileOptionsBacktraces()); - DumpBacktraceRange(statements, "target_link_libraries", - target->Target->GetLinkImplementationBacktraces()); - - crossRefs[kRELATED_STATEMENTS_KEY] = std::move(statements); - result[kTARGET_CROSS_REFERENCES_KEY] = std::move(crossRefs); - if (target->HaveWellDefinedOutputFiles()) { Json::Value artifacts = Json::arrayValue; artifacts.append( -- cgit v0.12 From 976370d134a2d7b22b6f43f6031b0ee850a01d9d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Dec 2017 11:45:51 -0500 Subject: server: drop "ctestInfo" backtrace information Backtrace information was included by commit 35a52bd1b4 (server: add "ctestInfo" request to get test info, 2017-10-25) to match that already provided for targets. However, the backtrace representation uses too much memory and needs to be dropped. Remove it from test information. Issue: #17502 --- Help/manual/cmake-server.7.rst | 11 ----------- Source/cmServerProtocol.cxx | 3 --- 2 files changed, 14 deletions(-) diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index c2aef99..7232174 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -669,17 +669,6 @@ Each test object can have the following keys: contains the test command. "properties" contains a list of test property objects. -"backtrace" - contains a list of backtrace objects that specify where the test was defined. - -Each backtrace object can have the following keys: - -"path" - contains the full path to the file containing the statement. -"line" - contains the line number in the file where the statement was defined. -"name" - contains the name of the statement that added the test. Each test property object can have the following keys: diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index da354bd..b9b06db 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -799,9 +799,6 @@ static Json::Value DumpCTestInfo(cmTest* testInfo) } result[kPROPERTIES_KEY] = properties; - // Need backtrace to figure out where this test was originally added - result[kBACKTRACE_KEY] = DumpBacktrace(testInfo->GetBacktrace()); - return result; } -- cgit v0.12