VAPS XT入门教程19.03:调试之trace manager

系列索引:VAPS XT入门教程索引

上一篇:VAPS XT入门教程19.02:调试之编译输出

说明

VAPS XT还提供了一种调试方法,它可以自动输出调用逻辑、调用层级、详细数据。

前提

需要在*.cfg文件中开启trace manager模块支持。

1
REQUIRE_TRACE_MANAGER_SUPPORT=yes

当然,还有更详细的调试输出,可自行探索。

重新编译程序和依赖库。

在运行程序时添加参数-trace_include_all

程序运行时会自动在程序所在目录生成跟踪日志,一般为程序名.log。

trace log

使用

在src/Ports/Target/wogl/vxtPLWindowImpl.cpp中第163行起有这样的代码

1
2
3
VXT_TRACE("vxtPLWindowImpl", "Constructor");
VXT_TRACE_UINT("vxtPLWindowImpl", "a_rDevice", a_rDevice.GetID());
VXT_TRACE_WND_PARAMS("vxtPLWindowImpl", "a_rParams", a_rParams);

程序执行后对应的日志部分

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<entry_point feature="vxtPLDeviceImpl" method="pCreateWindow">
<timing counter="9" millisecs="12"/>
<wnd_params_defn name="a_rParams" RenderingContextID="0" X="2147483647" Y="2147483647" XDeviceObjectPosition="0" YDeviceObjectPosition="0" Width="1600" Height="1200" LayoutMode="VXT_CENTER_LAYOUT" HasBorder="True" BottomLeftWindowOrigin="False" DrawingMode="VXT_ALWAYS_DRAW"/>
<entry_point feature="vxtPLWindowImpl" method="Constructor">
<timing counter="10" millisecs="12"/>
<entry_point feature="vxtPLDeviceImpl" method="GetID">
<timing counter="11" millisecs="12"/>
<prop ReturnValue="0"/>
</entry_point>
<prop a_rDevice="0"/>
<wnd_params_defn name="a_rParams" RenderingContextID="0" X="2147483647" Y="2147483647" XDeviceObjectPosition="0" YDeviceObjectPosition="0" Width="1600" Height="1200" LayoutMode="VXT_CENTER_LAYOUT" HasBorder="True" BottomLeftWindowOrigin="False" DrawingMode="VXT_ALWAYS_DRAW"/>
<entry_point feature="vxtPLDeviceImpl" method="vGetSize">
<timing counter="12" millisecs="12"/>
<prop a_rWidth="2560"/>
<prop a_rHeight="1440"/>
</entry_point>
<entry_point feature="vxtPLDeviceImpl" method="vGetSize">
...

日志为标准xml,里面记录了详细信息。

VXT_TRACE记录了vxtPLWindowImpl类的Constructor函数,标记了位置,对应的日志为

1
<entry_point feature="vxtPLWindowImpl" method="Constructor">

此字段在vxtPLDeviceImpl类的pCreateWindow函数内调用。

下一句为VXT_TRACE_UINT,记录了vxtPLWindowImpl类中的a_rDevice值,从a_rDevice.GetID()中获取,对应日志的

1
2
3
4
5
<entry_point feature="vxtPLDeviceImpl" method="GetID">
<timing counter="11" millisecs="12"/>
<prop ReturnValue="0"/>
</entry_point>
<prop a_rDevice="0"/>

表示a_rDevice是vxtPLDeviceImpl的对象,调用了GetID函数,并且当前返回值为0。

此字段在Constructor内部,表示是在之后调用或者内部调用。

下一句是VXT_TRACE_WND_PARAMS,记录a_rParams值,对应日志为

1
<wnd_params_defn name="a_rParams" RenderingContextID="0" X="2147483647" Y="2147483647" XDeviceObjectPosition="0" YDeviceObjectPosition="0" Width="1600" Height="1200" LayoutMode="VXT_CENTER_LAYOUT" HasBorder="True" BottomLeftWindowOrigin="False" DrawingMode="VXT_ALWAYS_DRAW"/>

这三个跟踪函数处于同一函数中,所以层级也是一样的。

根据日志我们也可以逆向分析VAPS XT内部的调用逻辑。

下一章:VAPS XT入门教程19.04:动态加载图片

技术交流群,欢迎加入讨论。这个圈子很小,大佬可能没兴趣加这些群聊社区之类的。所以只能带你入门,当然,欢迎大佬指导

qq 672991841


VAPS XT入门教程19.03:调试之trace manager
https://feater.top/vapsxt/vapsxt-trace-manager/
作者
JackeyLea
发布于
2023年2月8日
许可协议