mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 00:32:30 +08:00
gdbserver: Ensure all debug output uses debug functions
All debug output needs to go via debug functions to ensure it writes to the correct output stream. gdb/ChangeLog: * nat/linux-waitpid.c (linux_debug): Call debug_vprintf. gdb/gdbserver/ChangeLog: * ax.c (ax_vdebug): Call debug_printf. * debug.c (debug_write): New function. * debug.h (debug_write): New declaration. * linux-low.c (sigchld_handler): Call debug_write.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
2019-04-17 Alan Hayward <alan.hayward@arm.com>
|
||||||
|
|
||||||
|
* nat/linux-waitpid.c (linux_debug): Call debug_vprintf.
|
||||||
|
|
||||||
2019-04-17 Jim Wilson <jimw@sifive.com>
|
2019-04-17 Jim Wilson <jimw@sifive.com>
|
||||||
Andrew Burgess <andrew.burgess@embecosm.com>
|
Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2019-04-17 Alan Hayward <alan.hayward@arm.com>
|
||||||
|
|
||||||
|
* ax.c (ax_vdebug): Call debug_printf.
|
||||||
|
* debug.c (debug_write): New function.
|
||||||
|
* debug.h (debug_write): New declaration.
|
||||||
|
* linux-low.c (sigchld_handler): Call debug_write.
|
||||||
|
|
||||||
2019-04-17 Alan Hayward <alan.hayward@arm.com>
|
2019-04-17 Alan Hayward <alan.hayward@arm.com>
|
||||||
|
|
||||||
* debug.c (debug_set_output): New function.
|
* debug.c (debug_set_output): New function.
|
||||||
|
@ -36,7 +36,11 @@ ax_vdebug (const char *fmt, ...)
|
|||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
vsprintf (buf, fmt, ap);
|
vsprintf (buf, fmt, ap);
|
||||||
|
#ifdef IN_PROCESS_AGENT
|
||||||
fprintf (stderr, PROG "/ax: %s\n", buf);
|
fprintf (stderr, PROG "/ax: %s\n", buf);
|
||||||
|
#else
|
||||||
|
debug_printf (PROG "/ax: %s\n", buf);
|
||||||
|
#endif
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,3 +130,12 @@ do_debug_exit (const char *function_name)
|
|||||||
if (function_name != NULL)
|
if (function_name != NULL)
|
||||||
debug_printf ("<<<< exiting %s\n", function_name);
|
debug_printf ("<<<< exiting %s\n", function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See debug.h. */
|
||||||
|
|
||||||
|
size_t
|
||||||
|
debug_write (const void *buf, size_t nbyte)
|
||||||
|
{
|
||||||
|
int fd = fileno (debug_file);
|
||||||
|
return write (fd, buf, nbyte);
|
||||||
|
}
|
||||||
|
@ -35,6 +35,9 @@ void debug_flush (void);
|
|||||||
void do_debug_enter (const char *function_name);
|
void do_debug_enter (const char *function_name);
|
||||||
void do_debug_exit (const char *function_name);
|
void do_debug_exit (const char *function_name);
|
||||||
|
|
||||||
|
/* Async signal safe debug output function that calls write directly. */
|
||||||
|
size_t debug_write (const void *buf, size_t nbyte);
|
||||||
|
|
||||||
/* These macros are for use in major functions that produce a lot of
|
/* These macros are for use in major functions that produce a lot of
|
||||||
debugging output. They help identify in the mass of debugging output
|
debugging output. They help identify in the mass of debugging output
|
||||||
when these functions enter and exit. debug_enter is intended to be
|
when these functions enter and exit. debug_enter is intended to be
|
||||||
|
@ -6185,10 +6185,9 @@ sigchld_handler (int signo)
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* fprintf is not async-signal-safe, so call write
|
/* Use the async signal safe debug function. */
|
||||||
directly. */
|
if (debug_write ("sigchld_handler\n",
|
||||||
if (write (2, "sigchld_handler\n",
|
sizeof ("sigchld_handler\n") - 1) < 0)
|
||||||
sizeof ("sigchld_handler\n") - 1) < 0)
|
|
||||||
break; /* just ignore */
|
break; /* just ignore */
|
||||||
} while (0);
|
} while (0);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ linux_debug (const char *format, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
vfprintf (stderr, format, args);
|
debug_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user