在UBUNTU下运行程序
root@root-F81Se:$ flowcalc /trace/20010316.pcap.gz -e basic
直接出现
Opening trace file: Unable to guess format (/trace/20010316.pcap.gz)
flowcalc.c:279 main(): Reading file '/trace/20010316.pcap.gz' failed
已放弃 (核心已转储)
如何解决
1
way2exluren 2015-03-01 11:02:21 +08:00 via Android
……上代码…
把系统最好设置成英文…调试信息更好懂 |
2
moxiaotiao OP @way2exluren
root@root-F81Se:~/下载/flowcalc$ flowcalc /trace/20010316.pcap.gz -e basic %% flowcalc run at Sun Mar 1 10:43:47 2015 % modules: basic @relation '/trace/20010316.pcap.gz' %% flowcalc 0.1 % fc_id: flow id % fc_tstamp: timestamp of first packet in the flow % fc_duration: flow duration % fc_proto: transport protocol % fc_src_addr: IP address of connection initiator % fc_src_port: TP port number of connection initiator % fc_dst_addr: IP address of remote peer % fc_dst_port: TP port number of remote peer @attribute fc_id numeric @attribute fc_tstamp numeric @attribute fc_duration numeric @attribute fc_proto {TCP,UDP} @attribute fc_src_addr string @attribute fc_src_port numeric @attribute fc_dst_addr string @attribute fc_dst_port numeric %% basic_stats 0.1 % bs_min_size_up: minimum payload size in forward direction % bs_avg_size_up: average payload size in forward direction % bs_max_size_up: maximum payload size in forward direction % bs_std_size_up: standard deviation of payload size in forward direction % bs_min_size_down: minimum payload size in backward direction % bs_avg_size_down: average payload size in backward direction % bs_max_size_down: maximum payload size in backward direction % bs_std_size_down: standard deviation of payload size in backward direction % bs_min_iat_up: minimum inter-arrival time in forward direction % bs_avg_iat_up: average inter-arrival time in forward direction % bs_max_iat_up: maximum inter-arrival time in forward direction % bs_std_iat_up: standard deviation of inter-arrival time in forward direction % bs_min_iat_down: minimum inter-arrival time in backward direction % bs_avg_iat_down: average inter-arrival time in backward direction % bs_max_iat_down: maximum inter-arrival time in backward direction % bs_std_iat_down: standard deviation of inter-arrival time in backward direction @attribute bs_min_size_up numeric @attribute bs_avg_size_up numeric @attribute bs_max_size_up numeric @attribute bs_std_size_up numeric @attribute bs_min_size_down numeric @attribute bs_avg_size_down numeric @attribute bs_max_size_down numeric @attribute bs_std_size_down numeric @attribute bs_min_iat_up numeric @attribute bs_avg_iat_up numeric @attribute bs_max_iat_up numeric @attribute bs_std_iat_up numeric @attribute bs_min_iat_down numeric @attribute bs_avg_iat_down numeric @attribute bs_max_iat_down numeric @attribute bs_std_iat_down numeric @data Opening trace file: Unable to guess format (/trace/20010316.pcap.gz) flowcalc.c:279 main(): Reading file '/trace/20010316.pcap.gz' failed 已放弃 (核心已转储) |
3
halczy 2015-03-01 11:21:21 +08:00 via iPhone
可能是中文目录名的问题。移到一个纯英文的目录再试下。
|
4
way2exluren 2015-03-01 11:54:19 +08:00 via Android
我还以为是自己写代码报错…原来是程序运行…
提示信息是文件错误啊……格式问题… |
5
9hills 2015-03-01 11:56:44 +08:00
core dump ,用gdb 看core呗
|
6
moxiaotiao OP @way2exluren 是的,装了一个程序,读取的数据格式没问题,从官网下载的
|
7
moxiaotiao OP @9hills
GDB RESULT: warning: Can't read pathname for load map: 输入/输出错误. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". Core was generated by `flowcalc /home/maopengxin/trace/20010316.pcap.gz -e basic'. Program terminated with signal 6, Aborted. #0 0xb76fc424 in __kernel_vsyscall () gdb() |
8
9hills 2015-03-01 21:14:29 +08:00 via iPad
@moxiaotiao 用bt看断点,然后看看变量
|
9
moxiaotiao OP @9hills
(gdb) bt #0 0xb76fc424 in __kernel_vsyscall () #1 0xb75521df in raise () from /lib/i386-linux-gnu/libc.so.6 #2 0xb7555825 in abort () from /lib/i386-linux-gnu/libc.so.6 #3 0xb76d7260 in _die (file=0x8049d1e "flowcalc.c", line=279, fn=0x804a2e9 "main", msg=0x804a2cf "Reading file '%s' failed\n") at lib.c:126 #4 0x080497a0 in main () |
10
9hills 2015-03-01 22:19:21 +08:00
#3 0xb76d7260 in _die (file=0x8049d1e "flowcalc.c", line=279,
fn=0x804a2e9 "main", msg=0x804a2cf "Reading file '%s' failed\n") at lib.c:126 上面不是写了么,断点在 flowcalc.c的279行,先去看看行内是什么,然后print下相关变量debug |
11
moxiaotiao OP 你好,279行的代码就是下面这个
if (!lfc_run(fc->lfc, fc->file, fc->filter)) die("Reading file '%s' failed\n", fc->file); |
12
moxiaotiao OP @9hills
你好,279行的代码就是下面这个 if (!lfc_run(fc->lfc, fc->file, fc->filter)) die("Reading file '%s' failed\n", fc->file); 你意思是GDB下面Print? |
13
9hills 2015-03-02 01:09:47 +08:00 via iPad
@moxiaotiao 是的,你先学习下 gdb 的简单使用吧,很快的。然后结合代码 debug 即可
|
14
marguerite 2015-03-02 01:40:19 +08:00
最难的就是转储核心啦,你都有转储得核心就很简单了啊:
gdb core 你的转储文件 bt 没有调试符号就按提示装调试符号,xxx-debuginfo 什么的重跑上面步骤就可以了。 |