gdb字符串展示不完整,字符串展示省略号解决办法

gdb 调试程序时,打印一个字符串变量展示不完整,后面以省略号的形式展示。

查找了一下gdb使用手册,找到了如下一段:

set print elements number-of-elements
set print elements unlimited
    Set a limit on how many elements of an array gdb will print. If gdb is printing
    a large array, it stops printing after it has printed the number of elements set
   by the set print elements command. This limit also applies to the display of
   strings. When gdb starts, this limit is set to 200. Setting number-of-elements
   to unlimited or zero means that the number of elements to print is unlimited.
show print elements
   Display the number of elements of a large array that gdb will print. If the
   number is 0, then the printing is unlimited.

设置打印字符的个数为不限制数量,设置为unlimited或者zero(已标红)。

(gdb) set print elements 0
(gdb) show print elements
Limit on string chars or arry elemtns to print is unlimited

此处set print elements 0,亲测可用。

但是set print elements unlimited,在某些版本中(eg:7.7.1)中可用,但是在某些版本中不可以用。

两种方式都要了解,能达到目的都一样。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值