diff options
author | Brad King <brad.king@kitware.com> | 2023-10-27 13:03:55 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-10-27 13:04:06 (GMT) |
commit | 9627ef86c9633068e4bb33f3f192e3001692ed8f (patch) | |
tree | 408f84546225cac30a2be6a11aa79d71fa8b53b9 /Tests | |
parent | e46e1837dd88a992cec3bafc2ee9c3dcd121d022 (diff) | |
parent | c028425df969ef741de366cc2b765727b8e59c2c (diff) | |
download | CMake-9627ef86c9633068e4bb33f3f192e3001692ed8f.zip CMake-9627ef86c9633068e4bb33f3f192e3001692ed8f.tar.gz CMake-9627ef86c9633068e4bb33f3f192e3001692ed8f.tar.bz2 |
Merge topic 'debugger-function-name-in-stacktrace'
c028425df9 Debugger: report function name in DAP stackframes
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8913
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CMakeLib/testDebuggerThread.cxx | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index b44c8dd..0e71cea 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -42,6 +42,7 @@ if(CMake_ENABLE_DEBUGGER) testDebuggerVariables.cxx testDebuggerVariablesHelper.cxx testDebuggerVariablesManager.cxx + testDebuggerThread.cxx ) endif() if (CMake_TEST_FILESYSTEM_PATH OR NOT CMake_HAVE_CXX_FILESYSTEM) diff --git a/Tests/CMakeLib/testDebuggerThread.cxx b/Tests/CMakeLib/testDebuggerThread.cxx new file mode 100644 index 0000000..0ea95b6 --- /dev/null +++ b/Tests/CMakeLib/testDebuggerThread.cxx @@ -0,0 +1,33 @@ +#include <functional> +#include <memory> +#include <string> +#include <vector> + +#include <cm3p/cppdap/protocol.h> +#include <cm3p/cppdap/types.h> + +#include "cmDebuggerThread.h" +#include "cmListFileCache.h" + +#include "testCommon.h" + +static bool testStackFrameFunctionName() +{ + auto thread = std::make_shared<cmDebugger::cmDebuggerThread>(0, "name"); + const auto* functionName = "function_name"; + auto arguments = std::vector<cmListFileArgument>{}; + cmListFileFunction func(functionName, 10, 20, arguments); + thread->PushStackFrame(nullptr, "CMakeLists.txt", func); + + auto stackTrace = GetStackTraceResponse(thread); + + ASSERT_TRUE(stackTrace.stackFrames[0].name == functionName); + return true; +} + +int testDebuggerThread(int, char*[]) +{ + return runTests(std::vector<std::function<bool()>>{ + testStackFrameFunctionName, + }); +} |