From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A6EF385B50E; Fri, 8 Mar 2024 17:10:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A6EF385B50E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709917803; bh=LF3GvNweNqiK+RuoKbrqPGPHbm11bbiEbfBbvUWp1sY=; h=From:To:Subject:Date:From; b=q+wuHQzWw/p7tyweOg+HO/vvLJjqePR4zYkzJA+2WBqPaSsQ5B63+H/9+RWpK9WiG 4p6EziqqUityQJzGejyfHHHX4Q31Hn9oHxIwhV1unjgpRbo9UlnLicQBhZNtqOtRc9 /am8OcgmmUUkn7ggU2FaCgZiYuqb5/c/hTkbZEjQ= From: "ydeng339 at gatech dot edu" To: gdb-prs@sourceware.org Subject: [Bug gdb/31465] New: gdb batch mode crashes when execute "gdb.post_event(lambda: gdb.execute("c"))" in a stop event handler Date: Fri, 08 Mar 2024 17:10:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 15.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ydeng339 at gatech dot edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31465 Bug ID: 31465 Summary: gdb batch mode crashes when execute "gdb.post_event(lambda: gdb.execute("c"))" in a stop event handler Product: gdb Version: 15.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: ydeng339 at gatech dot edu Target Milestone: --- I want to debug my program (with multiple breakpoints) automatically. When reaching a breakpoint, I want to do some operations and continue the execut= ion.=20 Here is the code snippet of my python script: ``` def set_breakpoints(): # Just add multiple breakpoints ... def on_stop(event): # Do some operations gdb.post_event(lambda: gdb.execute("c")) gdb.events.stop.connect(on_stop) gdb.execute("run") ``` And here is my command: "gdb -x [MY_PYTHON_SCRIPT] --batch --args [MY_PROGRAM]". And then, gdb crashes with the following logs: ``` Fatal signal: Segmentation fault ----- Backtrace ----- 0x55a013532077 ??? 0x55a013634859 ??? 0x55a013634a22 ??? 0x7eff7742c51f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x7eff780093eb ??? 0x7eff78009f1b ??? 0x55a013797a2a ??? 0x55a0137d01d5 ??? 0x7eff7742f494 __run_exit_handlers ./stdlib/exit.c:113 0x7eff7742f60f __GI_exit ./stdlib/exit.c:143 0x55a01385f3e4 ??? 0x55a0136f3554 ??? 0x55a0136f404e ??? 0x55a01348a15f ??? 0x7eff77413d8f __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 0x7eff77413e3f __libc_start_main_impl ../csu/libc-start.c:392 0x55a01348fbf4 ??? 0xffffffffffffffff ??? --------------------- ``` Such crash only appears in batch mode. If I run the program in interactive mode, the program will not crash (but interactive mode is inefficient). Bas= ed on my test, this bug appears in version 12.1 and version 15.0. --=20 You are receiving this mail because: You are on the CC list for the bug.=