From c028bf0c7b97584bd4d104375b3f12aa55c240f9 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 11 Nov 2024 22:04:12 -0500 Subject: [PATCH] .gdbinit: Have rp() work without a target [ci skip] Useful for core dumps. It used to not work because: (gdb) p !"" evaluation of this expression requires the target program to be active (gdb) p 0 == "" evaluation of this expression requires the target program to be active --- .gdbinit | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.gdbinit b/.gdbinit index 911624d8c9..1c38ffe09c 100644 --- a/.gdbinit +++ b/.gdbinit @@ -1,21 +1,7 @@ -define hook-run - set $color_type = 0 - set $color_highlite = 0 - set $color_end = 0 -end - define ruby_gdb_init - if !$color_type - set $color_type = "\033[31m" - end - if !$color_highlite - set $color_highlite = "\033[36m" - end - if !$color_end - set $color_end = "\033[m" - end - if ruby_dummy_gdb_enums.special_consts - end + init-if-undefined $color_type = "\033[31m" + init-if-undefined $color_highlite = "\033[36m" + init-if-undefined $color_end = "\033[m" end # set prompt \033[36m(gdb)\033[m\040