This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] windows-nat.c Cygwin save_context fix


On Mon, Sep 21, 2009 at 05:14:57PM +0200, Pierre Muller wrote:
>  Cygwin has a way to give a "fake" context for 
>an exception using a OUTPUT_DEBUG_STRING_EVENT.
>
>  While trying to debug some crashes inside cygwin dll,
>I realized the the saved_context code has a problem.
>
>  The saved context was correctly written to the thread_info
>struct, but later overwritten by a call to GetThreadContext.
> 
>  After the cygwin special output_debug_string was correctly
>converted into a context stored in saved_context.
>  The next call to do_windows_fetch_inferior_registers
>then copied this context to the thread_info struct,
>set the reload_context field to zero.
>
>  But a later call to thread_rec() with get_context=1
>can reset reload_context to one, if suspended field
>is zero (this only happens if it is not the main thread).
>
>  My patch fixes the problem by explicitly calling
>SuspendThread for the threaded of the saved_context
>if suspended is still zero at that point.
>
>
>Pierre Muller
>Pascal language support maintainer for GDB
>
>
>
>2009-09-21  Pierre Muller  <muller@ics.u-strasbg.fr>
>
>	* src/gdb/windows-nat.c (saved_threadid): New variable.
>	(do_windows_fetch_inferior_registers): Check for correct thread id
>	and force call to SuspendThread if needed.
>	(handle_output_debug_string): Set saved_threadid.

I REALLY hate SuspendThread and am not likely to accept a patch which
uses it as a solution.

I don't really understand the scenario that you are talking about since
I (obviously?) have no problems debugging SEGVs in cygwin.  However,
would just removing the "have_saved_context = 0;" from
do_windows_fetch_inferior_registers fix the problem?

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]