From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Remove dead code from windows_nat_target::detach
Date: Fri, 22 Jul 2022 12:56:41 -0600 [thread overview]
Message-ID: <20220722185641.4053809-1-tromey@adacore.com> (raw)
windows_nat_target::detach has a variable 'detached' that is only set
after a call to 'error'. However, this can't happen because 'error'
throws an exception.
This patch removes the dead code.
---
gdb/windows-nat.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 43a2c112db5..9265ed9e632 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1912,22 +1912,16 @@ windows_nat_target::attach (const char *args, int from_tty)
void
windows_nat_target::detach (inferior *inf, int from_tty)
{
- int detached = 1;
-
ptid_t ptid = minus_one_ptid;
resume (ptid, 0, GDB_SIGNAL_0);
if (!DebugActiveProcessStop (windows_process.current_event.dwProcessId))
- {
- error (_("Can't detach process %u (error %u)"),
- (unsigned) windows_process.current_event.dwProcessId,
- (unsigned) GetLastError ());
- detached = 0;
- }
+ error (_("Can't detach process %u (error %u)"),
+ (unsigned) windows_process.current_event.dwProcessId,
+ (unsigned) GetLastError ());
DebugSetProcessKillOnExit (FALSE);
- if (detached)
- target_announce_detach (from_tty);
+ target_announce_detach (from_tty);
x86_cleanup_dregs ();
switch_to_no_thread ();
--
2.34.1
next reply other threads:[~2022-07-22 18:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 18:56 Tom Tromey [this message]
2022-07-22 19:27 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220722185641.4053809-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).