aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2025-06-12 14:29:16 +0100
committerAndrew Burgess <aburgess@redhat.com>2025-06-19 10:31:14 +0100
commitd8e6b67b18d1864a7ca1bd0bb4fabe949fad2135 (patch)
tree6d81b06bf5ef8efdb95792611fedefd9d6ac5c11 /gdb/doc
parent86a5d1eb9b03ff391a551bf5594c0aa9898f9989 (diff)
downloadbinutils-d8e6b67b18d1864a7ca1bd0bb4fabe949fad2135.zip
binutils-d8e6b67b18d1864a7ca1bd0bb4fabe949fad2135.tar.gz
binutils-d8e6b67b18d1864a7ca1bd0bb4fabe949fad2135.tar.bz2
gdb/python: introduce gdb.warning() function
This commit adds a new gdb.warning() function. This function takes a string and then calls GDB's internal warning() function. This will display the string as a warning. Using gdb.warning() means that the message will get the new emoji prefix if the user has that feature turned on. Also, the message will be sent to gdb.STDERR without the user having to remember to print to the correct stream. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/gdb.texinfo1
-rw-r--r--gdb/doc/python.texi11
2 files changed, 12 insertions, 0 deletions
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6139bc3..4ef6406 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -28023,6 +28023,7 @@ then it will be used.
@item show style sources
Show the current state of source code styling.
+@anchor{warning-prefix}
@item set style warning-prefix
@itemx show style warning-prefix
@itemx set style error-prefix
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index f343d0b..6fa2285 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -509,6 +509,17 @@ Flushing @code{sys.stdout} or @code{sys.stderr} will automatically
call this function for the relevant stream.
@end defun
+@defun gdb.warning (text)
+Print a warning message to @value{GDBN}'s standard output stream. The
+warning message is the warning prefix (@pxref{warning-prefix}), the
+string @w{@samp{warning: }}, and then @var{text}, which must be a
+non-empty string.
+
+Due to the warning prefix, @var{text} should not begin with a capital
+letter (except for proper nouns), and @var{text} should end with a
+period.
+@end defun
+
@defun gdb.target_charset ()
Return the name of the current target character set (@pxref{Character
Sets}). This differs from @code{gdb.parameter('target-charset')} in