- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在main.c
中有这个函数文件创建一个由复选框和条目组成的简单对话框:
void compute_sha2 (GtkWidget *, struct hashWidget_t *);
void compute_sha3 (GtkWidget *, struct hashWidget_t *);
void compute_md5 (struct hashWidget_t *);
void compute_sha1 (struct hashWidget_t *);
void compute_gost94 (struct hashWidget_t *);
void compute_whirlpool (struct hashWidget_t *);
static void
compute_hash ( GtkWidget *fileDialog,
GtkWidget *mainwin,
const gchar *filename)
{
gtk_widget_hide (GTK_WIDGET (fileDialog));
struct hashWidget_t HashWidget;
gsize lenFilename = g_utf8_strlen (filename, -1);
HashWidget.filename = g_malloc (lenFilename + 1);
if (HashWidget.filename == NULL)
{
g_printerr ("Error during memory allocation\n");
return;
}
g_utf8_strncpy (HashWidget.filename, filename, lenFilename);
HashWidget.filename[lenFilename] = '\0';
gint i, result;
const gchar *label[] = {"MD5", "SHA-1", "SHA-256", "SHA3-256", "SHA512", "SHA3-512", "WHIRLPOOL", "GOST94"};
GtkWidget *contentArea, *grid, *dialog;
GtkDialogFlags flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
PangoFontDescription *newFont = pango_font_description_new ();
pango_font_description_set_family (newFont, "monospace");
dialog = gtk_dialog_new_with_buttons ("Select Hash",
GTK_WINDOW (mainwin),
flags,
_("Cancel"), GTK_RESPONSE_REJECT,
NULL);
gtk_widget_set_size_request (dialog, 250, 150);
contentArea = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
for (i = 0; i < NUM_OF_HASH; i++)
{
HashWidget.hashCheck[i] = gtk_check_button_new_with_label (label[i]);
HashWidget.hashEntry[i] = gtk_entry_new ();
gtk_editable_set_editable (GTK_EDITABLE (HashWidget.hashEntry[i]), FALSE);
gtk_widget_override_font (GTK_WIDGET (HashWidget.hashEntry[i]), newFont);
}
pango_font_description_free (newFont);
grid = gtk_grid_new ();
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
gtk_grid_set_row_spacing (GTK_GRID (grid), 5);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashCheck[0], 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashEntry[0], 2, 0, 6, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashCheck[1], 0, 1, 1, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashEntry[1], 2, 1, 6, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashCheck[2], 0, 2, 1, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashEntry[2], 2, 2, 6, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashCheck[3], 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashEntry[3], 2, 3, 6, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashCheck[4], 0, 4, 1, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashEntry[4], 2, 4, 6, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashCheck[5], 0, 5, 1, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashEntry[5], 2, 5, 6, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashCheck[6], 0, 6, 1, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashEntry[6], 2, 6, 6, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashCheck[7], 0, 7, 1, 1);
gtk_grid_attach (GTK_GRID (grid), HashWidget.hashEntry[7], 2, 7, 6, 1);
gtk_container_add (GTK_CONTAINER (contentArea), grid);
gtk_widget_show_all (dialog);
gtk_widget_set_name (GTK_WIDGET (HashWidget.hashCheck[2]), "BtSha256");
gtk_widget_set_name (GTK_WIDGET (HashWidget.hashCheck[3]), "BtSha3_256");
gtk_widget_set_name (GTK_WIDGET (HashWidget.hashCheck[4]), "BtSha512");
gtk_widget_set_name (GTK_WIDGET (HashWidget.hashCheck[5]), "BtSha3_512");
g_signal_connect_swapped (HashWidget.hashCheck[0], "clicked", G_CALLBACK (compute_md5), &HashWidget);
g_signal_connect_swapped (HashWidget.hashCheck[1], "clicked", G_CALLBACK (compute_sha1), &HashWidget);
g_signal_connect (HashWidget.hashCheck[2], "clicked", G_CALLBACK (compute_sha2), &HashWidget);
g_signal_connect (HashWidget.hashCheck[3], "clicked", G_CALLBACK (compute_sha3), &HashWidget);
g_signal_connect (HashWidget.hashCheck[4], "clicked", G_CALLBACK (compute_sha2), &HashWidget);
g_signal_connect (HashWidget.hashCheck[5], "clicked", G_CALLBACK (compute_sha3), &HashWidget);
g_signal_connect_swapped (HashWidget.hashCheck[6], "clicked", G_CALLBACK (compute_whirlpool), &HashWidget);
g_signal_connect_swapped (HashWidget.hashCheck[7], "clicked", G_CALLBACK (compute_gost94), &HashWidget);
result = gtk_dialog_run (GTK_DIALOG (dialog));
switch (result)
{
case GTK_RESPONSE_REJECT:
g_free (HashWidget.filename);
gtk_widget_destroy (dialog);
break;
}
}
compute_*
函数具有相同的代码库(除了 sha2 和 sha3 具有 256/512 switch case):
static goffset get_file_size (const gchar *);
void
compute_sha3 ( GtkWidget *checkBt,
struct hashWidget_t *HashWidget)
{
gint bit;
if (g_strcmp0 (gtk_widget_get_name (checkBt), "BtSha3_256") == 0)
bit = 256;
else if (g_strcmp0 (gtk_widget_get_name (checkBt), "BtSha3_512") == 0)
bit = 512;
if (bit == 256)
{
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (HashWidget->hashCheck[3])))
{
gtk_entry_set_text (GTK_ENTRY (HashWidget->hashEntry[3]), "");
goto fine;
}
else if (g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (HashWidget->hashEntry[3])), -1) == 64)
goto fine;
}
else
{
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (HashWidget->hashCheck[5])))
{
gtk_entry_set_text (GTK_ENTRY (HashWidget->hashEntry[5]), "");
goto fine;
}
else if (g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (HashWidget->hashEntry[5])), -1) == 128)
goto fine;
}
guchar *digest;
gchar *hash;
GError *err = NULL;
gint fd, i, retVal;
goffset fileSize, doneSize = 0, diff = 0, offset = 0;
guint8 *fAddr;
struct sha3_256_ctx ctx256;
struct sha3_512_ctx ctx512;
if (bit == 256)
{
digest = g_malloc (SHA3_256_DIGEST_SIZE);
hash = g_malloc (65);
}
else
{
digest = g_malloc (SHA3_512_DIGEST_SIZE);
hash = g_malloc (129);
}
if (digest == NULL)
{
g_printerr ("sha2: error during memory allocation\n");
return;
}
if (hash == NULL)
{
g_printerr ("sha2: error during memory allocation\n");
g_free (digest);
return;
}
fd = g_open (HashWidget->filename, O_RDONLY | O_NOFOLLOW);
if (fd == -1)
{
g_printerr ("sha2: %s\n", g_strerror (errno));
return;
}
fileSize = get_file_size (HashWidget->filename);
if (bit == 256)
sha3_256_init (&ctx256);
else
sha3_512_init (&ctx512);
if (fileSize < BUF_FILE)
{
fAddr = mmap (NULL, fileSize, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
if (fAddr == MAP_FAILED)
{
g_printerr ("sha2: %s\n", g_strerror (errno));
g_free (digest);
g_free (hash);
g_close (fd, &err);
return;
}
if (bit == 256)
sha3_256_update (&ctx256, fileSize, fAddr);
else
sha3_512_update (&ctx512, fileSize, fAddr);
retVal = munmap (fAddr, fileSize);
if (retVal == -1)
{
g_printerr ("sha2: %s\n", g_strerror (errno));
g_free (digest);
g_free (hash);
g_close (fd, &err);
return;
}
goto nowhile;
}
while (fileSize > doneSize)
{
fAddr = mmap (NULL, BUF_FILE, PROT_READ, MAP_FILE | MAP_SHARED, fd, offset);
if (fAddr == MAP_FAILED)
{
g_printerr ("sha2: %s\n", g_strerror (errno));
g_free (digest);
g_free (hash);
g_close (fd, &err);
return;
}
if (bit == 256)
sha3_256_update(&ctx256, BUF_FILE, fAddr);
else
sha3_512_update(&ctx512, BUF_FILE, fAddr);
doneSize += BUF_FILE;
diff = fileSize - doneSize;
offset += BUF_FILE;
if (diff < BUF_FILE && diff > 0)
{
fAddr = mmap (NULL, diff, PROT_READ, MAP_FILE | MAP_SHARED, fd, offset);
if (fAddr == MAP_FAILED)
{
g_printerr ("sha2: %s\n", g_strerror (errno));
g_free (digest);
g_free (hash);
g_close (fd, &err);
return;
}
if (bit == 256)
sha3_256_update(&ctx256, diff, fAddr);
else
sha3_512_update(&ctx512, diff, fAddr);
retVal = munmap(fAddr, BUF_FILE);
if(retVal == -1){
g_printerr ("sha2: %s\n", g_strerror (errno));
g_free (digest);
g_free (hash);
g_close (fd, &err);
return;
}
break;
}
retVal = munmap(fAddr, BUF_FILE);
if(retVal == -1)
{
g_printerr ("sha2: %s\n", g_strerror (errno));
g_free (digest);
g_free (hash);
g_close (fd, &err);
return;
}
}
nowhile:
if (bit == 256)
{
sha3_256_digest(&ctx256, SHA3_256_DIGEST_SIZE, digest);
for(i=0; i<32; i++)
g_sprintf (hash+(i*2), "%02x", digest[i]);
hash[64] = '\0';
gtk_entry_set_text (GTK_ENTRY (HashWidget->hashEntry[3]), hash);
}
else
{
sha3_512_digest(&ctx512, SHA3_512_DIGEST_SIZE, digest);
for(i=0; i<64; i++)
g_sprintf (hash+(i*2), "%02x", digest[i]);
hash[128] = '\0';
gtk_entry_set_text (GTK_ENTRY (HashWidget->hashEntry[5]), hash);
}
g_close (fd, &err);
g_free (digest);
g_free (hash);
fine:
return;
}
static goffset
get_file_size (const gchar *filePath)
{
GFileInfo *info;
GFile *file;
GError *error = NULL;
const gchar *attributes = "standard::*";
GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
GCancellable *cancellable = NULL;
goffset fileSize;
file = g_file_new_for_path (filePath);
info = g_file_query_info (file, attributes, flags, cancellable, &error);
fileSize = g_file_info_get_size (info);
g_object_unref(file);
return fileSize;
}
问题是当我尝试计算哈希值时出现段错误(下面是 3 个段错误的输出):
polcrypt[1678]: segfault at 7f48a40018d8 ip 00007f48e0ae9e8d sp 00007fff2ce02230 error 4 in libgtk-3.so.0.1200.2[7f48e08ac000+51a000]
gmain[1883]: segfault at 7f8814001b38 ip 00007f885f2a7f8b sp 00007f884ab1fc70 error 6 in libglib-2.0.so.0.4000.0[7f885f262000+130000]
polcrypt[1941]: segfault at 7f885c001b18 ip 00007f88868d045f sp 00007fffa35ddc60 error 7 in libglib-2.0.so.0.4000.0[7f888686c000+130000
有时我在 1 次计算后出现段错误,有时在 3 次计算后出现,依此类推,但我注意到,仅当选择大于 10M 的文件时才会出现段错误。
我认为问题出在 main.c
内部文件,因为如果我输入 g_print
在 compute_*
的末尾函数中,打印语句在出现段错误之前会打印在屏幕上。
我正在 Gentoo ~x64 和 Fedora 20 上使用 GNOME 3.12、Glib 2.40、GCC 4.8 和 libc-2.19 进行开发
编辑(核心转储):
Reading symbols from polcrypt...(no debugging symbols found)...done.
[New LWP 8848]
[New LWP 8849]
[New LWP 8850]
[New LWP 8853]
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./polcrypt'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f38888fada7 in g_slice_alloc () from /usr/lib64/libglib-2.0.so.0
然后是完整的 bt:
(gdb) bt full
#0 0x00007f38888fada7 in g_slice_alloc () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
#1 0x00007f38888b4d35 in g_array_sized_new () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
#2 0x00007f388a4d181f in gtk_widget_path_new () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#3 0x00007f388a4cdc76 in _gtk_widget_create_path () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#4 0x00007f388a2f2820 in gtk_container_real_get_path_for_child () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#5 0x00007f388a2f7cb7 in gtk_container_get_path_for_child () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#6 0x00007f388a2b265d in gtk_box_get_path_for_child () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#7 0x00007f388a2f7cb7 in gtk_container_get_path_for_child () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#8 0x00007f388a2f2820 in gtk_container_real_get_path_for_child () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#9 0x00007f388a2f7cb7 in gtk_container_get_path_for_child () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#10 0x00007f388a4cdc0d in gtk_widget_get_path () from /usr/lib64/libgtk-3.so.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#11 0x00007f388016d100 in adwaita_engine_render_focus () from /usr/lib64/gtk-3.0/3.0.0/theming-engines/libadwaita.so
No symbol table info available.
#12 0x00007f388a4293e1 in gtk_render_focus () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#13 0x00007f388a2e076c in gtk_check_button_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#14 0x00007f388a392ebe in _gtk_marshal_BOOLEAN__BOXEDv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#15 0x00007f388a4bd4dd in gtk_widget_draw_marshallerv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#16 0x00007f3888bda53f in _g_closure_invoke_va () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#17 0x00007f3888bf2f98 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#18 0x00007f3888bf3bfa in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#19 0x00007f388a4cad16 in _gtk_widget_draw_internal.part.62 () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#20 0x00007f388a4cc6eb in _gtk_widget_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#21 0x00007f388a2f7abd in gtk_container_propagate_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#22 0x00007f388a2f7b82 in gtk_container_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#23 0x00007f388a3570a2 in gtk_grid_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#24 0x00007f388a392ebe in _gtk_marshal_BOOLEAN__BOXEDv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#25 0x00007f388a4bd4dd in gtk_widget_draw_marshallerv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#26 0x00007f3888bda53f in _g_closure_invoke_va () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#27 0x00007f3888bf2f98 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#28 0x00007f3888bf3bfa in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#29 0x00007f388a4cad16 in _gtk_widget_draw_internal.part.62 () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#30 0x00007f388a4cc6eb in _gtk_widget_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#31 0x00007f388a2f7abd in gtk_container_propagate_draw () from /usr/lib64/libgtk-3.so.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#32 0x00007f388a2f7b82 in gtk_container_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#33 0x00007f388a2b4882 in gtk_box_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#34 0x00007f388a392ebe in _gtk_marshal_BOOLEAN__BOXEDv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#35 0x00007f388a4bd4dd in gtk_widget_draw_marshallerv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#36 0x00007f3888bda53f in _g_closure_invoke_va () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#37 0x00007f3888bf2f98 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#38 0x00007f3888bf3bfa in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#39 0x00007f388a4cad16 in _gtk_widget_draw_internal.part.62 () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#40 0x00007f388a4cc6eb in _gtk_widget_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#41 0x00007f388a2f7abd in gtk_container_propagate_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#42 0x00007f388a2f7b82 in gtk_container_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#43 0x00007f388a4dd4a4 in gtk_window_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#44 0x00007f388a392ebe in _gtk_marshal_BOOLEAN__BOXEDv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#45 0x00007f388a4bd4dd in gtk_widget_draw_marshallerv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#46 0x00007f3888bda5c7 in _g_closure_invoke_va () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#47 0x00007f3888bf2f98 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#48 0x00007f3888bf3bfa in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#49 0x00007f388a4cad16 in _gtk_widget_draw_internal.part.62 () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#50 0x00007f388a4cc35f in _gtk_widget_draw_windows () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#51 0x00007f388a4cc5af in _gtk_widget_draw () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#52 0x00007f388a4cc903 in gtk_widget_send_expose () from /usr/lib64/libgtk-3.so.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#53 0x00007f388a392435 in gtk_main_do_event () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#54 0x00007f3889f8414b in _gdk_window_process_updates_recurse_helper () from /usr/lib64/libgdk-3.so.0
No symbol table info available.
#55 0x00007f3889f82545 in gdk_window_process_updates_internal () from /usr/lib64/libgdk-3.so.0
No symbol table info available.
#56 0x00007f3889f8266f in gdk_window_process_updates_with_mode () from /usr/lib64/libgdk-3.so.0
No symbol table info available.
#57 0x00007f3888bda5c7 in _g_closure_invoke_va () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#58 0x00007f3888bf2f98 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#59 0x00007f3888bf4132 in g_signal_emit_by_name () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#60 0x00007f3889f7c8b0 in gdk_frame_clock_paint_idle () from /usr/lib64/libgdk-3.so.0
No symbol table info available.
#61 0x00007f3889f6ee68 in gdk_threads_dispatch () from /usr/lib64/libgdk-3.so.0
No symbol table info available.
#62 0x00007f38888e0283 in g_timeout_dispatch () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#63 0x00007f38888df865 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
#64 0x00007f38888dfbc8 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
#65 0x00007f38888dfe8a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
#66 0x00007f388a31a230 in gtk_dialog_run () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#67 0x000000000040a0be in compute_hash ()
No symbol table info available.
#68 0x000000000040871d in choose_file ()
No symbol table info available.
#69 0x00007f3888bda5c7 in _g_closure_invoke_va () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#70 0x00007f3888bf2f98 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#71 0x00007f3888bf3bfa in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#72 0x00007f388a2bfacd in gtk_button_do_release () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#73 0x00007f388a2bfb13 in gtk_real_button_released () from /usr/lib64/libgtk-3.so.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#74 0x00007f3888bda398 in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#75 0x00007f3888beb467 in signal_emit_unlocked_R () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#76 0x00007f3888bf3939 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#77 0x00007f3888bf3bfa in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#78 0x00007f388a2bea31 in gtk_button_button_release () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#79 0x00007f388a392ebe in _gtk_marshal_BOOLEAN__BOXEDv () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#80 0x00007f3888bda5c7 in _g_closure_invoke_va () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#81 0x00007f3888bf2f98 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#82 0x00007f3888bf3bfa in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
No symbol table info available.
#83 0x00007f388a4c0b54 in gtk_widget_event_internal () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#84 0x00007f388a39093c in propagate_event () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#85 0x00007f388a3923b5 in gtk_main_do_event () from /usr/lib64/libgtk-3.so.0
No symbol table info available.
#86 0x00007f3889f9cc72 in gdk_event_source_dispatch () from /usr/lib64/libgdk-3.so.0
No symbol table info available.
#87 0x00007f38888df984 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
#88 0x00007f38888dfbc8 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
#89 0x00007f38888dfc6c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
No symbol table info available.
#90 0x00007f3888ebe0ec in g_application_run () from /usr/lib64/libgio-2.0.so.0
No symbol table info available.
#91 0x00000000004082ff in main ()
No symbol table info available.
最佳答案
发现问题了!此代码段中的 munmap 函数必须采用 diff
作为长度参数,而不是 BUF_FILE
。
if (diff < BUF_FILE && diff > 0)
{
fAddr = mmap (NULL, diff, PROT_READ, MAP_FILE | MAP_SHARED, fd, offset);
retVal = munmap(fAddr, BUF_FILE); //wrong
retVal = munmap(fAddr, diff); //correct
break;
}
关于c - 简单 C/GTK+ 软件上的随机段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25053564/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!