public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Add Windows x64 SEH unwinder (take 2)
@ 2013-01-09 10:53 Joel Brobecker
  2013-01-09 10:53 ` [RFA/commit+NEWS 1/2] Add command set/show debug unwind Joel Brobecker
                   ` (2 more replies)
  0 siblings, 3 replies; 39+ messages in thread
From: Joel Brobecker @ 2013-01-09 10:53 UTC (permalink / raw)
  To: gdb-patches

Hello,

This patch series adds an unwinder using the native Windows x64 SEH
data. This dramatically improves the behavior as soon as system
calls are involved. For instance, after switching to a different
thread, we now get...

    (gdb) bt
    #0  0x0000000077a46eba in ntdll!ZwWaitForSingleObject ()
       from C:\Windows\system32\ntdll.dll
    #1  0x00000000778fb380 in WaitForSingleObjectEx ()
       from C:\Windows\system32\kernel32.dll
    #2  0x000000000040a7e9 in system__task_primitives__operations__cond_wait ()
    #3  0x0000000000407c3b in system__tasking__rendezvous__accept_trivial ()
    #4  0x0000000000401f3c in task_switch.callee (<_task>=0x394410)
        at task_switch.adb:29
    #5  0x0000000000406637 in system__tasking__stages__task_wrapper ()
    [...]

... instead of:

    #0  0x0000000077a46eba in ntdll!ZwWaitForSingleObject ()
       from C:\Windows\system32\ntdll.dll
    #1  0x00000000778fb380 in WaitForSingleObjectEx ()
       from C:\Windows\system32\kernel32.dll
    #2  0x000007fffffdc000 in ?? ()
    #3  0x0000000077a266e4 in ntdll!LdrInitializeThunk ()
       from C:\Windows\system32\ntdll.dll
    #4  0x0000000000000000 in ?? ()

^ permalink raw reply	[flat|nested] 39+ messages in thread
* Re: [RFA] Windows x64 SEH unwinder (v2)
@ 2013-08-05 11:25 Roland Schwingel
  2013-08-19 13:53 ` Tristan Gingold
  0 siblings, 1 reply; 39+ messages in thread
From: Roland Schwingel @ 2013-08-05 11:25 UTC (permalink / raw)
  To: Tristan Gingold, Pedro Alves
  Cc: Joel Brobecker, gdb-patches@sourceware.org ml

Hi Tristan...

gdb-patches-owner@sourceware.org wrote on 08.07.2013 12:55:21:

 > Hello,
 >
 > this is the second version of the patch we submitted in January.
 > I have rewritten amd64_windows_frame_decode_epilogue according to the
 > very serious review and comments from Pedro.
 >
 > Tristan.
Today I gave your SEH unwinder patch a try. I hopped to get an issue 
from 2005 resolved.

(See: http://sourceware.org/ml/gdb/2005-04/msg00113.html)

I compiled my test C code from this post using GCC 4.8.1 for x64 windows
with no special options beside of a single -g.

Stack frames are way better... Congratulations... But:
When inspecting frames I see problems showing the content of variables. 
I cannot look into any of the applications vars. gdb just shows eg:

#1: 0x0000000000401577 in func4 (num=<error reading variable: can't 
compute CFA for this frame>) at gdb_crash.c:26

also a "p num" show the same error.

Did I do something wrong? Is there a hidden trick that needs to be 
applied to get this going that I couldn't find from reading the patch?

Thanks for your help,

Roland

^ permalink raw reply	[flat|nested] 39+ messages in thread
* Re: [RFA] Windows x64 SEH unwinder (v2)
@ 2013-08-19 15:14 Roland Schwingel
  2013-08-19 15:32 ` Tristan Gingold
  0 siblings, 1 reply; 39+ messages in thread
From: Roland Schwingel @ 2013-08-19 15:14 UTC (permalink / raw)
  To: Tristan Gingold
  Cc: Joel Brobecker, gdb-patches@sourceware.org ml, Pedro Alves

Hi Tristan...

 > > Stack frames are way better... Congratulations... But:
 > > When inspecting frames I see problems showing the content of
 > variables. I cannot look into any of the applications vars. gdb
 > just shows eg:
 >
 > > #1: 0x0000000000401577 in func4 (num=<error reading variable:
 > can't compute CFA for this frame>) at gdb_crash.c:26
 > >
 > > also a "p num" show the same error.
 > >
 > > Did I do something wrong? Is there a hidden trick that needs to be
 > applied to get this going that I couldn't find from reading the patch?
 >
 > Doesn't ring a bell here.  Can you post gdb_crash.c ?

The example program is part of my initial post.
(http://sourceware.org/ml/gdb/2005-04/msg00113.html)

For compiling it I simply did a
/path/to/my/x86_64-w64-mingw32-gcc.exe -g gdb_crash.c -o gdb_crash.exe

But the concrete example does not matter. Whichever program I compile 
variable viewing is totally broken for me (gcc 4.8.2 prelease 20130730 
with mingw-w64 runtime from 20130730) all with above error messages.

Thanks for your help. I hope this can be resolved soon. I would love to 
enrich my gdb with SEH2 unwinding!

Roland

^ permalink raw reply	[flat|nested] 39+ messages in thread
* Re: [RFA] Windows x64 SEH unwinder (v2)
@ 2013-08-19 16:01 Roland Schwingel
  2013-08-21 13:45 ` Tristan Gingold
  0 siblings, 1 reply; 39+ messages in thread
From: Roland Schwingel @ 2013-08-19 16:01 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: gdb-patches@sourceware.org ml

Hi Tristan,

 > I do not have this issue with the compiler installed here.
 >
 > Can you send me (privately) your binary ?
Sure. Will come in the next couple of minutes.

Roland

^ permalink raw reply	[flat|nested] 39+ messages in thread
* Re: [RFA] Windows x64 SEH unwinder (v2)
@ 2013-08-22 11:22 Roland Schwingel
  0 siblings, 0 replies; 39+ messages in thread
From: Roland Schwingel @ 2013-08-22 11:22 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches@sourceware.org ml

Hi Pedro

 > > I think I understand the issue.
 > >
 > > This is caused by DW_OP_call_frame_cfa, which is supported only by
 > > the dwarf2 unwinder.
 > > This issue has been fixed in gcc (CL date is 2012-03-15).
 >
 > It took me a bit to dig out which patch that was, to understand
 > what the issue is.  For the benefit of others, it's here:
 > http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00980.html

This patch is already part of the gcc 4.8 I am using and is 
unfortunately not curing the problem. I will try tristan's new patch 
soon to see whether it is working now (where I do have a lot of 
convidence in).

Roland

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2013-09-02  9:28 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-09 10:53 Add Windows x64 SEH unwinder (take 2) Joel Brobecker
2013-01-09 10:53 ` [RFA/commit+NEWS 1/2] Add command set/show debug unwind Joel Brobecker
2013-01-09 12:41   ` Jan Kratochvil
2013-01-09 18:40     ` Joel Brobecker
2013-01-09 15:14   ` Tom Tromey
2013-01-09 16:01   ` Eli Zaretskii
2013-01-09 10:53 ` [RFA/commit+doco 2/2] Windows x64 SEH unwinder Joel Brobecker
2013-01-09 15:52   ` Pedro Alves
2013-01-09 16:28     ` Tristan Gingold
2013-01-09 17:10       ` Pedro Alves
2013-01-09 17:53         ` Tom Tromey
2013-01-09 19:11           ` Pedro Alves
2013-01-09 20:07         ` Tristan Gingold
2013-01-10 16:24           ` Pedro Alves
2013-01-11  8:04             ` Tristan Gingold
2013-07-08 10:55             ` [RFA] Windows x64 SEH unwinder (v2) Tristan Gingold
2013-07-26 15:22               ` Pedro Alves
2013-08-19 13:59                 ` Tristan Gingold
2013-08-19 14:13                   ` Pedro Alves
2013-08-22  9:33                 ` [PATCH v3] Windows x64 SEH unwinder Tristan Gingold
2013-08-22 15:10                   ` Eli Zaretskii
2013-08-22 15:26                   ` Pedro Alves
2013-08-22 15:41                     ` Tristan Gingold
2013-08-22 16:15                       ` Pedro Alves
2013-08-23  6:54                         ` Tristan Gingold
2013-08-27 17:45                           ` Pedro Alves
2013-09-02  9:28                             ` Tristan Gingold
2013-01-09 16:06   ` [RFA/commit+doco 2/2] " Eli Zaretskii
2013-01-09 16:29     ` Tristan Gingold
2013-01-09 11:05 ` Add Windows x64 SEH unwinder (take 2) Pedro Alves
2013-01-09 11:11   ` Joel Brobecker
2013-08-05 11:25 [RFA] Windows x64 SEH unwinder (v2) Roland Schwingel
2013-08-19 13:53 ` Tristan Gingold
2013-08-19 15:14 Roland Schwingel
2013-08-19 15:32 ` Tristan Gingold
2013-08-19 16:01 Roland Schwingel
2013-08-21 13:45 ` Tristan Gingold
2013-08-22 10:22   ` Pedro Alves
2013-08-22 11:22 Roland Schwingel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).