Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 08/11] [C++/mingw] Simplify first chance exception handling
Date: Mon, 02 Nov 2015 19:45:00 -0000	[thread overview]
Message-ID: <1446492970-21432-9-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1446492970-21432-1-git-send-email-palves@redhat.com>

I can't figure out why we treat first chance exceptions any different
here.

We set last_sig to 1, and then call windows_resume passing signal==1,
so the DBG_EXCEPTION_NOT_HANDLED code path in win32_resume is taken:

~~~
  if (sig != GDB_SIGNAL_0)
    {
      if (current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT)
	{
	  OUTMSG (("Cannot continue with signal %d here.\n", sig));
	}
      else if (sig == last_sig)
	continue_status = DBG_EXCEPTION_NOT_HANDLED;
      else
	OUTMSG (("Can only continue with recieved signal %d.\n", last_sig));
    }
~~~

Fix this by removing this special casing.  gdbserver also goes
straight to continuing with DBG_EXCEPTION_NOT_HANDLED, AFAICS.

gdb/ChangeLog:
2015-11-01  Pedro Alves  <palves@redhat.com>

	* windows-nat.c (handle_exception): Return 0 for first chance
	exceptions.
	(get_windows_debug_event): Adjust.
---
 gdb/windows-nat.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 2e12493..cfbd74a 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1124,7 +1124,7 @@ handle_exception (struct target_waitstatus *ourstatus)
     default:
       /* Treat unhandled first chance exceptions specially.  */
       if (current_event.u.Exception.dwFirstChance)
-	return -1;
+	return 0;
       printf_unfiltered ("gdb: unknown target exception 0x%08x at %s\n",
 	(unsigned) current_event.u.Exception.ExceptionRecord.ExceptionCode,
 	host_address_to_string (
@@ -1491,19 +1491,10 @@ get_windows_debug_event (struct target_ops *ops,
 		     "EXCEPTION_DEBUG_EVENT"));
       if (saw_create != 1)
 	break;
-      switch (handle_exception (ourstatus))
-	{
-	case 0:
-	  continue_status = DBG_EXCEPTION_NOT_HANDLED;
-	  break;
-	case 1:
-	  thread_id = current_event.dwThreadId;
-	  break;
-	case -1:
-	  last_sig = 1;
-	  continue_status = -1;
-	  break;
-	}
+      if (handle_exception (ourstatus))
+	thread_id = current_event.dwThreadId;
+      else
+	continue_status = DBG_EXCEPTION_NOT_HANDLED;
       break;
 
     case OUTPUT_DEBUG_STRING_EVENT:	/* Message from the kernel.  */
@@ -1529,10 +1520,7 @@ get_windows_debug_event (struct target_ops *ops,
 
   if (!thread_id || saw_create != 1)
     {
-      if (continue_status == -1)
-	windows_resume (ops, minus_one_ptid, 0, 1);
-      else
-	CHECK (windows_continue (continue_status, -1, 0));
+      CHECK (windows_continue (continue_status, -1, 0));
     }
   else
     {
-- 
1.9.3


  parent reply	other threads:[~2015-11-02 19:45 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 19:36 [PATCH 00/11] C++/MinGW patches Pedro Alves
2015-11-02 19:36 ` [PATCH 02/11] [C++/mingw] Misc alloca casts Pedro Alves
2015-11-02 19:36 ` [PATCH 06/11] [C++/mingw] ser-tcp.c casts Pedro Alves
2015-11-02 20:40   ` Simon Marchi
2015-11-02 20:55     ` Pedro Alves
2015-11-02 21:06       ` Pedro Alves
2015-11-02 19:36 ` [PATCH 01/11] [C++/mingw] ser-mingw.c casts Pedro Alves
2015-11-02 19:36 ` [PATCH 04/11] [C++/mingw] windows-nat.c casts Pedro Alves
2015-11-02 19:36 ` [PATCH 11/11] [C++/mingw] gdbserver: gdb/host signal mixup Pedro Alves
2015-11-02 19:36 ` [PATCH 10/11] [C++/mingw] Fix windows-nat.c::xlate Pedro Alves
2015-11-02 19:36 ` [PATCH 03/11] [C++/mingw] gdb-dlfcn.c casts Pedro Alves
2015-11-02 19:43 ` [PATCH 09/11] [C++/mingw] handle_output_debug_string Pedro Alves
2015-11-02 19:44 ` [PATCH 05/11] [C++/mingw] gdbserver casts Pedro Alves
2015-11-02 19:44 ` [PATCH 07/11] [C++/mingw] Define __STDC_CONSTANT_MACROS / __STDC_LIMIT_MACROS for stdint.h Pedro Alves
2015-11-02 20:47   ` Simon Marchi
2015-11-03 13:58     ` Simon Marchi
2015-11-03 14:07       ` Pedro Alves
2015-11-03 14:15         ` Simon Marchi
2015-11-03 15:13           ` Pedro Alves
2015-11-02 19:45 ` Pedro Alves [this message]
2015-11-02 21:01   ` [PATCH 08/11] [C++/mingw] Simplify first chance exception handling Simon Marchi
2015-11-02 21:09     ` Pedro Alves
2015-11-02 20:05 ` [PATCH 00/11] C++/MinGW patches Pedro Alves
2015-11-02 20:22   ` Qian Hong
2015-11-02 20:46     ` Pedro Alves
2015-11-02 21:17       ` Qian Hong
2015-11-02 23:31         ` Pedro Alves
2015-11-03  9:06           ` Qian Hong
2015-11-03 10:47       ` Qian Hong
2015-11-03 11:15         ` Qian Hong
2015-11-03 11:26           ` Pedro Alves
2015-11-03 11:41             ` Qian Hong
2015-11-03 12:11               ` Qian Hong
2015-11-03 12:34               ` Pedro Alves
2015-11-03 11:20         ` Pedro Alves
2015-11-03 16:54           ` Pedro Alves
2015-11-03 18:59             ` Qian Hong
2015-11-03 21:03             ` Qian Hong
2015-11-03 22:39               ` Pedro Alves
2015-11-09  9:53                 ` Qian Hong
2015-11-17 14:50                   ` Pedro Alves
2015-11-30 15:03                     ` Qian Hong
2015-11-30 15:48                       ` Pedro Alves
2015-11-03 12:24     ` Qian Hong
2015-11-03 12:27       ` Pedro Alves
2015-11-03 12:56         ` Qian Hong
2015-11-03 13:08           ` Pedro Alves
2015-11-03 13:23             ` Qian Hong
2015-11-03 16:52               ` Pedro Alves
2015-11-03 13:10           ` Pedro Alves
2015-11-02 21:04 ` Simon Marchi
2015-11-17 15:28   ` Pedro Alves

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=1446492970-21432-9-git-send-email-palves@redhat.com \
    --to=palves@redhat.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