https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88037
--- Comment #3 from Christian Walther <walther at indel dot ch> --- > It's possible somebody really wants to print the whole of their huge string > (and has the memory to make it work). Fair point. I figured that someone wanting to read a legitimately huge string would rather use memory examination commands than pretty-printing. > Instead of 100 here we should use gdb.parameter("print elements") Ah, that’s what I was looking for – I gave up after finding that the relevant options->print_max was not passed on to Python, but it didn’t occur to me that it could be queried that way. However, I just discovered that from GDB 7.7 on (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=f380848e84613364a17008f04e91bfef09eaf158) (I was using 7.6), fetching lazy strings automatically observes the print_max, so it should no longer run out of memory. So the whole point may be moot. All that my solution adds in this case is the display of the actual length.