* [PATCH 0/2] GCC exception codes
@ 2020-08-20 14:55 Ken Brown
2020-08-20 14:55 ` [PATCH 1/2] Cygwin: add header defining " Ken Brown
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ken Brown @ 2020-08-20 14:55 UTC (permalink / raw)
To: cygwin-patches
Ken Brown (2):
Cygwin: add header defining GCC exception codes
Cygwin: strace: ignore GCC exceptions
winsup/cygwin/exceptions.cc | 10 +---------
winsup/cygwin/gcc_seh.h | 19 +++++++++++++++++++
winsup/utils/strace.cc | 8 ++++++++
3 files changed, 28 insertions(+), 9 deletions(-)
create mode 100644 winsup/cygwin/gcc_seh.h
--
2.28.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] Cygwin: add header defining GCC exception codes
2020-08-20 14:55 [PATCH 0/2] GCC exception codes Ken Brown
@ 2020-08-20 14:55 ` Ken Brown
2020-08-20 14:56 ` [PATCH 2/2] Cygwin: strace: ignore GCC exceptions Ken Brown
2020-08-20 17:29 ` [PATCH 0/2] GCC exception codes Corinna Vinschen
2 siblings, 0 replies; 4+ messages in thread
From: Ken Brown @ 2020-08-20 14:55 UTC (permalink / raw)
To: cygwin-patches
Include it in exceptions.cc instead of defining the exception codes
there.
---
winsup/cygwin/exceptions.cc | 10 +---------
winsup/cygwin/gcc_seh.h | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 9 deletions(-)
create mode 100644 winsup/cygwin/gcc_seh.h
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 61406e5d1..bb7704f94 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -28,6 +28,7 @@ details. */
#include "ntdll.h"
#include "exception.h"
#include "posix_timer.h"
+#include "gcc_seh.h"
/* Definitions for code simplification */
#ifdef __x86_64__
@@ -763,15 +764,6 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
return ExceptionContinueExecution;
#ifdef __x86_64__
-/* From the GCC source file libgcc/unwind-seh.c. */
-#define STATUS_USER_DEFINED (1U << 29)
-#define GCC_MAGIC (('G' << 16) | ('C' << 8) | 'C')
-#define GCC_EXCEPTION(TYPE) \
- (STATUS_USER_DEFINED | ((TYPE) << 24) | GCC_MAGIC)
-#define STATUS_GCC_THROW GCC_EXCEPTION (0)
-#define STATUS_GCC_UNWIND GCC_EXCEPTION (1)
-#define STATUS_GCC_FORCED GCC_EXCEPTION (2)
-
case STATUS_GCC_THROW:
case STATUS_GCC_UNWIND:
case STATUS_GCC_FORCED:
diff --git a/winsup/cygwin/gcc_seh.h b/winsup/cygwin/gcc_seh.h
new file mode 100644
index 000000000..fb779ef73
--- /dev/null
+++ b/winsup/cygwin/gcc_seh.h
@@ -0,0 +1,19 @@
+/* gcc_seh.h: GCC exception codes.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#pragma once
+
+/* From the GCC source file libgcc/unwind-seh.c. */
+
+#ifdef __x86_64__
+#define STATUS_USER_DEFINED (1U << 29)
+#define GCC_MAGIC (('G' << 16) | ('C' << 8) | 'C')
+#define GCC_EXCEPTION(TYPE) \
+ (STATUS_USER_DEFINED | ((TYPE) << 24) | GCC_MAGIC)
+#define STATUS_GCC_THROW GCC_EXCEPTION (0)
+#define STATUS_GCC_UNWIND GCC_EXCEPTION (1)
+#define STATUS_GCC_FORCED GCC_EXCEPTION (2)
+#endif
--
2.28.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] Cygwin: strace: ignore GCC exceptions
2020-08-20 14:55 [PATCH 0/2] GCC exception codes Ken Brown
2020-08-20 14:55 ` [PATCH 1/2] Cygwin: add header defining " Ken Brown
@ 2020-08-20 14:56 ` Ken Brown
2020-08-20 17:29 ` [PATCH 0/2] GCC exception codes Corinna Vinschen
2 siblings, 0 replies; 4+ messages in thread
From: Ken Brown @ 2020-08-20 14:56 UTC (permalink / raw)
To: cygwin-patches
Any C++ app that calls 'throw' on 64-bit Cygwin results in an
exception of type STATUS_GCC_THROW (0x20474343) generated by the C++
runtime. Don't pollute the strace output by printing information
about this and other GCC exceptions.
---
winsup/utils/strace.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc
index 9b6569a70..b96ad40c1 100644
--- a/winsup/utils/strace.cc
+++ b/winsup/utils/strace.cc
@@ -25,6 +25,7 @@ details. */
#include "../cygwin/include/sys/cygwin.h"
#include "../cygwin/include/cygwin/version.h"
#include "../cygwin/cygtls_padsize.h"
+#include "../cygwin/gcc_seh.h"
#include "path.h"
#undef cygwin_internal
#include "loadlib.h"
@@ -790,6 +791,13 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid)
case STATUS_BREAKPOINT:
case 0x406d1388: /* SetThreadName exception. */
break;
+#ifdef __x86_64__
+ case STATUS_GCC_THROW:
+ case STATUS_GCC_UNWIND:
+ case STATUS_GCC_FORCED:
+ status = DBG_EXCEPTION_NOT_HANDLED;
+ break;
+#endif
default:
status = DBG_EXCEPTION_NOT_HANDLED;
if (ev.u.Exception.dwFirstChance)
--
2.28.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] GCC exception codes
2020-08-20 14:55 [PATCH 0/2] GCC exception codes Ken Brown
2020-08-20 14:55 ` [PATCH 1/2] Cygwin: add header defining " Ken Brown
2020-08-20 14:56 ` [PATCH 2/2] Cygwin: strace: ignore GCC exceptions Ken Brown
@ 2020-08-20 17:29 ` Corinna Vinschen
2 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2020-08-20 17:29 UTC (permalink / raw)
To: cygwin-patches
On Aug 20 10:55, Ken Brown via Cygwin-patches wrote:
> Ken Brown (2):
> Cygwin: add header defining GCC exception codes
> Cygwin: strace: ignore GCC exceptions
>
> winsup/cygwin/exceptions.cc | 10 +---------
> winsup/cygwin/gcc_seh.h | 19 +++++++++++++++++++
> winsup/utils/strace.cc | 8 ++++++++
> 3 files changed, 28 insertions(+), 9 deletions(-)
> create mode 100644 winsup/cygwin/gcc_seh.h
>
> --
> 2.28.0
LGTM. Please push.
Thanks,
Corinna
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-20 17:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 14:55 [PATCH 0/2] GCC exception codes Ken Brown
2020-08-20 14:55 ` [PATCH 1/2] Cygwin: add header defining " Ken Brown
2020-08-20 14:56 ` [PATCH 2/2] Cygwin: strace: ignore GCC exceptions Ken Brown
2020-08-20 17:29 ` [PATCH 0/2] GCC exception codes Corinna Vinschen
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).