public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "luca.bacci at outlook dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/30255] New: GDB on Windows cannot retrieve a stacktrace when a NULL function pointer is called Date: Mon, 20 Mar 2023 17:30:28 +0000 [thread overview] Message-ID: <bug-30255-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=30255 Bug ID: 30255 Summary: GDB on Windows cannot retrieve a stacktrace when a NULL function pointer is called Product: gdb Version: 13.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: luca.bacci at outlook dot com Target Milestone: --- Hello, I use gdb on MSYS2 to fix issues with GIMP, Inkscape etc on Windows. One thing I noticed is that gdb is unable to give a stacktrace anytime the debugged program invokes a NULL function pointer. For example, consider: void (*func_ptr)(void); static void a (void) { func_ptr (); } static void b (void) { a (); } static void c (void) { b (); } int main() { c (); } When running under GDB 13.1 the stacktrace is not retrieved: $ gcc -g -o sample sample.c $ gdb ./sample.exe GNU gdb (GDB) 13.1 Copyright (C) 2023 Free Software Foundation, Inc. Reading symbols from ./sample.exe... (gdb) r Starting program: D:\sample.exe [New Thread 27612.0x6ec0] Thread 1 received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) I have tried with lldb and it works: $ lldb ./sample.exe (lldb) target create "./sample.exe" (rrent executable set to 'D:\sample.exe' (x86_64). (lldb) r (lldb) Process 23036 launched: 'D:\sample.exe' (x86_64) Process 23036 stopped * thread #1, stop reason = Exception 0xc0000005 encountered at address 0x000000: User-mode data execution prevention (DEP) violation at location 0x00000000 frame #0: 0x0000000000000000 error: Only part of a ReadProcessMemory or WriteProcessMemory request was completed. (lldb) bt * thread #1, stop reason = Exception 0xc0000005 encountered at address 0x000000: User-mode data execution prevention (DEP) violation at location 0x00000000 * frame #0: 0x0000000000000000 frame #1: 0x00007ff73e2813ea sample.exe`a at sample.c:5:3 frame #2: 0x00007ff73e2813d9 sample.exe`b at sample.c:10:3 frame #3: 0x00007ff73e2813c9 sample.exe`c at sample.c:15:3 frame #4: 0x00007ff73e2813b4 sample.exe`main at sample.c:19:3 frame #5: 0x00007ff73e281316 sample.exe`__tmainCRTStartup at crtexe.c:272:15 frame #6: 0x00007ff73e281366 sample.exe`mainCRTStartup at crtexe.c:193:9 frame #7: 0x00007ff90dff7614 kernel32.dll`BaseThreadInitThunk + 20 frame #8: 0x00007ff90f1a26a1 ntdll.dll`RtlUserThreadStart + 33 (lldb) See also: https://gitlab.com/inkscape/inkscape/-/issues/4031#note_1231250877, where we encountered this issue due to libepoxy returning NULL function pointers Thank you! Luca -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2023-03-20 17:30 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-20 17:30 luca.bacci at outlook dot com [this message] 2023-03-21 15:46 ` [Bug gdb/30255] " tromey at sourceware dot org 2023-03-21 15:54 ` [Bug win32/30255] " tromey at sourceware dot org 2023-03-21 16:20 ` tromey at sourceware dot org 2023-03-21 18:30 ` tromey at sourceware dot org 2023-03-21 19:43 ` tromey at sourceware dot org 2023-03-21 20:22 ` luca.bacci at outlook dot com 2023-04-10 14:41 ` cvs-commit at gcc dot gnu.org 2023-04-10 14:42 ` tromey at sourceware dot org
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=bug-30255-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@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).