From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 23C583858C52; Mon, 10 Apr 2023 14:41:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23C583858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681137706; bh=3Bih5a9B7ldN2n6SVYZA8UHwXFu6Qkq0chR7OyhfhPQ=; h=From:To:Subject:Date:From; b=rpgUg5KA9fjQJsrOA3cZCJLuHgmF6xqCZXbeFMThkMuA+6YLEyBZBcnraJ1hInSot lJYi0PZjevr8nYXqzMUECDxrMULKxqsUEzWeWxbiLeow4gY5ZESQqprjR+ti5nhGoa Brm+E2n0ms2Xcoge1OycfvFRj96c1malUzteZXu4= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Handle unwinding from SEGV on Windows X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 5f777caeebfd789f3b4f5ed13e9c3f49e9db0923 X-Git-Newrev: a0f6c61c9ab998cd77b0899a4bdea9576d6d775f Message-Id: <20230410144146.23C583858C52@sourceware.org> Date: Mon, 10 Apr 2023 14:41:46 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da0f6c61c9ab9= 98cd77b0899a4bdea9576d6d775f commit a0f6c61c9ab998cd77b0899a4bdea9576d6d775f Author: Tom Tromey Date: Tue Mar 21 13:40:03 2023 -0600 Handle unwinding from SEGV on Windows =20 PR win32/30255 points out that a call to a NULL function pointer will leave gdb unable to "bt" on Windows. =20 I tracked this down to the amd64 windows unwinder. If we treat this scenario as if it were a leaf function, unwinding works fine. =20 I'm not completely sure this patch is the best way. I considered having it check for 'pc=3D=3D0' -- but then I figured this could affect any inaccessible PC, not just the special 0 value. =20 No test case because I can't run dejagnu tests on Windows. I tested this by hand using the test case in the bug. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30255 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_fram= e, void **this_cache) cache->sp =3D extract_unsigned_integer (buf, 8, byte_order); cache->pc =3D pc; =20 + /* If we can't find the unwind info, keep trying as though this is a + leaf function. This situation can happen when PC=3D=3D0, see + https://sourceware.org/bugzilla/show_bug.cgi?id=3D30255. */ if (amd64_windows_find_unwind_info (gdbarch, pc, &unwind_info, &cache->image_base, &cache->start_rva, - &cache->end_rva)) - return cache; - - if (unwind_info =3D=3D 0) + &cache->end_rva) + || unwind_info =3D=3D 0) { /* Assume a leaf function. */ cache->prev_sp =3D cache->sp + 8;