在VSCode 1.12.2 / Linux Mint上使用--pkg libvala-0.36开发Vala(libvala)程序18.运行F5调试会话,我能够设置断点并查看局部变量值。但我似乎无法让Vala对象显示类数据而不仅仅是地址。例如:
foreach (Vala.SourceFile src in context.get_source_files ()) {
var source = find_source_file (src.filename) ;
Debug窗口(和鼠标悬停)显示src:Object @#* 0x660aa0而不是Vala.SourceFile类对象。我猜是没有加载libvala符号表? " apt search"显示安装了libvala-0.36-0-dbg和libvala-0.36-dev软件包,但不确定如何使用它们。
谷歌搜索,我找到了对#34; valac-dbgsym"的引用。所以我试过......
sudo apt-get install valac-dbgsym
E: Unable to locate package valac-dbgsym
感谢您对我做错的帮助/见解。我的目标是运行调试并显示Vala。???调试窗口中的类对象数据。 谢谢你的帮助!
george@george-KT369AA-ABA-a6512p ~ $ sudo apt search libvala
p libvala-0.30-0 - C# like language for the GObject system -
p libvala-0.30-0:i386 - C# like language for the GObject system -
p libvala-0.30-0-dbg - C# like language for the GObject system -
p libvala-0.30-0-dbg:i386 - C# like language for the GObject system -
p libvala-0.30-dev - C# like language for the GObject system -
p libvala-0.30-dev:i386 - C# like language for the GObject system -
p libvala-0.34-0 - C# like language for the GObject system -
p libvala-0.34-0:i386 - C# like language for the GObject system -
p libvala-0.34-0-dbg - C# like language for the GObject system -
p libvala-0.34-0-dbg:i386 - C# like language for the GObject system -
p libvala-0.34-dev - C# like language for the GObject system -
p libvala-0.34-dev:i386 - C# like language for the GObject system -
i libvala-0.36-0 - C# like language for the GObject system -
p libvala-0.36-0:i386 - C# like language for the GObject system -
i libvala-0.36-0-dbg - C# like language for the GObject system -
p libvala-0.36-0-dbg:i386 - C# like language for the GObject system -
i libvala-0.36-dev - C# like language for the GObject system -
p libvala-0.36-dev:i386 - C# like language for the GObject system -
v libvala-dev -
v libvala-dev:i386 -
p libvaladoc-data - API documentation generator for vala (data
v libvaladoc-data:i386 -
p libvaladoc-dev - API documentation generator for vala (deve
p libvaladoc-dev:i386 - API documentation generator for vala (deve
p libvaladoc3 - API documentation generator for vala (libr
p libvaladoc3:i386 - API documentation generator for vala (libr
===========================================================================
----------building CSharp2Vala.exe
===========================================================================
valac -X -I/media/george/SharedData/Projects/Vala/vala-extra-vapis/ --verbose --vapidir=/media/george/SharedData/P
rojects/Vala/osslibs/ --girdir=/media/george/SharedData/Projects/Vala/osslibs/ --pkg gio-2.0 --define=DEBUG --save
-temps -g -X -w \
--pkg libvala-0.36 \
--pkg gee-0.8 \
-X -DGETTEXT_PACKAGE="..." \
-X -I/media/george/SharedData/Projects/Vala/CSharp2Vala/Echo-src/lib \
-X /media/george/SharedData/Projects/Vala/CSharp2Vala/Echo-src/lib/libecho.so \
/media/george/SharedData/Projects/Vala/CSharp2Vala/Echo-src/lib/libecho.vapi \
/media/george/SharedData/Projects/Vala/CSharp2Vala/CSharp2Vala.vala \ -o /media/george/SharedData/Projects/Vala/CSharp2Vala/CSharp2Vala.exe
Loaded package `/usr/share/vala-0.36/vapi/glib-2.0.vapi'
Loaded package `/usr/share/vala-0.36/vapi/gobject-2.0.vapi'
Loaded package `/usr/share/vala-0.36/vapi/gio-2.0.vapi'
Loaded package `/usr/share/vala-0.36/vapi/libvala-0.36.vapi'
Loaded package `/usr/share/vala/vapi/gee-0.8.vapi'
cc -g -o '/media/george/SharedData/Projects/Vala/CSharp2Vala/CSharp2Vala.exe' '/media/george/SharedData/Projects/V
ala/CSharp2Vala/CSharp2Vala.c' -pthread -I/usr/include/vala-0.36 -I/usr/include/gee-0.8 -I/usr/include/glib-2.0 -I
/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgio-2.0 -lvala-0.36 -lgee-0.8 -lgobject-2.0 -lglib-2.0 '-I/media/geor
ge/SharedData/Projects/Vala/vala-extra-vapis/' '-w' '-DGETTEXT_PACKAGE=...' '-I/media/george/SharedData/Projects/V
ala/CSharp2Vala/Echo-src/lib' '/media/george/SharedData/Projects/Vala/CSharp2Vala/Echo-src/lib/libecho.so'
Compilation succeeded - 3 warning(s)
答案 0 :(得分:0)
您应该知道libvala
是客户端使用的内部API,例如valac
和vapigen
。这两个客户端都是在主要源代码中开发的,因此与libvala
API保持同步。 API没有太大变化,但是例如,即将发布的0.38版本commit c9aa47会从API中删除CCode和Codegen符号,仅将其设为私有libvala
。此外,commit e1b399会向Report.set_colors
添加可选参数。但是,多年来,许多IDE工具已经开始直接使用libvala
。因此,务实的建议是尽可能避免使用libvala
API,如果必须,尽可能少使用API。通常使用现有工具使用的API部分。
如果您希望自己开发libvala
,那么在配置Autotools构建时可以使用--enable-coverage
构建Vala。这将在libvala
中为Vala源文件添加行号,因此在回溯中显示Vala源和行号。您还需要安装GLib
调试符号。我认为这在Ubuntu中是libglib2.0-0-dbgsym
。
如果您要调试Vala程序。然后,--debug
的{{1}}开关将源文件和行号添加到最终二进制文件中。使用Meson build with Vala时,BTW valac
是默认设置。 Vala中的类型系统基于GLib,因此也需要安装GLib2调试符号。