- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我如何使用 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 免费软件(我在 this question 中询问过,我在其中提供了更多上下文和解释)。它在 github 上:commit fc8e0b247d8dac4 (要重现我的错误,构建它,以 ./monimelt
运行它,准确键入 p a y < kbd>TAB 在标有 monimelt 命令 的窗口中。
我已经试过了(全部都在同一个 gdb
session 中):
在我的 main
中很早就调用了 g_log_set_default_handler使用我自己的 mom_g_log_handler
日志处理程序函数(如建议的 here )并在那里放置一个 gdb 断点
在 g_warning
上放置一个 gdb 断点(不起作用,因为它可能是一个宏)
在 g_log_default_handler 上设置 gdb 断点
同时调用(在提交 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 正在创建一些 pthreads,或者它正在注册自己的日志处理程序...
我终于找到了我的错误(在提交 82bb111402fdd97... 中更正)。在 gtk_text_buffer_insert
之后(错误地)发生了两次对 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, character numbers, "
"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;
}
我所做的唯一更改(w.r.t. pristine GTK3.21.26)是对 basile_gtk_text_iter_warning
的定义和调用,我使用 gdb
在其中放置了一个断点。
能够做这样卑鄙的把戏是我尽可能只使用免费软件的原因之一,但不得不做这样的把戏实在是一种耻辱,必须有更好的方法。
所以我的问题仍然存在,我怎么能放置这样一个断点而不重新编译 GTK3?或者更一般地说,我如何使用 GDB 来捕获此类错误(当然无需重新编译 GTK3)。
顺便说一句,使用简单的 --g-fatal-warnings
选项并不是真正的解决方案,因为我也得到了
(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
信号。
附言。在 Linux/Debian/Sid/x86-64 上,GTK3 是 3.21.5,使用 GCC6 和 -g3 -Og
标志编译...
最佳答案
您可以通过在 g_logv 上放置断点来中断 g_warning(以及任何其他日志级别消息)。
我在这里找到了这个信息,仅供引用:http://wiki.inkscape.org/wiki/index.php/Debugging_Inkscape
关于c - gdb调试(带断点): Gtk-WARNING **: Invalid text buffer iterator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39509231/
有没有办法在clojurescript中创建断点? 在 repl 或 chromes native 调试器中。 我试过 (js* "debugger") 这会返回 SyntaxError: Unexp
我有一个断点列表,每次调试特定程序时我都想添加这些断点。 有没有办法可以将所有断点信息放在一个文件中并在每个调试 session 开始时使用它?换句话说,我可以在我发出“运行”命令之前,向 GDB 提
我们能否在函数上设置 GDB 断点,使其仅在函数参数与指定值匹配时才中断?例如 int foo(int i) { return i*i; } int main() { foo(0); ....
我的应用程序当前在启动时崩溃,我只有一个 MainActivity 类,我正在尝试找出导致它的原因 我发现有多个Log Log.v();//详细 Log.d();//调试 Log.i();//信息 L
我在 Eclipse Helios 和 Mac OS X 最后的 Leopard 中工作,同时处理多个项目。我在项目 1 中设置了断点并且很好。项目 2 是项目 1 的分支,因此包含类似的文件。当我尝
当我在我的应用程序中单击一个按钮时,将执行一系列 Javascript 代码,在这种特殊情况下,我单击“取消”按钮以关闭当前打开的模式窗口。这close按钮在 HTML 上看起来像这样: Cancel
我已经在 objective-c 中编写了这个小程序。 int x; x=1; while (x<60) { self.jalo.text = [NSString stringWithForm
Twitter Boot strap 使用这些断点: 大显示:1200px默认值:980px平板电脑:768px手机:480px 一个客户说他们使用 1280px 作为他们的大屏幕断点。 这些是否有行
我正在尝试在 gdb 中设置断点以在 exit(0) 信号之前停止。我试过了: stop sigquit 虽然程序仍然没有停止就退出。如何为此设置断点? 最佳答案 您是否尝试在 exit 或 _exi
最新的 dart 编辑器支持调试和断点,它在静态 HTML 页面中工作。我有一个现有的后端 (Django),当我将“启动目标”设置为 URL 时,我无法让调试器工作。 我收到这个错误: An int
我有一个汇编程序,在不同的行上有几个标签。我需要设置一个 gdb在带有标签的行之后的两行断点。我怎么能在 gdb 中做到这一点不向程序添加额外的标签? 最佳答案 gdb支持在标签后添加 X 个字节的断
我有一个 IDE 断点 (delphi-xe),每次编译和运行程序时它都会重新出现。我该如何摆脱它。 Delphi 在哪里保存有关断点的信息? 更新: 1.断点未在“Breakpoints”面板中列出
breakpoints.up、breakpoints.down、breakpoints. Between 和 breakpoints.value 之间有什么区别> ?这段代码是什么意思,断点值在这里如
这个问题已经有答案了: Eclipse pausing without a breakpoint (6 个回答) 已关闭 8 年前。 我正在使用 Eclipse Juno。当我调试桌面应用程序时,调试
我是一名 CS 学生,所以我对编程还是很陌生。断点看起来非常酷并且对调试很有用,所以我决定尝试一下它们。 不幸的是,我真的不知道如何与他们合作。我在“记录断点和参数并自动继续”中添加了一个断点。程序到
使用 VStudio 2010 和 C# 我有一个名为哺乳动物的类。狗和猫继承自哺乳动物。 然而,一只特定的狗在呕吐,我需要找出原因。 我想在 Mammal 类中设置一个断点 - 但仅当 Dog 类正
编辑:我尝试在一个非常简单的程序上使用编辑器中内置的断点,它起作用了。所以我的代码(使用了大量的实例内存)和调试器可能对 nano 实例来说太多了。 我一直在命令行上使用 gdb 进行调试和设置断点。
我正在编写一个通过抛出异常从错误中恢复的应用程序。 然而,在调试时,我希望我的调试器在抛出异常之前在我的错误点停止。无论如何添加一些代码会导致GDB用某些代码中断执行。 我对 ARM 和 x86 架构
我正在为一个应用程序使用 MapKit。 我正在将信息存储在全局字典中,然后再次访问它们。 每个都使用文本+用户名+日期的键存储。此实例中的用户名变量包含字符串的日期和用户名 func mapView
在 PyCharm 中是否可以在外部 python 库中放置断点并单步执行? 对于上下文,我遵循 Django REST 框架快速入门指南:http://www.django-rest-framewo
我是一名优秀的程序员,十分优秀!