XmacsLabs / lolly

lolly: A user-friendly C++ library
https://xmacslabs.github.io/lolly/
GNU General Public License v3.0
10 stars 6 forks source link

[12_22] get_stacktrace on tbox #198

Closed jingkaimori closed 1 year ago

da-liii commented 1 year ago

这是在Windows上执行单元测试的输出:

Backtrace of C++ stack:
  null
  null
  null
  null
  BaseThreadInitThunk
  RtlUserThreadStart

上面都是null

jingkaimori commented 1 year ago

这是在Windows上执行单元测试的输出:

Backtrace of C++ stack:
  null
  null
  null
  null
  BaseThreadInitThunk
  RtlUserThreadStart

上面都是null

因为Windows下用release模式编译的测试,没有调试信息,所以获取不到函数名。

在xmake.lua文件的开头加如下语句:

add_rules("mode.debug", "mode.releasedbg")

然后用调试或者releasedbg模式编译,才能出剩下几个函数名

da-liii commented 1 year ago

现在可以了:

Backtrace of C++ stack:
  DOCTEST_ANON_FUNC_23
  doctest::Context::run
  main
  __scrt_common_main_seh
  BaseThreadInitThunk
  RtlUserThreadStart