gdb打印字符数组可以使用以下命令
p *ppstr@size
其中ppstr为字符数组的名字,size为要打印字符数组的元素个数。
p *ppstr@10
表示打印字符数组ppstr中的前10个字符串元素。
-
Breakpoint 3, _dl_init (main_map=0x7ffff7ffe208, argc=9, argv=0x7fffffffe4c8,
-
env=0x7fffffffe518) at dl-init.c:97
-
97 call_init (GL(dl_initfirst), argc, argv, env);
-
(gdb) l
-
92 ElfW(Dyn) *preinit_array_size = main_map->l_info[DT_PREINIT_ARRAYSZ];
-
93 unsigned int i;
-
94
-
95 if (__builtin_expect (GL(dl_initfirst) != NULL, 0))
-
96 {
-
97 call_init (GL(dl_initfirst), argc, argv, env);
-
98 GL(dl_initfirst) = NULL;
-
99 }
-
100
-
101 /* Don't do anything if there is no preinit array. */
-
(gdb) p *argv@10
-
$13 = {
-
0x7fffffffe740 "/home/sft/dpdk/examples/multi_process/l2fwd_fork/build/l2fwd_fork",
-
0x7fffffffe788 "-l", 0x7fffffffe78b "2-4", 0x7fffffffe78f "-n", 0x7fffffffe792 "4",
-
0x7fffffffe794 "--", 0x7fffffffe797 "-p", 0x7fffffffe79a "3", 0x7fffffffe79c "-f", 0x0}
-
(gdb) p *env@10
-
$14 = {0x7fffffffe79f "XDG_SESSION_ID=9442", 0x7fffffffe7b3 "HOSTNAME=238",
-
0x7fffffffe7c6 "SHELL=/bin/bash", 0x7fffffffe7d6 "TERM=xterm",
-
0x7fffffffe7e1 "HISTSIZE=1000", 0x7fffffffe7ef "SSH_CLIENT=100.7.16.232 53558 22",
-
0x7fffffffe810 "SSH_TTY=/dev/pts/8", 0x7fffffffe823 "USER=root",
-
0x7fffffffe82d "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01"..., 0x7fffffffedc9 "PQOS_INSTALL_PATH=/usr/lib/"}
-
(gdb) s
-
call_init (env=0x7fffffffe518, argv=0x7fffffffe4c8, argc=9, l=0x7ffff7fd6000)
-
at dl-init.c:34
-
34 if (l->l_init_called)
-
(gdb)
阅读(4981) | 评论(0) | 转发(0) |