Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable print pretty in gdb

Tags:

gdb

I'm aware that we can enable pretty printing in gdb set print pretty. But is there an unset? I sometimes would like to toggle it. I couldn't find any documentation of it not any answers in Stackoverflow.

like image 569
padfoot Avatar asked Dec 14 '22 18:12

padfoot


2 Answers

For newer versions of gdb ( currently using gdb 9.1 ) this did not work any longer. We have to use:

> disable pretty-printer

See gdb doc

like image 175
Klaus Avatar answered Dec 16 '22 07:12

Klaus


Use

set print pretty off

From documentation:

set print pretty on
Cause GDB to print structures in an indented format with one member per line, like this:

$1 = {  
  next = 0x0,  
  flags = {  
    sweet = 1,  
    sour = 1  
  },  
  meat = 0x54 "Pork"  
}  

set print pretty off
Cause GDB to print structures in a compact format, like this:

$1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \  
meat = 0x54 "Pork"}  

This is the default format.

like image 36
Lasse V. Karlsen Avatar answered Dec 16 '22 08:12

Lasse V. Karlsen