This content originally appeared on DEV Community and was authored by nullity
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.
This content originally appeared on DEV Community and was authored by nullity
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.

APA
MLA
nullity | Sciencx (2024-11-12T18:25:03+00:00) gdb trick: automatically display local variables when stops. Retrieved from https://www.scien.cx/2024/11/12/gdb-trick-automatically-display-local-variables-when-stops/
" » gdb trick: automatically display local variables when stops." nullity | Sciencx - Tuesday November 12, 2024, https://www.scien.cx/2024/11/12/gdb-trick-automatically-display-local-variables-when-stops/
HARVARDnullity | Sciencx Tuesday November 12, 2024 » gdb trick: automatically display local variables when stops., viewed ,<https://www.scien.cx/2024/11/12/gdb-trick-automatically-display-local-variables-when-stops/>
VANCOUVERnullity | Sciencx - » gdb trick: automatically display local variables when stops. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/11/12/gdb-trick-automatically-display-local-variables-when-stops/
CHICAGO" » gdb trick: automatically display local variables when stops." nullity | Sciencx - Accessed . https://www.scien.cx/2024/11/12/gdb-trick-automatically-display-local-variables-when-stops/
IEEE" » gdb trick: automatically display local variables when stops." nullity | Sciencx [Online]. Available: https://www.scien.cx/2024/11/12/gdb-trick-automatically-display-local-variables-when-stops/. [Accessed: ]
rf:citation » gdb trick: automatically display local variables when stops | nullity | Sciencx | https://www.scien.cx/2024/11/12/gdb-trick-automatically-display-local-variables-when-stops/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.