summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmDebuggerStackFrame.h4
-rw-r--r--Source/cmDebuggerThread.cxx4
-rw-r--r--Tests/CMakeLib/CMakeLists.txt1
-rw-r--r--Tests/CMakeLib/testDebuggerThread.cxx33
4 files changed, 40 insertions, 2 deletions
diff --git a/Source/cmDebuggerStackFrame.h b/Source/cmDebuggerStackFrame.h
index dc3b2ab..f4e6612 100644
--- a/Source/cmDebuggerStackFrame.h
+++ b/Source/cmDebuggerStackFrame.h
@@ -28,6 +28,10 @@ public:
std::string const& GetFileName() const noexcept { return this->FileName; }
int64_t GetLine() const noexcept;
cmMakefile* GetMakefile() const noexcept { return this->Makefile; }
+ cmListFileFunction const& GetFunction() const noexcept
+ {
+ return this->Function;
+ }
};
} // namespace cmDebugger
diff --git a/Source/cmDebuggerThread.cxx b/Source/cmDebuggerThread.cxx
index fd52f5a..f7a1778 100644
--- a/Source/cmDebuggerThread.cxx
+++ b/Source/cmDebuggerThread.cxx
@@ -13,6 +13,7 @@
#include "cmDebuggerVariables.h"
#include "cmDebuggerVariablesHelper.h"
#include "cmDebuggerVariablesManager.h"
+#include "cmListFileCache.h"
namespace cmDebugger {
@@ -135,8 +136,7 @@ dap::StackTraceResponse GetStackTraceResponse(
#endif
stackFrame.line = thread->Frames[i]->GetLine();
stackFrame.column = 1;
- stackFrame.name = thread->Frames[i]->GetFileName() + " Line " +
- std::to_string(stackFrame.line);
+ stackFrame.name = thread->Frames[i]->GetFunction().OriginalName();
stackFrame.id = thread->Frames[i]->GetId();
stackFrame.source = source;
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,
+ });
+}