Ideas for improving profil.c

Christopher Faylor cgf@redhat.com
Wed Apr 23 00:37:00 GMT 2003


On Tue, Apr 22, 2003 at 06:10:25PM -0500, Brian Ford wrote:
>I tracked down my pc sampling (profiling) problems mentioned here:
>
>http://cygwin.com/ml/cygwin/2003-04/msg01781.html
>
>My problem was that the eip returned was almost never in the profiling
>range.  It was usually way down in the bowels of Windows that I have yet
>to understand.  Something like 0x7ffe0304.
>
>Raising the profiling thread priority helped catch a few more valid
>addresses.  I would be glad to submit a one line patch for this if anyone
>is interested.
>
>I think most OS's are able to trace processes in the kernel back to the
>entering trap, thus finding an in-range pc.  So, my idea was to (and I do
>have a rough version working) naively try and walk the stack back some
>maximum number of frames until I hit the range.  Better yet, only
>walk back if we are below a cygwin entry point and only up to that point.

The frame pointer in windows routines is often not right so following
the frame chain back to the caller is problematic.  That's why cygwin's
signal routines go out of their way to save known frame information
whenever possible.  See exceptions.cc.

cgf



More information about the Cygwin-developers mailing list