public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Handle unwinding from SEGV on Windows Date: Mon, 10 Apr 2023 14:41:46 +0000 (GMT) [thread overview] Message-ID: <20230410144146.23C583858C52@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a0f6c61c9ab998cd77b0899a4bdea9576d6d775f commit a0f6c61c9ab998cd77b0899a4bdea9576d6d775f Author: Tom Tromey <tromey@adacore.com> Date: Tue Mar 21 13:40:03 2023 -0600 Handle unwinding from SEGV on Windows PR win32/30255 points out that a call to a NULL function pointer will leave gdb unable to "bt" on Windows. I tracked this down to the amd64 windows unwinder. If we treat this scenario as if it were a leaf function, unwinding works fine. I'm not completely sure this patch is the best way. I considered having it check for 'pc==0' -- but then I figured this could affect any inaccessible PC, not just the special 0 value. No test case because I can't run dejagnu tests on Windows. I tested this by hand using the test case in the bug. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30255 Diff: --- gdb/amd64-windows-tdep.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index 07df64bed60..9d69ec282d2 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -1098,13 +1098,14 @@ amd64_windows_frame_cache (frame_info_ptr this_frame, void **this_cache) cache->sp = extract_unsigned_integer (buf, 8, byte_order); cache->pc = pc; + /* If we can't find the unwind info, keep trying as though this is a + leaf function. This situation can happen when PC==0, see + https://sourceware.org/bugzilla/show_bug.cgi?id=30255. */ if (amd64_windows_find_unwind_info (gdbarch, pc, &unwind_info, &cache->image_base, &cache->start_rva, - &cache->end_rva)) - return cache; - - if (unwind_info == 0) + &cache->end_rva) + || unwind_info == 0) { /* Assume a leaf function. */ cache->prev_sp = cache->sp + 8;
reply other threads:[~2023-04-10 14:41 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230410144146.23C583858C52@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).