From a59902a7c123512681bddc3fa90f271d4f089c35 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 21 Jan 2021 14:12:22 -0500 Subject: gdb: convert auto-load to new-style debug macros Function file_is_auto_load_safe was taking a format string and varargs just to output a debug print. This is probably because that function is used in linux-thread-db.c and main.c, but debug_auto_load is static in auto-load.c. I simplified that, making debug_auto_load visible outside of auto-load.c, and making the callers of file_is_auto_load_safe output the debug print themselves. This file uses _() for internationalization of the debug messages. This is not necessary, as these are mostly messages for GDB developers, and it's not used in other files anyway. So I removed them. The rest is pretty much standard. gdb/ChangeLog: * auto-load.h (debug_auto_load): Move here. (auto_load_debug_printf): New. * auto-load.c: Use auto_load_debug_printf. (debug_auto_load): Move to header. * linux-thread-db.c (try_thread_db_load): Use auto_load_debug_printf. * main.c (captured_main_1): Likewise. Change-Id: I468dc2a1d24b7dbf171f55181a11abbfafe70ba1 --- gdb/main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gdb/main.c') diff --git a/gdb/main.c b/gdb/main.c index 1e1fbf2..331e3a5 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1185,15 +1185,17 @@ captured_main_1 (struct captured_main_args *context) auto_load_local_gdbinit_pathname = gdb_realpath (local_gdbinit.c_str ()).release (); - if (!inhibit_gdbinit && auto_load_local_gdbinit - && file_is_auto_load_safe (local_gdbinit.c_str (), - _("auto-load: Loading .gdbinit " - "file \"%s\".\n"), - local_gdbinit.c_str ())) + if (!inhibit_gdbinit && auto_load_local_gdbinit) { - auto_load_local_gdbinit_loaded = 1; + auto_load_debug_printf ("Loading .gdbinit file \"%s\".", + local_gdbinit.c_str ()); - ret = catch_command_errors (source_script, local_gdbinit.c_str (), 0); + if (file_is_auto_load_safe (local_gdbinit.c_str ())) + { + auto_load_local_gdbinit_loaded = 1; + + ret = catch_command_errors (source_script, local_gdbinit.c_str (), 0); + } } } -- cgit v1.1