[PATCH] [gdb/remote] Fix abort on REMOTE_CLOSE_ERROR

Tom Tromey tom@tromey.com
Fri Apr 19 16:42:31 GMT 2024


>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> The abort happens because a c++ exception escapes to c code, specifically
Tom> opncls_bstat in bfd/opncls.c.  Compiling with -fexceptions works around this.

I guess on x86-64 the compiler must default to -fexceptions?

Anyway I agree this shouldn't be done.

Tom> Alternatively, we could save it and rethrow it once back in c++, but I don't
Tom> know the error handling design well enough to judge whether that's necessary.
Tom> So for now, go with this trivial solution.

I think this would be tricky to get right.

Tom> +	/* If some error triggered an exception, silently transform it a
Tom> +	   negative result, to prevent it from escaping to C code and
Tom> +	   triggering an abort.  */
Tom> +	return nullptr;

Can you check to see if BFD requires that the BFD error be set here (and
in the other similar spots)?  I somewhat suspect it does.

Tom


More information about the Gdb-patches mailing list