From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2866B3857708; Thu, 11 Jan 2024 09:12:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2866B3857708 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1704964340; bh=459ywTZD6EJL85KbfFztgo9mjywpzB8QOcvSHyvNwV0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ghv6IOAkNblBj5UMvXqmNkYQhE/J+vIxQgUXOlxXS5EkUapEnkikzGKtjWQVBhmbG T7DYNSc+q3/WQUFIjmh0dm7HmamsNqcnblO/t/sZCAxL0wUhhD1Tmqbw637gQywCH6 55bGkbEIGxOGttEkLzUv7aksyRhAqmnd0t4Ru+24= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/31203] [gdb] FAIL: gdb.base/kill-during-detach.exp: exit_p=true: checkpoint_p=true: python kill_and_detach() Date: Thu, 11 Jan 2024 09:12:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org 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: Message-ID: In-Reply-To: References: 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=3D31203 --- Comment #13 from Sourceware Commits --- The master branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4ece39c56cfd= d5647d4061f3c084b9de6f9e443c commit 4ece39c56cfdd5647d4061f3c084b9de6f9e443c Author: Tom de Vries Date: Thu Jan 11 10:12:48 2024 +0100 [gdb/testsuite] Extend gdb.base/kill-during-detach.exp I ran into the following FAIL: ... (gdb) python kill_and_detach()^M Traceback (most recent call last):^M File "", line 1, in ^M File "", line 7, in kill_and_detach^M gdb.error: Selected thread is running.^M Error while executing Python code.^M (gdb) FAIL: gdb.base/kill-during-detach.exp: exit_p=3Dtrue: checkpoint_p=3Dtrue: \ python kill_and_detach() ... The FAIL happens as follows: - gdb is debugging a process A - a checkpoint is created, in other words, fork is called in the inferi= or, after which we have: - checkpoint 0 (the fork parent, process A), and - checkpoint 1 (the fork child, process B). - during checkpoint creation, lseek is called in the inferior (process = A) for all file descriptors, and it returns !=3D -1 for at least one file descriptor. - the process A continues in the background - gdb detaches, from process A - gdb switches to process B, in other words, it restarts checkpoint 1 - while restarting checkpoint 1, gdb tries to call lseek in the inferior (process B), but this fails because gdb incorrectly thinks that infer= ior B is running. This happens because linux_nat_switch_fork patches the pid of process B into the current inferior and current thread which where originally represen= ting process A. So, because process A was running in the background, the thread_info fields executing and resumed are set accordingly, but they = are not correct for process B. There's a line in fork_load_infrun_state that fixes up the thread_info field stop_pc, so fix this by adding similar fixups for the executing and res= umed fields alongside. The FAIL did not always reproduce, so extend the test-case to reliably trigger this scenario. Tested on x86_64-linux. Approved-By: Kevin Buettner PR gdb/31203 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31203 --=20 You are receiving this mail because: You are on the CC list for the bug.=