1. clock 沒有變 >> uint64_t 不可用%d
2. thread幾次就印幾次 >> 每個thread印出來順序不同 >> print function 位置要移動!
3. segmentation fault
Make sure your system doesn't set the core dump file size to zero. You can set it to unlimited with:
ulimit -c unlimitedCareful though! that core dumps can become huge.
第929行 per_packet 內有錯誤的記憶體讀取或寫入
Program terminated with signal SIGSEGV, Segmentation fault.#0 0x00000000004044af in per_packet (trace=0x693c000, t=0x693d640, global=0x0, tls=0x7f106c002180, packet=0x7f106c001e60) at lp_stash_5t_trace_interval.cc:929929 src_ip_uint = ntohl(ip->ip_src.s_addr);
[Current thread is 1 (Thread 0x7f107e9e7700 (LWP 20987))]3.A.
原因是在讀到第一萬多個ip的時候會得到一個 ip == NULL 導致第929行要去拿ip struct裡面的source IP時有非法的指標存取造成。
原本erman程式碼裡面有做這個判斷,拿掉的原因是因為 void function / return 跟 static function / return 的問題
這邊判斷式用 ip != NULL
Compile and Run commands
sudo rm test *.txt coresudo gcc -g -o test * -Wall -ltrace -lm
sudo ./test ~/Desktop/equinix-sanjose.dirA.20120119-130000-mac.UTC.anon.pcap 5Git
git config --global user.email "glennshih@bitbucket.org"git config --global user.name "glennshih"git add .git commit -m ""git push -u origin mastergdb
gdb -q testset args ~/Desktop/equinix-sanjose.dirA.20120119-130000-mac.UTC.anon.pcapb 數字Setting core dump and Use gdb
ulimit -c unlimitedsudo gdb ./test core