shlogg · Early preview
Nullity @masongyli

Toggle Local Variables Display In GDB With ~/.gdbinit

toggle-local' command toggles display of local vars in gdb. Saves space & reduces pagination. Use "toggle-local" in gdb session to enable/disable.

Add the following to ~/.gdbinit

define toggle-local
  if $toggle_hook_enabled == 0
    set $toggle_hook_enabled = 1
    define hook-stop
      info local
      printf "---------------------\n"
    end
    printf "display-local enabled.\n"
  else
    set $toggle_hook_enabled = 0
    define hook-stop
    end
    printf "display-local disabled.\n"
  end
end
set $toggle_hook_enabled = 0

    
    

    
    




  
  
  Usage

When in gdb session, use "toggle-local" to toggle it.
Why not always turn it on? If there are too many local variables, gdb would use pagination to show all the infomation,...