Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .