aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-09-01 11:01:33 -0600
committerTom Tromey <tromey@adacore.com>2023-11-27 12:55:14 -0700
commit602971b3863dcecf2daa5ffc0853a75a3131446c (patch)
treee6965aecdcad64bf33e19a5927618a06be17d2a1 /gdbsupport
parent4dda9cc4b03788d1cf0416b39a3ab3780caf27fd (diff)
downloadgdb-602971b3863dcecf2daa5ffc0853a75a3131446c.zip
gdb-602971b3863dcecf2daa5ffc0853a75a3131446c.tar.gz
gdb-602971b3863dcecf2daa5ffc0853a75a3131446c.tar.bz2
Introduce throw_winerror_with_name
This introduces throw_winerror_with_name, a Windows analog of perror_with_name, and changes various places in gdb to call it. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30770
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/errors.cc8
-rw-r--r--gdbsupport/errors.h7
2 files changed, 15 insertions, 0 deletions
diff --git a/gdbsupport/errors.cc b/gdbsupport/errors.cc
index b48ce10..59f934c 100644
--- a/gdbsupport/errors.cc
+++ b/gdbsupport/errors.cc
@@ -144,4 +144,12 @@ strwinerror (ULONGEST error)
return buf;
}
+/* See errors.h. */
+
+void
+throw_winerror_with_name (const char *string, ULONGEST err)
+{
+ error (_("%s (error %d): %s"), string, err, strwinerror (err));
+}
+
#endif /* USE_WIN32API */
diff --git a/gdbsupport/errors.h b/gdbsupport/errors.h
index 20f9152..a94debf 100644
--- a/gdbsupport/errors.h
+++ b/gdbsupport/errors.h
@@ -120,6 +120,13 @@ extern void flush_streams ();
extern const char *strwinerror (ULONGEST error);
+/* Like perror_with_name, but for Windows errors. Throw an exception
+ including STRING and the system text for the given error
+ number. */
+
+extern void throw_winerror_with_name (const char *string, ULONGEST err)
+ ATTRIBUTE_NORETURN;
+
#endif /* USE_WIN32API */
#endif /* COMMON_ERRORS_H */