From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id VnlZEnARQmaMiRAAWB0awg (envelope-from ) for ; Mon, 13 May 2024 09:11:12 -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=nQOo/tNo; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3809E1E0C1; Mon, 13 May 2024 09:11:12 -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 1DCB61E030 for ; Mon, 13 May 2024 09:11:10 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7825A3844028 for ; Mon, 13 May 2024 13:11:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7825A3844028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1715605869; bh=icffkQ/YcIZNSroTeRxt72/evBsd24iqMGVXo7y6aCI=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=nQOo/tNo2bJkgYfxaVW+Gq1l5AarUQir+BxvZU2gizx7ccGlIC7MC/5CTHWnAgoDa vsRazIo8XSqSi7hmfzuprpthj/p52cXdy1zHGb4QW7lpzh5JvIKWMw/ebNo06lvlad VkEoJSd4wVxkarvTTI4h71Lpa/7uqr8bUVCs8w8g= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D9F5D3858432 for ; Mon, 13 May 2024 13:10:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D9F5D3858432 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D9F5D3858432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715605832; cv=none; b=NJ3R5kYIynPJ7DKpbFweQXdN9gMl2D51/PKXLeXecPttRuQX0eTY7tM0EhyPDYiGS/hFHmM9o36zw3XttF2+rWmlgA8w262khii/IJYQhi9sbqkM7SzYsRSHMeYhLrtZgHz6OpbisxY3fABx9webJAoZpw+cCSRTIk1kUHyrQwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715605832; c=relaxed/simple; bh=MlYYALKvpmLy7AN1Fn1cmVTAZbCnxvV1kXbQ/mf/vg4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Im5mrKZFyXw6NR33UmR1TniGj7ZOP6J8MNAXkoPrBK2ICuvrZfxCx4Ra1CdiIwPAqeNIVqzvWo93wOl6epce9XVxRk38chqv9fqCu3tZJICkCSh56pS/Z2U4viUYBYk70RxWxYaXRbHmTUjnR2l+b1kUdep5211FylvnSimwoxE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-eIKJsDsaO3WmfHC7GcMP6w-1; Mon, 13 May 2024 09:10:28 -0400 X-MC-Unique: eIKJsDsaO3WmfHC7GcMP6w-1 Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-6f452eb2035so4112733b3a.0 for ; Mon, 13 May 2024 06:10:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715605827; x=1716210627; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=icffkQ/YcIZNSroTeRxt72/evBsd24iqMGVXo7y6aCI=; b=jlL4QCGF65HaFP4r6EudHXwoB3SiX4QyQ7R0sv5Go1QL24c6D4jmgKPj8G1GZTtEyt x0GdnuDLY8geAei8R4lEEqbhGdjfaFvi+C+wlM0YQcgFArjW8AkqP0YxYgFWrdsW5LJm iu4jeY9cBCg7+rbn5K4TzI1zxdWnV5IcdlEUVW+aV54VoH4+N4/pA4RUCj1HSQWysq0K pZ+pqAJNLbMgnNmztSOUZtpn+9rQpiS9tKydsgae78tGEaQ+PQUo2cMGqLYb8NU9dTdc fUSzM+2j4O/ZHcCPFZCQrVjWKbMZ+Kg5/20kOQ2Ls/+Fn5bgpXBv0BGOd7NYvPcrPd6b MwAw== X-Gm-Message-State: AOJu0Ywyj1KQkpQpEq6GGsGKrYNtuLP1BEUaLZH3OGp86p83QbKQzJ3N AVwRirOHM+YXwPpxhwA3d9N9D15++8JXqjiT+6alAeOT4G1Rbxz5zIazUXIIPYiZD5ThUOYk1sW RgEmX2j3RaSf/u4TAJGnFJbMvfE6oXM0FjaV+RvgrNuCNdvHV X-Received: by 2002:a05:6a00:989:b0:6ec:fdcd:18eb with SMTP id d2e1a72fcca58-6f4e036b729mr10587532b3a.21.1715605826887; Mon, 13 May 2024 06:10:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1rZb4wFSZVeg6Md0/l/Y8KLgWzn2tC7IV2kI5dsa6MQYQzor1s0T7BspS9/NvZPraED7+Ow== X-Received: by 2002:a05:6a00:989:b0:6ec:fdcd:18eb with SMTP id d2e1a72fcca58-6f4e036b729mr10587490b3a.21.1715605826193; Mon, 13 May 2024 06:10:26 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:92c5::1000? ([2804:14d:8084:92c5::1000]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2ae0f05sm7307597b3a.137.2024.05.13.06.10.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 May 2024 06:10:25 -0700 (PDT) Message-ID: Date: Mon, 13 May 2024 10:10:22 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Error record and replay target doesn't support syscall number 435 To: Navin P Cc: gdb@sourceware.org References: <1eba5c31-adc1-4b2b-a2a6-8f6a086d1a82@redhat.com> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham 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: Guinevere Larsen via Gdb Reply-To: Guinevere Larsen Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" On 5/13/24 08:06, Navin P wrote: > Hi, Hi! :) > > On Fri, May 10, 2024 at 7:29 PM 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 value > you have to perform the actions in a loop. There is an extra complication, the recording subsystem was added before GDB could handle multiple inferiors, so it works on the assumption that you only need one global history. Meaning if we did record for all inferiors or all processes, the history would be mangled, jumping from one inferior to the next. It is already a problem in handling multi-threaded inferiors, so a proper fix would require having a per-thread history, and possibly some way to serialize the execution. I added the explanation more as a motivator to why I think we should warn the user of the counter-intuitive behavior, at least in the documentation. > It is going to definitely slow down execution by orders of magnitude. Absolutely! I'm almost wondering if we should try to spawn a recording thread per process or thread, to at least make multi-threaded recording not worse. But that is far in the future, unrelated to this change > 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 I'm unaware of any, but also GDB is the only debugger I ever really used, so there may be something out there. > int main(){ > int i=0; > int *p=&i; > if(fork()==0){ > p=nullptr; > if(fork()!=0){ > int z=*p+5; //segfault > } else { > int x; > wait(&x); > } > } else { > int x; > wait(&x); > } > } > > > >>> I was thinking of adding amd64_sys_clone3 = 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=541 in enum gdb_syscall >> these 3 changes make sense to me >>> In linux-record.c case gdb_sys_clone3=break; >>> >>> > 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 I can take a look at it as is, but that github repo is just an unofficial mirror. The proper way to submit changes is to send your patch to gdb-patches@sourceware.org, and we'll do proper review through email. -- Cheers, Guinevere Larsen She/Her/Hers > > >> -- >> 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 directory. >>> (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=LinuxMint >>> DISTRIB_RELEASE=21.2 >>> DISTRIB_CODENAME=victoria >>> DISTRIB_DESCRIPTION="Linux Mint 21.2 Victoria" >>> (gdb) >>> >>> >>> Source Code >>> >>> #include >>> #include >>> using namespace std; >>> >>> int g=0; >>> int *p=&g; >>> bool run=true; >>> >>> void t1() >>> { >>> while(run) >>> { >>> g++; >>> if(g==16) >>> p=nullptr; >>> >>> } >>> } >>> >>> void t2() >>> { >>> int z; >>> while(run) >>> { >>> g--; >>> z=*p+1; >>> } >>> } >>> >>> int main(){ >>> thread x1{t1}; >>> thread x2{t2}; >>> sleep(5); >>> run=false; >>> x1.join(); >>> x2.join(); >>> cout <>> } >>> >>> >>> >>> Regards, >>> Navin >>>