I have some strange problem which i started facing from yesterday.

i have used GDB many times on my system , but yesterday when i started running GDB , my dubugger is enterings the library functions code part also which is very irritating for me.
I mean if the program is having any printf or malloc calls,gdb is entering the files which have these definitions , i guess.

below is the sample code which has malloc calls.

can any body know how to solve this problem.

I am running in Ubuntu Machine.

skylab@skylab:~/CP$ gcc test.c  -g
skylab@skylab:~/CP$ gdb a.out 
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/skylab/CP/a.out...done.
(gdb) b main
Breakpoint 1 at 0x804841d: file test.c, line 12.
(gdb) r
Starting program: /home/skylab/CP/a.out 

Breakpoint 1, main () at test.c:12
12      t = malloc(4);
(gdb) s
__GI___libc_malloc (bytes=4) at malloc.c:3615
3615    malloc.c: No such file or directory.
    in malloc.c
(gdb) s
3620    in malloc.c
(gdb) s
3621    in malloc.c
(gdb) s
3622    in malloc.c
(gdb) s
malloc_hook_ini (sz=4, caller=0x8048429) at hooks.c:35
35  hooks.c: No such file or directory.
    in hooks.c
(gdb) s
36  in hooks.c
(gdb) s
37  in hooks.c
(gdb) s
ptmalloc_init () at arena.c:467
467 arena.c: No such file or directory.
    in arena.c
(gdb) s
475 in arena.c
(gdb) s
466 in arena.c
(gdb) s
ptmalloc_init () at arena.c:476
476 in arena.c
(gdb) s
511 in arena.c
(gdb) s
485 in arena.c
(gdb) s
ptmalloc_init_minimal () at arena.c:410
410 in arena.c
(gdb) s
412 in arena.c
(gdb) s
413 in arena.c
(gdb) s
414 in arena.c
(gdb) s
415 in arena.c
(gdb) s
__GI___getpagesize () at ../sysdeps/unix/sysv/linux/getpagesize.c:30
30  ../sysdeps/unix/sysv/linux/getpagesize.c: No such file or directory.
    in ../sysdeps/unix/sysv/linux/getpagesize.c
(gdb) s
35  in ../sysdeps/unix/sysv/linux/getpagesize.c
(gdb) 
36  in ../sysdeps/unix/sysv/linux/getpagesize.c
(gdb) s
__GI___getpagesize () at ../sysdeps/unix/sysv/linux/getpagesize.c:51
51  in ../sysdeps/unix/sysv/linux/getpagesize.c
(gdb) s
ptmalloc_init () at arena.c:519
519 arena.c: No such file or directory.
    in arena.c
(gdb) s
510 in arena.c
(gdb) s
511 in arena.c
(gdb) s
519 in arena.c
(gdb) s
485 in arena.c
(gdb) s
ptmalloc_init_minimal () at arena.c:415
415 in arena.c
(gdb) s
ptmalloc_init () at arena.c:519
519 in arena.c
(gdb) s
520 in arena.c
(gdb) s
__GI__dl_addr (address=0xb7ebdd00, info=0xbffff27c, mapp=0xbffff28c, 
    symbolp=0x0) at dl-addr.c:127
127 dl-addr.c: No such file or directory.
    in dl-addr.c
(gdb) s
129 in dl-addr.c

(gdb)

Is this a Linux system? If so, did you install the debug kernel and such? What about your current installation of the Gnu Compiler Collection (GCC) - did you install a debuggable version of that? What seems to be happening here is that glibc is a debuggable version, but you don't have the source handy, so it will happily single step through malloc et al and give you these errors.

few days back i have installed glib2 and glib2-devel for my gstreamer application devolopment.but i am not sure that is the cause.

before that also i have some other version of glib,i have tried to uninstall the packages.

skylab@skylab:~/CP$ sudo apt-get remove glib2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package glib2
skylab@skylab:~/CP$ sudo apt-get remove glib2-devel
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package glib2-devel
skylab@skylab:~/CP$ 

It seems it could not remove those, some one please help how will i make the debugger to normal state.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.