summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLib/testDebuggerThread.cxx
blob: 3b7fe6e2fad92f2ad5d7b4ac244a4e5348f65140 (plain)
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
#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({ testStackFrameFunctionName });
}