From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 619A33858C52; Thu, 19 Jan 2023 11:32:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 619A33858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674127962; bh=e1bkNFGOmPksNIQiiTILk44YHniF19Z3AqmODGX6Dbk=; h=From:To:Subject:Date:From; b=OwIxGKPpjunc/MBnBiKXwIFxYk9bfN7N3grRIdmLf1eBm9SemLoC9hO6nsQeX55eR gJKL0peNUqP56oZqm1Qa0eQuVQmC2vBGSanZ9rJMFA3CJ60BfpsErRYY9FSFUOd3lR f6aEDCbRCavfIH8YTBhI64T2GH+IqJnMgiRpLxJU= From: "blarsen at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug record/30025] New: Adding an inferior when already recording corrupts the first inferior state Date: Thu, 19 Jan 2023 11:32:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: record X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: blarsen at redhat dot com X-Bugzilla-Status: NEW 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30025 Bug ID: 30025 Summary: Adding an inferior when already recording corrupts the first inferior state Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: record Assignee: unassigned at sourceware dot org Reporter: blarsen at redhat dot com Target Milestone: --- Created attachment 14607 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14607&action=3Ded= it Minimal reproducer When debugging an inferior whose execution is being recorded and a new infe= rior is added, the original inferior's state seems to be corrupted somehow. As an example, debugging the program attached to this bug I got the following session: $ ./gdb -q ~/a.out Reading symbols from /home/blarsen/a.out... (gdb) start Temporary breakpoint 1 at 0x401137: file t.c, line 7. Starting program: /home/blarsen/a.out=20 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Temporary breakpoint 1, main () at t.c:7 7 int q =3D 0; (gdb) record (gdb) n 8 fact(5); (gdb) add-inferior -exec ~/a.out [New inferior 2] Added inferior 2 on connection 1 (native) Reading symbols from /home/blarsen/a.out... (gdb) inferior 2 [Switching to inferior 2 [] (/home/blarsen/a.out)] (gdb) start Temporary breakpoint 2 at 0x401137: -qualified main. (2 locations) Starting program: /home/blarsen/a.out=20 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Thread 2.1 "a.out" hit Temporary breakpoint 2.2, main () at t.c:7 7 int q =3D 0; (gdb) inferior 1 [Switching to inferior 1 [process 106244] (/home/blarsen/a.out)] [Switching to thread 1.1 (Thread 0x7ffff7fa6600 (LWP 106244))] #0 main () at t.c:8 8 fact(5); (gdb) n Thread 1.1 "a.out" received signal SIGTRAP, Trace/breakpoint trap. 0x0000000000401115 in fact (n=3D1) at t.c:2 2 if (n<2) return n; When the SIGTRAP happens isn't consistent, and sometimes it happens in a way that seems to corrupt the parameter, I've seen values ranging from 32 thous= and to -17 thousand. --=20 You are receiving this mail because: You are on the CC list for the bug.=