From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id VoMUFGn0QWZLdBAAWB0awg (envelope-from ) for ; Mon, 13 May 2024 07:07:21 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Fg9+QGD2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3F1E01E0C1; Mon, 13 May 2024 07:07:21 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 296B21E030 for ; Mon, 13 May 2024 07:07:19 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ABDF138708B9 for ; Mon, 13 May 2024 11:07:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABDF138708B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1715598438; bh=E+rmYJoVrdtxbaKz3R2a5+iuuo+BYzxsPDjwUQ0p9Dg=; h=References:In-Reply-To:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Fg9+QGD2Jr5k/V4lhGhAWSEF4a79/ZclKMHuuPgdrxJ7+gN0s7h9onJGVdQ1kEh2q d6sYxWkS4TRt4auS1maypkXuUeLPKDCzJYqvwOQwXxHuKdUfq/t27v6PPqay1KMMIZ LFC9naNkT4s8NJuIZ2hwKcrydVgIG4W1xZGurDhU= Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by sourceware.org (Postfix) with ESMTPS id 60DD93861893 for ; Mon, 13 May 2024 11:06:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60DD93861893 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 60DD93861893 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715598395; cv=none; b=qze2fnjWLiSsXRAIEU3KytbwvX/pgdblt7FgsSc316BPE/nyZ4z0l+YGXB9V3EkSLG+FcaEHv4fPftt6DHRaxUejCssTJSdbznw6/qZvrDkLDy0SBj+Z81UyC/J1YYuwP6nQaWtQHeqk2BrSqro0lKeqvROQX+i36LgtkSyTBu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715598395; c=relaxed/simple; bh=q7I1IO4UzWeLT81x93Kv8UQgQXwFYziYRChPkPlHlIs=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=gILEcKJ64rpKEPTQrmUoKY/cRsFGDgYcZCtnmT/PLYD93hBntxythv4ZY9FPvBa+Mu8WxvJvihJcHn8WH45f3KCqPODQEwvWFeb17Y3rLZfJu6qhm+0OXj6EQuBFG2UxhtWRFpqDpiGEAgz5tvxx0VkEvcqKT387KJ7aHlPjdac= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-23d23a6123eso1623030fac.1 for ; Mon, 13 May 2024 04:06:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715598392; x=1716203192; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E+rmYJoVrdtxbaKz3R2a5+iuuo+BYzxsPDjwUQ0p9Dg=; b=bBeJIx/tKEMCXvoxkiGiEFB8BTVxIb1cAUsehWt2ns9ZlPX/8qzYim22zXI0pUHsdc 8bTvqDiQFzrDhMDSbdzAkj2+DGEXuoK6jk7ogjiP99aDw0TxHTRYTUAPDubE3ChimrVz 5cczZTe6PuusVdblTIyQ4wUFahgUwDKFap0KAB5ESXaAbBGLCs64+ZZJo4/UbhpOayIj KW9zdz+8D4yrKTZP+bjsN5cZhhfvTfarpDdLb1/CJQIpAZE94oXLqcAmf3SjuAWj4VlN 56zIudY3bCLqrmz3FGJL89BlcPvF0If6bRlTpvPO9VbQGF1hMG3pbW2ryptYsL6RL+bK yk2A== X-Gm-Message-State: AOJu0Yy5/aOdz00CEmHwPZ7QXE+KvHRdbLf73x9h1gj1YZcFOAUD1w4I z4JLACNbBJ37NUbyWw9O39OeONfAIe3i/qbt7CNoffMlXVRrDbynE5NG37aq8RwjkKKAGH9ORUh Wvx0jwE/sqSc8EdlgLa2MM+mUAho= X-Google-Smtp-Source: AGHT+IFIFNiRletnrGD+09o0gW/4xKiylQ9eLD930ELHGKu964PSOp8wzUgmCk/LFaB8PL9BgZcxTeacfe+dbhKn860= X-Received: by 2002:a05:6870:9a06:b0:23f:2931:9f97 with SMTP id 586e51a60fabf-24172a9ca91mr11842282fac.28.1715598392040; Mon, 13 May 2024 04:06:32 -0700 (PDT) MIME-Version: 1.0 References: <1eba5c31-adc1-4b2b-a2a6-8f6a086d1a82@redhat.com> In-Reply-To: <1eba5c31-adc1-4b2b-a2a6-8f6a086d1a82@redhat.com> Date: Mon, 13 May 2024 16:36:20 +0530 Message-ID: Subject: Re: Error record and replay target doesn't support syscall number 435 To: Guinevere Larsen Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Navin P via Gdb Reply-To: Navin P Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" Hi, On Fri, May 10, 2024 at 7:29=E2=80=AFPM Guinevere Larsen wrote: > > On 5/10/24 05:07, Navin P via Gdb wrote: > > Hi, > > I tried to record a program calling C++ threads and then did a > > break on main , then record and continue it throws the error message > > "record and replay target doesn't support syscall number 435" . What > > should I do to support syscall number 435 ? > > Hi! > > I can't answer everything, since I'm not too familiar with syscalls > specifically, but I'll do my best! > > My first road bump with this is that we record that a clone has > happened, but we can only record the process that GDB is following > (parent or child, depending on follow-fork-mode). This is > counter-intuitive to me, since I would have expected the full inferior > to be replayed. To get this working you need minimum changes of current_inferior to for each inferior in all_inferiors() and execute that function for each inferior. return values have to be captured in a list. Similarly for each return valu= e you have to perform the actions in a loop. It is going to definitely slow down execution by orders of magnitude. Does any free software or paid versions of software capture segfault in fork on parent(P) and child (C) or something more nested than this? P->C->P int main(){ int i=3D0; int *p=3D&i; if(fork()=3D=3D0){ p=3Dnullptr; if(fork()!=3D0){ int z=3D*p+5; //segfault } else { int x; wait(&x); } } else { int x; wait(&x); } } > > > > I was thinking of adding amd64_sys_clone3 =3D 435 to amd64-linux-tdep.h > > In amd64-linux-tdep.c add case amd64_sys_clone3: return gdb_sys_clone3= ; > > In linux-record.h gdb_sys_clone3=3D541 in enum gdb_syscall > these 3 changes make sense to me > > In linux-record.c case gdb_sys_clone3=3Dbreak; > > > > I've created a pull request and verified that in record mode it starts and executes the threads but it doesn't break on the segfault in the thread. https://github.com/bminor/binutils-gdb/pull/11 > > -- > Cheers, > Guinevere Larsen > She/Her/Hers > > > > > Below is gdb log and after that is source code > > > > gdb ./a.out > > GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 > > Copyright (C) 2022 Free Software Foundation, Inc. > > License GPLv3+: GNU GPL version 3 or later > > This is free software: you are free to change and redistribute it. > > There is NO WARRANTY, to the extent permitted by law. > > Type "show copying" and "show warranty" for details. > > This GDB was configured as "x86_64-linux-gnu". > > Type "show configuration" for configuration details. > > For bug reporting instructions, please see: > > . > > Find the GDB manual and other documentation resources online at: > > . > > > > For help, type "help". > > Type "apropos word" to search for commands related to "word"... > > Reading symbols from ./a.out... > > (gdb) b main > > Breakpoint 1 at 0x134b: file race1.cpp, line 30. > > (gdb) r > > Starting program: /home/navin/cpp/a.out > > [Thread debugging using libthread_db enabled] > > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.= 1". > > > > Breakpoint 1, main () at race1.cpp:30 > > 30 int main(){ > > (gdb) record full > > (gdb) c > > Continuing. > > Process record and replay target doesn't support syscall number 435 > > Process record: failed to record execution log. > > > > Program stopped. > > clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:60 > > 60 ../sysdeps/unix/sysv/linux/x86_64/clone3.S: No such file or director= y. > > (gdb) shell uname -a > > Linux Navin-acer-5740 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 > > 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux > > (gdb) shell cat /etc/lsb-release > > DISTRIB_ID=3DLinuxMint > > DISTRIB_RELEASE=3D21.2 > > DISTRIB_CODENAME=3Dvictoria > > DISTRIB_DESCRIPTION=3D"Linux Mint 21.2 Victoria" > > (gdb) > > > > > > Source Code > > > > #include > > #include > > using namespace std; > > > > int g=3D0; > > int *p=3D&g; > > bool run=3Dtrue; > > > > void t1() > > { > > while(run) > > { > > g++; > > if(g=3D=3D16) > > p=3Dnullptr; > > > > } > > } > > > > void t2() > > { > > int z; > > while(run) > > { > > g--; > > z=3D*p+1; > > } > > } > > > > int main(){ > > thread x1{t1}; > > thread x2{t2}; > > sleep(5); > > run=3Dfalse; > > x1.join(); > > x2.join(); > > cout < > } > > > > > > > > Regards, > > Navin > > >