[gtkada] Seg Fault in "gate" (both GtkAda cvs and Stable)

Adrian Knoth adi at drcomp.erfurt.thur.de
Fri Oct 28 01:41:07 CEST 2005


On Sun, Oct 23, 2005 at 01:09:19PM +0200, Adrian Knoth wrote:

> Let's see if I can get access to Debian/amd64 in order to reproduce
> the problem (and find a solution).

Ok, for now I can confirm the segfault, gdb shows:

(gdb) frame 0
#0  0x00002aaaab19cfb2 in gtk_vseparator_new ()
   from /usr/lib/libgtk-x11-2.0.so.0

The last strace-lines are:

open("/tmp/gnat-i4Xnyl", O_RDWR|O_CREAT|O_EXCL, 0600) = 4
close(4)                                = 0
open("/tmp/gnat-i4Xnyl", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaadd5c000
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV (core dumped) +++



gtk_vseparator_new is:

GtkWidget*
gtk_vseparator_new (void)
{
  return g_object_new (GTK_TYPE_VSEPARATOR, NULL);
}


and GTK_TYPE_VSEPARATOR is:

#define GTK_TYPE_VSEPARATOR                  (gtk_vseparator_get_type ())

which is:

GType
gtk_vseparator_get_type (void)
{
  static GType vseparator_type = 0;

  if (!vseparator_type)
    {
      static const GTypeInfo vseparator_info =
      {
        sizeof (GtkVSeparatorClass),
        NULL,           /* base_init */
        NULL,           /* base_finalize */
        (GClassInitFunc) gtk_vseparator_class_init,
        NULL,           /* class_finalize */
        NULL,           /* class_init */
        sizeof (GtkVSeparator),
        0,              /* n_preallocs */
        (GInstanceInitFunc) gtk_vseparator_init,
      };

      vseparator_type =
        g_type_register_static (GTK_TYPE_SEPARATOR, "GtkVSeparator",
                                &vseparator_info, 0);
    }

  return vseparator_type;
}


With debugging symbols:

#0  0x00002aaaab19cfb2 in IA__gtk_vseparator_new
    () at gtkvseparator.c:85

which is:

(gdb) disassemble 0x00002aaaab19cfb2
Dump of assembler code for function IA__gtk_vseparator_new:
0x00002aaaab19cfb0 <IA__gtk_vseparator_new+0>:  sub    $0x8,%rsp
0x00002aaaab19cfb4 <IA__gtk_vseparator_new+4>:  callq  0x2aaaab19cf40 <IA__gtk_vseparator_get_type>
0x00002aaaab19cfb9 <IA__gtk_vseparator_new+9>:  xor    %esi,%esi
0x00002aaaab19cfbb <IA__gtk_vseparator_new+11>: mov    %rax,%rdi
0x00002aaaab19cfbe <IA__gtk_vseparator_new+14>: add    $0x8,%rsp
0x00002aaaab19cfc2 <IA__gtk_vseparator_new+18>: xor    %eax,%eax
0x00002aaaab19cfc4 <IA__gtk_vseparator_new+20>: jmpq   0x2aaaaaffa848 <_init+6136>
End of assembler dump.

It seems that the crash happens before calling gtk_vseparator_get_type,
but I don't see why subtracting 8 from the rsp (the 64bit equivalent
of esp, the stack pointer) should raise sigsegv.

On the other hand, calling gtk_vseparator_new() from C seems to work.

Unfortunately I can only test with gnat-4.0. Are there others
who can try it against gcc-3.4 or gcc-3.3?

Is this a C-, Ada- or Compiler-error? ;)

-- 
mail: adi at thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

In A World Without Fences Who Needs Gates?



More information about the gtkada mailing list