gdbdebugging带有断点:Gtk-WARNING **:无效的文本缓冲区迭代器

我怎样才能debugging(并达到一些断点)与gdb我的越野车程序(使用GTK3)显示

(monimelt:161): Gtk-WARNING **: Invalid text buffer iterator: either the iterator is uninitialized,or the characters/pixbufs/widgets in the buffer have been modified since the iterator was created. You must use marks,character numbers,or line numbers to preserve a position across buffer modifications. You can apply tags and insert marks without invalidating your iterators,but any mutation that affects 'indexable' buffer contents (contents that can be referred to by character offset) will invalidate all outstanding iterators

FWIW,错误的程序是我开发的一些GPLv3免费软件(同样我问了这个问题 ,我给了更多的上下文和解释)。 它在github上:提交fc8e0b247d8dac4 (重现我的错误,构build它,运行它为./monimelt ,在标签为monimelt命令的窗口中正好input一个 TAB )。

我已经尝试过(所有,在同一个gdb会话):

在我的main g_log_set_default_handler函数(正如这里所build议的)调用相当早的时候,用我自己的mom_g_log_handler日志处理程序mom_g_log_handler并在那里放置一个gdb断点

C程序中有多个线程

有没有办法从UTF8转换为ISO-8859-1?

P /调用ioctl系统调用

在Windows上编译dlib示例?

如何添加一个库到Eclipse C项目?

把gdb断点放在g_warning (不起作用,因为这可能是一个macros)

把gdb断点放在g_log_default_handler上

调用(在提交fb374425c69f2ddbd … )

g_log_set_handler ("Gtk",G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_LEVEL_ERROR | G_LOG_LEVEL_WARNING | G_LOG_FLAG_RECURSION,mom_g_log_handler,NULL);

不帮忙…

但是这些断点没有达到, Gtk-WARNING **: Invalid text buffer iterator消息仍然出现。

也许GTK正在创build一些pthreads,或者它正在注册自己的日志处理程序…

我怎么find我的错误….

我终于find了我的错误(更正提交82bb111402fdd97 … )。 在gtk_text_iter_get_offset发生了两次对gtk_text_iter_get_offset调用错误地)。

但是我对我发现错误的方式并不满意 。 我必须获取gtk + -3.21.6.tar.xz,然后将其gtk/gtktextiter.c为在180行附近的代码如下:

extern void basile_gtk_text_iter_warning (void); void basile_gtk_text_iter_warning (void) { usleep (1000); } /* This function ensures that the segment-dependent information is truly computed lazily; often we don't need to do the full make_real work. This ensures the btree and line are valid,but doesn't update the segments. */ static GtkTextRealIter* gtk_text_iter_make_surreal (const GtkTextIter *_iter) { GtkTextRealIter *iter = (GtkTextRealIter*)_iter; if (iter->chars_changed_stamp != _gtk_text_btree_get_chars_changed_stamp (iter->tree)) { g_warning ("Invalid text buffer iterator: either the iterator " "is uninitialized,or the characters/pixbufs/widgets " "in the buffer have been modified since the iterator " "was created.nYou must use marks," "or line numbers to preserve a position across buffer " "modifications.nYou can apply tags and insert marks " "without invalidating your iterators,n" "but any mutation that affects 'indexable' buffer contents " "(contents that can be referred to by character offset)n" "will invalidate all outstanding iterators"); basile_gtk_text_iter_warning (); return NULL; }

我做的唯一的改变(原始GTK3.21.26)是定义和调用basile_gtk_text_iter_warning ,我用gdb把一个断点。

能够做这样的诡计是我只是尽可能地使用自由软件的原因之一,但是做这样的技巧真是一个耻辱,必须有更好的办法。

所以我的问题仍然存在,我怎么能没有重新编译GTK3这样的断点呢? 或者更一般地说,我怎样才能使用GDB来捕捉这些错误 (当然,不需要重新编译GTK3)。

顺便说一句,使用简单的--g-fatal-warnings选项并不是一个真正的解决scheme,因为我也越来越

(monimelt:21949): Gtk-WARNING **: Failed to get the GNOME session proxy: The name org.gnome.SessionManager is not owned

我认为这是一个虚假警告,因为我的桌面是Mate,而不是Gnome。 我的代码调用gtk_application_new & g_application_run并在我的mom_gtkapp上有一个activate信号。

PS。 在Linux / Debian / Sid / x86-64上,GTK3是3.21.5,用GCC6和-g3 -Og标志编译…

如何在Linux中做密码学(数字签名)

使用纯c ++或java设置文件夹权限

C试图在标题中find r n r n

数据网格视图颠倒成员:已解决

停止并使用C ++在Linux中重新开始运行进程

您可以通过在g_logv上放置断点来中断g_warning(以及任何其他日志级别的消息)。

在这里找到这个信息,fyi: http ://wiki.inkscape.org/wiki/index.PHP/Debugging_Inkscape

相关文章

可以认为OpenFeign是Feign的增强版,不同的是OpenFeign支持S...
为进一步规范小程序交易生态、提升用户购物体验、满足用户在...
云原生之使用Docker部署Dashdot服务器仪表盘
本文主要描述TensorFlow之回归模型的基本原理
1.漏洞描述Apache Druid 是一个集时间序列数据库、数据仓库和...
内部类(当作类中的一个普通成员变量,只不过此成员变量是cl...