[PATCH 1/3] Handle 64bit breakpoints of WOW64 processes as SIGINT

Simon Marchi simark@simark.ca
Thu Sep 24 03:30:08 GMT 2020


On 2020-09-23 1:21 p.m., Hannes Domani via Gdb-patches wrote:
> When a WOW64 process triggers a breakpoint exception in 64bit code (which
> happens when a 64bit gdb calls DebugBreakProcess for a 32bit target),
> gdb ignores the breakpoint (because Wow64GetThreadContext can only report
> the pc of 32bit code, and there is not int3 at this location).
>
> But if these 64bit breakpoint exceptions are handled as SIGINT, gdb
> doesn't check for int3, and always stops the target.
>
> gdb/ChangeLog:
>
> 2020-09-23  Hannes Domani  <ssbssa@yahoo.de>
>
> 	* nat/windows-nat.c (handle_exception): Handle 64bit breakpoints
> 	in WOW64 processes as SIGINT.
> 	* nat/windows-nat.h: Make wow64_process a shared variable.
> 	* windows-nat.c: Remove static wow64_process variable.
>
> gdbserver/ChangeLog:
>
> 2020-09-23  Hannes Domani  <ssbssa@yahoo.de>
>
> 	* win32-low.cc: Remove local wow64_process variable.
> 	* win32-low.h: Remove local wow64_process variable.

This is ok, but...

> @@ -240,6 +241,13 @@ handle_exception (struct target_waitstatus *ourstatus, bool debug_exceptions)
>  	  ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
>  	  ignore_first_breakpoint = false;
>  	}
> +      else if (wow64_process)
> +	{
> +	  DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
> +	  rec->ExceptionCode = DBG_CONTROL_C;
> +	  ourstatus->value.sig = GDB_SIGNAL_INT;
> +	  break;
> +	}

...please add a comment here saying why this particular handling exists,
it's really not intuitive.

Simon


More information about the Gdb-patches mailing list