how to override truncation in gdb

1

When I print in gdb by running:

p cmd.c_str() 

the result is truncated to 200 characters. is there a way that I can set the default truncation to something higher like 1000 characters?

Ocasta Eshu

Posted 2012-07-09T01:51:39.347

Reputation: 778

Answers

3

From the GDB manual:

set print elements number-of-elements

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 zero means that the printing is unlimited.

set print elements 2000

Will show the first 2000 members of arrays, cstrings. As the docs say, setting this to zero will allow unlimited display.

lornix

Posted 2012-07-09T01:51:39.347

Reputation: 9 633