diff options
author | Joel Brobecker <brobecker@adacore.com> | 2014-06-11 14:07:27 +0200 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2014-08-01 06:55:10 -0700 |
commit | e068c55d5e2f73e85d0d51a39d2a8921ce262d55 (patch) | |
tree | ff849040797c5533b4fd6446cdda7c15e577ec7d /gdb | |
parent | 8c7840168031ab93432214580bf14ce63d638d22 (diff) | |
download | gdb-e068c55d5e2f73e85d0d51a39d2a8921ce262d55.zip gdb-e068c55d5e2f73e85d0d51a39d2a8921ce262d55.tar.gz gdb-e068c55d5e2f73e85d0d51a39d2a8921ce262d55.tar.bz2 |
x64-windows: Fix extraction of chained UNWIND_INFO
On x86_64-windows, GDB is unable to unwind past some code in
mswsock.dll. For instance:
(gdb) bt
#0 0x00000000778712fa in ntdll!ZwWaitForSingleObject ()
from C:\Windows\SYSTEM32\ntdll.dll
#1 0x000007fefcfb0f75 in WSPStartup ()
from C:\Windows\system32\mswsock.dll
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
The UNWIND_INFO record for frame #1's PC has a UNW_FLAG_CHAININFO
flag, and so after having decoded this unwind record, GDB's decoder
next tries to locate the next unwind record on the chain. Unfortunately,
the location of that unwind info appears to be miscomputed. This is
the expression used:
chain_vma = cache->image_base + unwind_info
+ sizeof (ex_ui) + ((codes_count + 1) & ~1) * 2 + 8;
The chain-info is expected to be right after the "Unwind codes
array" which is itself after all the fields of ex_ui's struct.
So the "+ 8" offset at the end should not be there.
Because of that extra offset, we were reading no longer processing
correct unwind info, leading the unwinder computing the wrong frame
size, computing the wrong return address, etc.
gdb/ChangeLog:
* amd64-windows-tdep.c (amd64_windows_frame_decode_insns):
Remove "+ 8" offset in computation of CHAIN_VMA.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/amd64-windows-tdep.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e494a2a..939fd20 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-08-01 Joel Brobecker <brobecker@adacore.com> + + * amd64-windows-tdep.c (amd64_windows_frame_decode_insns): + Remove "+ 8" offset in computation of CHAIN_VMA. + 2014-07-31 Doug Evans <dje@google.com> * inflow.c (child_terminal_inferior): Add comment. diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index 331ce77..cb1bac7 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -826,7 +826,7 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame, CORE_ADDR chain_vma; chain_vma = cache->image_base + unwind_info - + sizeof (ex_ui) + ((codes_count + 1) & ~1) * 2 + 8; + + sizeof (ex_ui) + ((codes_count + 1) & ~1) * 2; if (target_read_memory (chain_vma, (gdb_byte *) &d, sizeof (d)) != 0) return; |