A general question regarding memory errors in g++
Hi,
I have a general question regarding memory errors.
I frequently ran into memory errors such as seg fault, double free, etc.
Sometimes I got the following traces for example.
*** glibc detected *** /mnt/click: free(): invalid pointer: 0xb7ed8450 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7dff905]
/lib/libc.so.6[0xb7e011a3]
/lib/libc.so.6(cfree+0x6d)[0xb7e0422d]
/mnt/click(_Z13ofpbuf_deleteP6ofpbuf+0x16)[0x8157686]
/mnt/click[0x815f750]
/mnt/click[0x81616f4]
/mnt/click[0x815940d]
/mnt/click(_Z10rconn_sendP5rconnP6ofpbufPi+0xc9)[0x8159529]
/mnt/click(_Z21rconn_send_with_limitP5rconnP6ofpbufPii+0x6b)[0x815959b]
/mnt/click[0x81491ed]
/mnt/click(_ZN8Datapath20send_openflow_bufferEP6ofpbufPK12rconn_sender+0x42)[0x814b582]
/mnt/click(_ZN8Datapath22dp_send_features_replyEPK12rconn_sender+0x1a2)[0x814e432]
/mnt/click(_ZN8Datapath17fwd_control_inputEP6Packet+0x264)[0x814e6c4]
/mnt/click(_ZN8Datapath4pushEiP6Packet+0x2ff)[0x814ea1f]
/mnt/click(_ZN5RConn29send_control_packets_to_clickEv+0x91)[0x8149021]
/mnt/click(_ZN5RConn9run_timerEP5Timer+0x3d)[0x8149a6d]
/mnt/click(_ZN8TimerSet10run_timersEP12RouterThreadP6Master+0x1dd)[0x825577d]
/mnt/click(_ZN12RouterThread6driverEv+0x29a)[0x8248a3a]
/mnt/click(main+0x86e/lib/libc.so.6(__libc_start_main+0xe5)[0xb7daab55]
/mnt/click[0x80c0481]
======= Memory map: ========
08048000-08318000 r-xp 00000000 00:12 655498 /mnt/click
08318000-08319000 r-xp 002cf000 00:12 655498 /mnt/click
08319000-0831a000 rwxp 002d0000 00:12 655498 /mnt/click
0831a000-08340000 rwxp 0831a000 00:00 0 [heap]
b7300000-b7321000 rwxp b7300000 00:00 0
b7321000-b7400000 ---p b7321000 00:00 0
b74d6000-b7558000 rwxp b74d6000 00:00 0
b7558000-b7559000 ---p b7558000 00:00 0
b7559000-b7d7c000 rwxp b7559000 00:00 0
b7d7c000-b7d90000 r-xp 00000000 08:01 96673 /lib/libpthread-2.10.2.so
b7d90000-b7d91000 r-xp 00013000 08:01 96673 /lib/libpthread-2.10.2.so
b7d91000-b7d92000 rwxp 00014000 08:01 96673 /lib/libpthread-2.10.2.so
b7d92000-b7d94000 rwxp b7d92000 00:00 0
b7d94000-b7ed5000 r-xp 00000000 08:01 96525 /lib/libc-2.10.2.so
b7ed5000-b7ed7000 r-xp 00141000 08:01 96525 /lib/libc-2.10.2.so
b7ed7000-b7ed8000 rwxp 00143000 08:01 96525 /lib/libc-2.10.2.so
b7ed8000-b7edb000 rwxp b7ed8000 00:00 0
b7edb000-b7ee7000 r-xp 00000000 08:01 96356 /lib/libgcc_s.so.1
b7ee7000-b7ee8000 rwxp 0000b000 08:01 96356 /lib/libgcc_s.so.1
b7ee8000-b7f0c000 r-xp 00000000 08:01 96521 /lib/libm-2.10.2.so
b7f0c000-b7f0d000 r-xp 00023000 08:01 96521 /lib/libm-2.10.2.so
b7f0d000-b7f0e000 rwxp 00024000 08:01 96521 /lib/libm-2.10.2.so
b7f0e000-b7ff4000 r-xp 00000000 08:01 35291 /usr/local/harpoon/plugins/libstdc++.so.6.0.13
b7ff4000-b7ff8000 r-xp 000e6000 08:01 35291 /usr/local/harpoon/plugins/libstdc++.so.6.0.13
b7ff8000-b7ff9000 rwxp 000ea000 08:01 35291 /usr/local/harpoon/plugins/libstdc++.so.6.0.13
b7ff9000-b8000000 rwxp b7ff9000 00:00 0
b8000000-b8007000 r-xp 00000000 08:01 96349 /lib/librt-2.10.2.so
b8007000-b8008000 r-xp 00006000 08:01 96349 /lib/librt-2.10.2.so
b8008000-b8009000 rwxp 00007000 08:01 96349 /lib/librt-2.10.2.so
b8009000-b800a000 rwxp b8009000 00:00 0
b800a000-b800c000 r-xp 00000000 08:01 96675 /lib/libdl-2.10.2.so
b800c000-b800d000 r-xp 00001000 08:01 96675 /lib/libdl-2.10.2.so
b800d000-b800e000 rwxp 00002000 08:01 96675 /lib/libdl-2.10.2.so
b800e000-b8036000 r-xp 00000000 08:01 35154 /usr/lib/libpcap.so.0.9.8
b8036000-b8038000 rwxp 00027000 08:01 35154 /usr/lib/libpcap.so.0.9.8
b803a000-b803d000 rwxp b803a000 00:00 0
b803d000-b8059000 r-xp 00000000 08:01 96522 /lib/ld-2.10.2.so
b8059000-b805a000 r-xp 0001b000 08:01 96522 /lib/ld-2.10.2.so
b805a000-b805b000 rwxp 0001c000 08:01 96522 /lib/ld-2.10.2.so
bfb45000-bfb5a000 rw-p bffeb000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
Then, I just run gdb, valgrind things and suddenly I started ask questions myself that what are those traces and how can I analyze?
do you guys know how to analyze or any tutorials?
wishes,
Jae-Yong
|