From patchwork Mon Nov 2 19:36:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 9506 Received: (qmail 21214 invoked by alias); 2 Nov 2015 19:36:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 21125 invoked by uid 89); 2 Nov 2015 19:36:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 02 Nov 2015 19:36:24 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id EA5C78F271 for ; Mon, 2 Nov 2015 19:36:22 +0000 (UTC) Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA2JaAQ4009459 for ; Mon, 2 Nov 2015 14:36:22 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 11/11] [C++/mingw] gdbserver: gdb/host signal mixup Date: Mon, 2 Nov 2015 19:36:10 +0000 Message-Id: <1446492970-21432-12-git-send-email-palves@redhat.com> In-Reply-To: <1446492970-21432-1-git-send-email-palves@redhat.com> References: <1446492970-21432-1-git-send-email-palves@redhat.com> Building in C++ caught a buglet here: ../../../src/gdb/gdbserver/win32-low.c: In function 'void win32_resume(thread_resume*, size_t)': ../../../src/gdb/gdbserver/win32-low.c:929:11: error: invalid conversion from 'int' to 'gdb_signal' [-fpermissive] sig = resume_info[0].sig; ^ ../../../src/gdb/gdbserver/win32-low.c:934:11: error: invalid conversion from 'int' to 'gdb_signal' [-fpermissive] sig = 0; ^ Signals in the "struct thread_resume" structure are host signals, not gdb signals. The current code happens to work because the only signals that the Windows port supports have the same number as the gdb equivalent (see handle_exception for the win32 exception -> gdb signal mapping). gdb/gdbserver/ChangeLog: 2015-11-01 Pedro Alves * win32-low.c (win32_resume): Use gdb_signal_from_host, GDB_SIGNAL_0 and gdb_signal_to_string. --- gdb/gdbserver/win32-low.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c index b1a2e56..b1de139 100644 --- a/gdb/gdbserver/win32-low.c +++ b/gdb/gdbserver/win32-low.c @@ -926,12 +926,12 @@ win32_resume (struct thread_resume *resume_info, size_t n) if (!ptid_equal (resume_info[0].thread, minus_one_ptid)) { - sig = resume_info[0].sig; + sig = gdb_signal_from_host (resume_info[0].sig); step = resume_info[0].kind == resume_step; } else { - sig = 0; + sig = GDB_SIGNAL_0; step = 0; } @@ -939,12 +939,14 @@ win32_resume (struct thread_resume *resume_info, size_t n) { if (current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) { - OUTMSG (("Cannot continue with signal %d here.\n", sig)); + OUTMSG (("Cannot continue with signal %s here.\n", + gdb_signal_to_string (sig))); } else if (sig == last_sig) continue_status = DBG_EXCEPTION_NOT_HANDLED; else - OUTMSG (("Can only continue with recieved signal %d.\n", last_sig)); + OUTMSG (("Can only continue with received signal %s.\n", + gdb_signal_to_string (last_sig))); } last_sig = GDB_SIGNAL_0;