What is the code size increase on i386-pc? Did you test it? This is likely
to result in a big one

Regards
Vladimir 'phcoder' Serbinenko

Le sam. 12 avr. 2025, 01:03, Leo Sandoval via Grub-devel <grub-devel@gnu.org>
a écrit :

> Together with the line number, the debug trace with the function name
> provides a bit more context and could be useful when inspecting log.
>
> Signed-off-by: Leo Sandoval <lsand...@redhat.com>
> ---
>  grub-core/kern/misc.c | 4 ++--
>  include/grub/misc.h   | 5 +++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
> index 2b79223935..90c71d7cea 100644
> --- a/grub-core/kern/misc.c
> +++ b/grub-core/kern/misc.c
> @@ -231,14 +231,14 @@ grub_debug_enabled (const char * condition)
>  }
>
>  void
> -grub_real_dprintf (const char *file, const int line, const char
> *condition,
> +grub_real_dprintf (const char *file, const char *function, const int
> line, const char *condition,
>                    const char *fmt, ...)
>  {
>    va_list args;
>
>    if (grub_debug_enabled (condition))
>      {
> -      grub_printf ("%s:%d:%s: ", file, line, condition);
> +      grub_printf ("%s:%s:%d:%s: ", file, function, line, condition);
>        va_start (args, fmt);
>        grub_vprintf (fmt, args);
>        va_end (args);
> diff --git a/include/grub/misc.h b/include/grub/misc.h
> index e087e7b3e8..881af5ca98 100644
> --- a/include/grub/misc.h
> +++ b/include/grub/misc.h
> @@ -35,7 +35,7 @@
>  #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
>  #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
>
> -#define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE,
> __LINE__, condition, __VA_ARGS__)
> +#define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE,
> __FUNCTION__, __LINE__, condition, __VA_ARGS__)
>
>  void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t
> n);
>  char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
> @@ -410,9 +410,10 @@ grub_puts (const char *s)
>  int EXPORT_FUNC(grub_puts_) (const char *s);
>  int EXPORT_FUNC(grub_debug_enabled) (const char *condition);
>  void EXPORT_FUNC(grub_real_dprintf) (const char *file,
> +                                     const int function,
>                                       const int line,
>                                       const char *condition,
> -                                     const char *fmt, ...) __attribute__
> ((format (GNU_PRINTF, 4, 5)));
> +                                     const char *fmt, ...) __attribute__
> ((format (GNU_PRINTF, 5, 6)));
>  int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__
> ((format (GNU_PRINTF, 1, 2)));
>  int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__
> ((format (GNU_PRINTF, 1, 2)));
>  int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
> --
> 2.48.1
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to