HiveBrain v1.2.0
Get Started
← Back to all entries
snippetcppCritical

How do I print the full value of a long string in gdb?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
gdbhowfullthelongprintvaluestring

Problem

I want to print the full length of a C-string in GDB. By default it's being abbreviated, how do I force GDB to print the whole string?

Solution

set print elements 0


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.

Code Snippets

set print elements 0

Context

Stack Overflow Q#233328, score: 651

Revisions (0)

No revisions yet.