aboutsummaryrefslogtreecommitdiff
path: root/gdbserver
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 /gdbserver
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 'gdbserver')
-rw-r--r--gdbserver/win32-low.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 3842c80..9c0a885 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -324,8 +324,7 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
if (!IsWow64Process (proch, &wow64))
{
DWORD err = GetLastError ();
- error ("Check if WOW64 process failed (error %d): %s\n",
- (int) err, strwinerror (err));
+ throw_winerror_with_name ("Check if WOW64 process failed", err);
}
windows_process.wow64_process = wow64;
@@ -579,8 +578,9 @@ win32_process_target::create_inferior (const char *program,
if (!ret)
{
- error ("Error creating process \"%s %s\", (error %d): %s\n",
- program, args, (int) err, strwinerror (err));
+ std::string msg = string_printf (_("Error creating process \"%s %s\""),
+ program, args);
+ throw_winerror_with_name (msg.c_str (), err);
}
else
{
@@ -627,8 +627,7 @@ win32_process_target::attach (unsigned long pid)
}
err = GetLastError ();
- error ("Attach to process failed (error %d): %s\n",
- (int) err, strwinerror (err));
+ throw_winerror_with_name ("Attach to process failed", err);
}
/* See nat/windows-nat.h. */