diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-08-24 15:50:19 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-08-24 15:50:19 -0400 |
commit | c426fddb87d29034b50c2433e12a08aa23b7fb9f (patch) | |
tree | ad01131718b794781fa9bf10ee550e7e9acd181a /gdb/debug.h | |
parent | 1eb8556f5a8b5712e765b9615f7c18ffb50253b6 (diff) | |
download | gdb-c426fddb87d29034b50c2433e12a08aa23b7fb9f.zip gdb-c426fddb87d29034b50c2433e12a08aa23b7fb9f.tar.gz gdb-c426fddb87d29034b50c2433e12a08aa23b7fb9f.tar.bz2 |
gdb: add debug_prefixed_vprintf
To help ensure that all debug statements have the same format, introduce
the debug_prefixed_vprintf helper. Implement linux_nat_debug_printf_1
and infrun_debug_printf_1 with it.
I would eventually like to style the module and function name with some
color, to help them stick out, but I don't really know how to do that
yet, it can always be done later.
gdb/ChangeLog:
* debug.h: New file.
* debug.c (debug_prefixed_vprintf): New function.
* infrun.c (infrun_debug_printf_1): Use debug_prefixed_vprintf.
* linux-nat.c (linux_nat_debug_printf_1): Likewise.
Change-Id: Iccc290a2dc6b5fffcbe1c2866ed8d804ad380764
Diffstat (limited to 'gdb/debug.h')
-rw-r--r-- | gdb/debug.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/debug.h b/gdb/debug.h new file mode 100644 index 0000000..1d98fbe --- /dev/null +++ b/gdb/debug.h @@ -0,0 +1,32 @@ +/* Helpers to format and print debug statements + + Copyright (C) 2020 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef DEBUG_H +#define DEBUG_H + +/* Print a debug statement prefixed with the module and function name, and + with a newline at the end. */ + +void ATTRIBUTE_PRINTF (3, 0) +debug_prefixed_vprintf (const char *module, const char *func, const char *format, + va_list args); + +#endif /* DEBUG_H */ + + |