Re: [PATCH v3 21/29] Share handle_exception

Simon Marchi
2020-04-15T15:27:36Z

On 2020-03-13 3:08 p.m., Tom Tromey wrote:
> Both gdb and gdbserver have a "handle_exception" function, the bulk of
> which is shared between the two implementations. This patch arranges
> for the entire thing to be moved into nat/windows-nat.c, with the
> differences handled by callbacks. This patch introduces one more
> callback to make this possible.
>
> gdb/ChangeLog
> 2020-03-13 Tom Tromey <tromey@adacore.com>
>
> * windows-nat.c (MS_VC_EXCEPTION): Move to nat/windows-nat.c.
> (handle_exception_result): Move to nat/windows-nat.h.
> (DEBUG_EXCEPTION_SIMPLE): Remove.
> (windows_nat::handle_ms_vc_exception): New function.
> (handle_exception): Move to nat/windows-nat.c.
> (get_windows_debug_event): Update.
> (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP): Move to
> nat/windows-nat.c.
> * nat/windows-nat.h (handle_ms_vc_exception): Declare.
> (handle_exception_result): Move from windows-nat.c.
> (handle_exception): Declare.
> * nat/windows-nat.c (MS_VC_EXCEPTION, handle_exception)
> (STATUS_WX86_SINGLE_STEP, STATUS_WX86_BREAKPOINT): Move from
> windows-nat.c.
This patch introduced some GDB-specific calls in nat/windows-nat.c. That
file is built by gdbserver, so it breaks that build. This is when building
on Cygwin:

CXX nat/windows-nat.o
/home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/windows-nat.c: In function ‘windows_nat::handle_exception_result windows_nat::handle_exception(target_waitstatus*, bool)’:
/home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/windows-nat.c:200:8: error: ‘cygwin_exceptions’ was not declared in this scope
200 | if ((!cygwin_exceptions && (addr >= cygwin_load_start
| ^~~~~~~~~~~~~~~~~
/home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/windows-nat.c:200:38: error: ‘cygwin_load_start’ was not declared in this scope
200 | if ((!cygwin_exceptions && (addr >= cygwin_load_start
| ^~~~~~~~~~~~~~~~~
/home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/windows-nat.c:201:19: error: ‘cygwin_load_end’ was not declared in this scope
201 | && addr < cygwin_load_end))
| ^~~~~~~~~~~~~~~
/home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/windows-nat.c:202:10: error: ‘find_pc_partial_function’ was not declared in this scope
202 | || (find_pc_partial_function (addr, &fn, NULL, NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~

Simon