Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.