Re: njamd compatible with gtk 2.2.1?



Paul

Thanks, I never head of valgrind, but I've tried it. If I understand this right, it looks like a bug somewhere in the Xlibs (thus neither gtk nor my code).

Pete



fenwick 1 329% gcc -o example example.c `pkg-config --cflags --libs gtk+-2.0 gthread-2.0`
fenwick 0 330% !val
valgrind example
==2709== Memcheck, a memory error detector.
==2709== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==2709== Using LibVEX rev 1367, a library for dynamic binary translation.
==2709== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==2709== Using valgrind-3.0.1, a dynamic binary instrumentation framework.
==2709== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==2709== For more details, rerun with: -v
==2709==
==2709== Invalid read of size 4
==2709==    at 0x1BF3EBC5: (within /usr/X11R6/lib/libX11.so.6.2)
==2709==    by 0x1BF3EC49: XGetAtomName (in /usr/X11R6/lib/libX11.so.6.2)
==2709== by 0x1BBBDD7B: gdk_x11_xatom_to_atom_for_display (in /usr/lib/libgdk-x11-2.0.so.0.200.1)
==2709==    by 0x1BBB1AFC: (within /usr/lib/libgdk-x11-2.0.so.0.200.1)
==2709== by 0x1BBB1F35: _gdk_events_queue (in /usr/lib/libgdk-x11-2.0.so.0.200.1)
==2709==    by 0x1BBB213C: (within /usr/lib/libgdk-x11-2.0.so.0.200.1)
==2709==    by 0x1BCF5B34: (within /usr/lib/libglib-2.0.so.0.200.1)
==2709== by 0x1BCF6B77: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.200.1)
==2709==    by 0x1BCF6E8C: (within /usr/lib/libglib-2.0.so.0.200.1)
==2709== by 0x1BCF758E: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.200.1)
==2709==    by 0x1B9F2F5E: gtk_main (in /usr/lib/libgtk-x11-2.0.so.0.200.1)
==2709== by 0x8048A00: main (in /work/petervw/src/rmake/debug_segv_threads/example)
==2709==  Address 0x1C13F36C is 20 bytes inside a block of size 21 alloc'd
==2709==    at 0x1B8FEA35: malloc (vg_replace_malloc.c:149)
==2709== by 0x1BF445F0: _XUpdateAtomCache (in /usr/X11R6/lib/libX11.so.6.2)
==2709==    by 0x1BF447EF: XInternAtom (in /usr/X11R6/lib/libX11.so.6.2)
==2709==    by 0x1BF60773: XSetWMProtocols (in /usr/X11R6/lib/libX11.so.6.2)
==2709==    by 0x1BBC2169: (within /usr/lib/libgdk-x11-2.0.so.0.200.1)
==2709== by 0x1BBC26B8: gdk_window_new (in /usr/lib/libgdk-x11-2.0.so.0.200.1)
==2709==    by 0x1BAE7A9A: (within /usr/lib/libgtk-x11-2.0.so.0.200.1)
==2709== by 0x1BCACD76: g_cclosure_marshal_VOID__VOID (in /usr/lib/libgobject-2.0.so.0.200.1)
==2709==    by 0x1BC9A246: (within /usr/lib/libgobject-2.0.so.0.200.1)
==2709== by 0x1BC99ED6: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.200.1)
==2709==    by 0x1BCAC20E: (within /usr/lib/libgobject-2.0.so.0.200.1)
==2709== by 0x1BCAB9A7: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.200.1)
==2709==
==2709== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 86 from 3)
==2709== malloc/free: in use at exit: 596283 bytes in 3117 blocks.
==2709== malloc/free: 8235 allocs, 5118 frees, 968655 bytes allocated.
==2709== For counts of detected errors, rerun with: -v
==2709== searching for pointers to 3117 not-freed blocks.
==2709== checked 1229412 bytes.
==2709==
==2709== LEAK SUMMARY:
==2709==    definitely lost: 0 bytes in 0 blocks.
==2709==      possibly lost: 800 bytes in 20 blocks.
==2709==    still reachable: 595483 bytes in 3097 blocks.
==2709==         suppressed: 0 bytes in 0 blocks.
==2709== Reachable blocks (those to which a pointer was found) are not shown.
==2709== To see them, rerun with: --show-reachable=yes

fenwick 1 331% cat example.c

/* gcc -o example example.c `pkg-config --cflags --libs gtk+-2.0 gthread-2.0` -lnjamd */

#include <gtk/gtk.h>

int main ( int argc , char ** argv , char ** envp )
 {
 GtkWidget *window;
 gtk_init(&argc,&argv);
 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_container_set_border_width(GTK_CONTAINER (window), 10);
 gtk_window_set_title (GTK_WINDOW (window), "njamd");
 gtk_widget_set_size_request (window, 700, 800);
 gtk_widget_show (window);
 gtk_main();
 sleep(10);
 return(0);
 }
fenwick 0 332%


Paul Davis wrote:

On Fri, 2005-09-30 at 12:55 -0400, Peter Van Wieren wrote:
Ben,

Thanks. My code cannot have a buffer overrun, for it was simply hello.c from the tutorial page. An even more simple version that will still segfault is as follows. Can it be that -lnjamd causes a segfault, as one could not have occured in the code below?

use valgrind. pray to the god of valgrind before hand, for it is
munificent in its care and loving for us software engineers, and is
always good to us.

--p




--
Peter Van Wieren, Project Engineer, AVL Powertrain Engineering, Inc. USA
734 414 9678 (voice)
734 414 9690 (fax)
email: peter vanwieren avlna com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]