From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CC1783858C74; Thu, 27 Jan 2022 07:02:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC1783858C74 From: "fasching.a91 at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug python/28825] New: Breakpoints fire multiple times after fork() call Date: Thu, 27 Jan 2022 07:02:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: 11.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fasching.a91 at gmail dot com 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 attachments.created 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 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2022 07:02:59 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28825 Bug ID: 28825 Summary: Breakpoints fire multiple times after fork() call Product: gdb Version: 11.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: python Assignee: unassigned at sourceware dot org Reporter: fasching.a91 at gmail dot com Target Milestone: --- Created attachment 13932 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D13932&action=3Ded= it program and script to reproduce the described behavior Breakpoints for a function fire multiple times if they happen after a fork(= ), even though the function is only called once. This doesn't happen if there's some delay (e.g. a sleep) between the fork()= and the function call. Steps to reproduce: 1. Required files -------------------------------------- $ cat fork.c #include #include #include void bar(void) { printf("this is bar()\n"); } int main(int argc, char **argv) { if (!fork()) exit(0); // sleep(1); // Doesn't happen after sleeping. bar(); return 0; } $ cat script.py import gdb class Breakpoint(gdb.Breakpoint): def stop(self): print("breakpoint fired") bp =3D Breakpoint("bar") gdb.execute("run") 2. Compile -------------------------------------- $ gcc -g -O0 -o fork fork.c 3. Run -------------------------------------- $ gdb --batch -x script.py fork Breakpoint 1 at 0x115d: file fork.c, line 6. [Detaching after fork from child process 33489] breakpoint fired breakpoint fired this is bar() [Inferior 1 (process 33485) exited normally] I can reproduce this with GDB 8.2 and 11.1 and haven't tried any releases in between. --=20 You are receiving this mail because: You are on the CC list for the bug.=