When condition is gdb, comment out the file/line/system information by prepending '#' and putting the command on its own line. This allows easy copy/pasting of gdb commands into gdb while preserving the information about where the print came from and how to disable it.
Signed-off-by: Robbie Harwood <rharw...@redhat.com> --- grub-core/kern/misc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c index 11b8592c8..7eea900ae 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -182,7 +182,12 @@ grub_real_dprintf (const char *file, const int line, const char *condition, if (grub_debug_enabled (condition)) { - grub_printf ("%s:%d:%s: ", file, line, condition); + /* gdb commands are on their own line to ease copy/pasting into gdb. */ + if (!grub_strcmp(condition, "gdb")) + grub_printf("#%s:%d:%s:\n", file, line, condition); + else + grub_printf ("%s:%d:%s: ", file, line, condition); + va_start (args, fmt); grub_vprintf (fmt, args); va_end (args); -- 2.33.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel