bug-glibc
[Top][All Lists]
Advanced

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

Problems with glibc


From: Miola, Marcelo de Brito
Subject: Problems with glibc
Date: Mon, 14 May 2001 11:44:07 -0300 (BRT)

        Hi,

                I'm developing a simulator for real-time systems at
University of Sao Paulo State (Brazil) and I'm having serious problems
with glibc. When I start my simulator, it crashes always in the same place
and it gives me the following error:

                Segmentation fault (core dumped)

                Actually, I'm using the glibc v. 2.1.3-22 and this error
occurs in the following code:

                void *wmalloc(int size){
                   void *new=NULL;
                   printf("\nRequired memory: %d.\n",size);
                   if(size<=0)
                      wmemerr(2); //wmemerr is a routine to print error
                                  //messages caused by memory leaks
                   /* the program crashes in the following line */
                   new=(void *)malloc(size);
                   if(new==NULL)
                      wmemerr(3);
                   return ((void *)new);
                }  

                I'd tried to use gdb to locate the real problem but it
appears to be the function wmalloc at all. The result captured from gdb
is:

                Program received signal SIGSEGV, Segmentation fault.
                0x401c5ebe in chunk_alloc (ar_ptr=0x4025ad40, nb=40) at 
malloc.c:2886
                2886    malloc.c: No such file or directory.
                (gdb) bt
                #0  0x401c5ebe in chunk_alloc (ar_ptr=0x4025ad40, nb=40) at 
malloc.c:2886
                #1  0x401c55ae in __libc_malloc (bytes=32) at malloc.c:2696
                #2  0x401c6310 in __libc_realloc (oldmem=0x0, bytes=32) at 
malloc.c:3209
                #3  0x8057f1b in wmalloc ()
                #4  0x804b1c3 in ins_exe ()
                #5  0x804aaea in escal_per ()
                #6  0x804a666 in defergr ()
                #7  0x8049e71 in defer_servgra ()
                #8  0x40053973 in fl_object_qread () from 
/usr/X11R6/lib/libforms.so.0.88
                #9  0x40060f41 in fl_do_forms () from 
/usr/X11R6/lib/libforms.so.0.88
                #10 0x8049dfa in mono ()
                #11 0x804970f in def ()
                #12 0x80494bb in main ()
                #13 0x401849cb in __libc_start_main (main=0x8049490 <main>, 
argc=1,
                argv=0xbffffc54, init=0x8048f80 <_init>,
                fini=0x805816c <_fini>, rtld_fini=0x4000aea0 <_dl_fini>, 
stack_end=0xbffffc4c)
                at ../sysdeps/generic/libc-start.c:92
                (gdb)   
                

                At first glance, my source code doesn't have any visible
problems and this bug is making me loose some nights of sleeping. So,
what's going on? Am I doing something wrong?


                                Thanks in advance,

-- 
##########################################################
##              Marcelo de Brito Miola                  ##
##                                                      ##
##  Instituto de Biociencias, Letras e Ciencias Exatas  ##
##      UNESP - Sao Jose do Rio Preto - SP - Brazil     ##
##                                                      ##
##      email:  address@hidden          ##
##              address@hidden                  ##
##########################################################





reply via email to

[Prev in Thread] Current Thread [Next in Thread]