参考:http://blog.csdn.net/linzhaolover/article/details/9794285
用户态的好处是可以GDB,需要在编译时添加-g,且不进行编译优化
1、设置环境变量
- export RTE_SDK=`pwd`
- export RTE_TARGET=i686-default-linuxapp-gcc
- export EXTRA_CFLAGS="-O0 -g"
2、然后编译
make
make -C examples RTE_SDK=$(pwd) RTE_TARGET=build O=$(pwd)/build/examples
3、运行
root@ubuntu:/opt/code/dpdk-1.8.0# gdb examples/helloworld/build/helloworld
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 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".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from examples/helloworld/build/helloworld...(no debugging symbols found)...done.
(gdb) set args -c f -n 4
(gdb) r
Starting program: /opt/code/dpdk-1.8.0/examples/helloworld/build/helloworld -c f -n 4
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
EAL: Cannot read numa node link for lcore 0 - using physical package id instead
EAL: Detected lcore 0 as core 0 on socket 0
EAL: Cannot read numa node link for lcore 1 - using physical package id instead
EAL: Detected lcore 1 as core 1 on socket 0
EAL: Cannot read numa node link for lcore 2 - using physical package id instead
EAL: Detected lcore 2 as core 0 on socket 1
EAL: Cannot read numa node link for lcore 3 - using physical package id instead
EAL: Detected lcore 3 as core 1 on socket 1
EAL: Support maximum 128 logical core(s) by configuration.
EAL: Detected 4 lcore(s)
EAL: unsupported IOMMU type!
EAL: VFIO support could not be initialized
EAL: Setting up memory...
EAL: cannot open /proc/self/numa_maps, consider that all memory is in socket_id 0
EAL: Ask a virtual area of 0x200000 bytes
EAL: Virtual area found at 0xb7600000 (size = 0x200000)
EAL: Ask a virtual area of 0x2c00000 bytes
EAL: Virtual area found at 0xb4800000 (size = 0x2c00000)
EAL: Ask a virtual area of 0x3800000 bytes
EAL: Virtual area found at 0xb0e00000 (size = 0x3800000)
EAL: Ask a virtual area of 0x200000 bytes
EAL: Virtual area found at 0xb0a00000 (size = 0x200000)
EAL: Ask a virtual area of 0x400000 bytes
EAL: Virtual area found at 0xb0400000 (size = 0x400000)
EAL: Ask a virtual area of 0x200000 bytes
EAL: Virtual area found at 0xb0000000 (size = 0x200000)
EAL: Ask a virtual area of 0x200000 bytes
EAL: Virtual area found at 0xafc00000 (size = 0x200000)
EAL: Ask a virtual area of 0x600000 bytes
EAL: Virtual area found at 0xaf400000 (size = 0x600000)
EAL: Requesting 59 pages of size 2MB from socket 0
[New Thread 0xaf3ffb40 (LWP 20175)]
EAL: TSC frequency is ~2494365 KHz
EAL: Master core 0 is ready (tid=b7da3800)
PMD: ENICPMD trace: rte_enic_pmd_init
[New Thread 0xaebfeb40 (LWP 20176)]
EAL: Core 1 is ready (tid=aebfeb40)
[New Thread 0xae3fdb40 (LWP 20177)]
EAL: Core 2 is ready (tid=ae3fdb40)
[New Thread 0xadbfcb40 (LWP 20178)]
EAL: Core 3 is ready (tid=adbfcb40)
EAL: PCI device 0000:02:01.0 on NUMA socket -1
EAL: probe driver: 8086:100f rte_em_pmd
EAL: 0000:02:01.0 not managed by UIO driver, skipping
EAL: PCI device 0000:02:06.0 on NUMA socket -1
EAL: probe driver: 8086:100f rte_em_pmd
EAL: 0000:02:06.0 not managed by UIO driver, skipping
hello from core 0
hello from core 1
hello from core 3
hello from core 2
[Thread 0xadbfcb40 (LWP 20178) exited]
[Thread 0xae3fdb40 (LWP 20177) exited]
[Thread 0xaebfeb40 (LWP 20176) exited]
[Thread 0xb7da3800 (LWP 20164) exited]
[Inferior 1 (process 20164) exited normally]
(gdb) b rte_eal_init
Breakpoint 1 at 0x80b9b70
(gdb) set args -c f -n 4
(gdb) r
Starting program: /opt/code/dpdk-1.8.0/examples/helloworld/build/helloworld -c f -n 4
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x080b9b70 in rte_eal_init ()
(gdb) bt
#0 0x080b9b70 in rte_eal_init ()
#1 0x0805fd2c in main ()
(gdb)