From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id b3H5MIyM92dXIC4AWB0awg (envelope-from ) for ; Thu, 10 Apr 2025 05:17:00 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Gy8E9e3T; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BA03E1E0C3; Thu, 10 Apr 2025 05:17:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 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 758E51E05C for ; Thu, 10 Apr 2025 05:16:59 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0F8273839C55 for ; Thu, 10 Apr 2025 09:16:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F8273839C55 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Gy8E9e3T Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 49ED53858429 for ; Thu, 10 Apr 2025 09:16:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49ED53858429 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 49ED53858429 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744276577; cv=none; b=fzTCRZjWzN/EYERtBpRSTsr0mAvRD3PtlqB0pQM73QLgp9fz6Bw2ywLb2CXlpdXWUTIDd2DGlItyVHBQoXjLjg9oJC30w3gNgX8tJurVj14pIDS5pFSuAspZTmaBvnPfcj8UL6UuDJw6A+aXz92r+5yBfwvPNuTKA+B0vYXIurk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744276577; c=relaxed/simple; bh=w6ioWnliukFMGu7n/EC5VwBg+Njc9hwjqLBeN4PzlsE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vXdFUbAVmFNyg/M7z3BlvqAOyJfBF5TWJMwjtZGxmLwKdrtDqXBm1ujnIdOoglsFOHlYsZ+F55FdfpP6b0EcfrQZEYziQsWZNvdMvLY+G0/dsyxxV1S1Z5PyWC6wr2m5xJxcvhlh9X1PskHP2Q0DIstgO39wX1QhaFxT4p/j/7k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49ED53858429 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744276577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=t+THWjREwaj9zBLUV7EXe2ZAssX98EogpVY82Z9f6Dg=; b=Gy8E9e3TyieEajTtPNHBrPPHF+3QRhPWz9L2bnHXAW21KS0kUgJFN4h5sgL+h3kQM1iERu HikH9I9E71h5q/BetNzvBYX42kdXQfgciwwWBUQn6DJ+iLqXQmchHFNI+Oxh66q7s7W209 k041rbvtSBPJg8RlDkct+MQGD0t343o= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-416--yKeXBzJMYq7nukmB24B7g-1; Thu, 10 Apr 2025 05:16:14 -0400 X-MC-Unique: -yKeXBzJMYq7nukmB24B7g-1 X-Mimecast-MFC-AGG-ID: -yKeXBzJMYq7nukmB24B7g_1744276573 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-39131851046so211820f8f.0 for ; Thu, 10 Apr 2025 02:16:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744276573; x=1744881373; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t+THWjREwaj9zBLUV7EXe2ZAssX98EogpVY82Z9f6Dg=; b=bUfGPp7AwCHQMfEgXkBtKmKsbvhO7Anp8kedw8Jo1iVKLBnahLzm18oLIMmaOS3KV3 IcrHagkAKafMTrSo0XQ23dPpte3R0HjmUf0tDbwK1QHjtY7yZiggTHtJ/Jl8f9jY7TJG Un6czPU0v3XrXyM3rJrLrRwNt1ZhmGsqOWnKgwhYHjYaWa0UBlLfkvoyud1vJR4IEv6V WDqEKfbgNQLaDIDiv0Sh9YeFwVzPxgJIzqRLCqPZdbFwrhCvamteIW9IHTvY4ZRn+g/A BoLlHVe9sC26QbSizj4IL6wb/dceUFk+SKybu/hvq80vgiblbovXaN4ECia0ghu3g89y Q4DQ== X-Forwarded-Encrypted: i=1; AJvYcCWs98X/8/Cme7esYndtEU2CTa0J8eenM7KZQx8/pjh+TXyllwlNghliH3UZ1A8FNelCLuA9Q/bZG9a28Q==@sourceware.org X-Gm-Message-State: AOJu0Yxayt6PFB4uyCZHA+6ddZefKijO/YZfxSRHB5kIcFo7XzBda7ky +K7sCs403oznQh5f+fPucJsdh5v6axmhRQWucmTxGOA0pZDaezK0DxZ/Bfra9eNXNWEY9X2XdSZ ZhCrURpaFqw7Yf4TtqxhnqCnMkDrThImHpPLZSps+b7WnRBXO7t6lz9zyZU4= X-Gm-Gg: ASbGncvyCvK8TKwu8WDhEbLtRz/Qc+lOwgimiQtknl8iQ/1RIVdjSWrFVTrSN5adYxf cFvXQPFyJdRmyNDh6SJBVGd8jX3QkE0TTKZXbR0PkZp5M461BqieKzgDqr+9zryp2g0EWAXg86R 4ALHG8Uv0aDgpowxJSE/5kMTpk8sp4L7+8Y8hjlwWL7bkKau2DuF3cSDrXiQuM+vRn+6HqbC3p/ HScsly/GhrTbN8XIVE1CiP/zqvHC9OoSkgwX22AcJHUPrNSLvpm2RTcGt6dVMoQQRlIJONrTDqi FkSTDE0E8RerDn//NxC5hd3CQDdSQ0a1IHi8 X-Received: by 2002:a05:6000:402b:b0:390:f460:77b0 with SMTP id ffacd0b85a97d-39d8fd51bc3mr1443958f8f.26.1744276573263; Thu, 10 Apr 2025 02:16:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDhnyZdB8r5Ys4OdpTwE+coxsZ0fqZrODoWrXRaLEcMaQdSupdho4LDEurSMiHE1MRRldOQw== X-Received: by 2002:a05:6000:402b:b0:390:f460:77b0 with SMTP id ffacd0b85a97d-39d8fd51bc3mr1443928f8f.26.1744276572849; Thu, 10 Apr 2025 02:16:12 -0700 (PDT) Received: from localhost (30.226.159.143.dyn.plus.net. [143.159.226.30]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39d89362fcbsm4075454f8f.5.2025.04.10.02.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 02:16:12 -0700 (PDT) From: Andrew Burgess To: Timur , gdb-patches@sourceware.org Cc: guinevere@redhat.com, Timur Subject: Re: [PATCH v8] This commit adds record full support for rv64gc instruction set In-Reply-To: <20250318184944.351874-1-timurgol007@gmail.com> References: <87ikodx9a8.fsf@redhat.com> <20250318184944.351874-1-timurgol007@gmail.com> Date: Thu, 10 Apr 2025 10:16:11 +0100 Message-ID: <875xjce5r8.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: T2aA2wAm1a9ccIxHArFOKy-UUzLp6C3LFuJAfbnKgHU_1744276573 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Hi Timur, I think this is looking great now. I do have a couple of minor follow on questions/points, but I think this is almost done. Thanks for all your work getting this ready for merging. Notes are inline below... Timur writes: > It includes changes to the following files: > - gdb/riscv-linux-tdep.c, gdb/riscv-linux-tdep.h: adds facilities to record > syscalls. > - gdb/riscv-tdep.c, gdb/riscv-tdep.h: adds facilities to record execution of > rv64gc instructions. > - gdb/configure.tgt: adds new files for compilation. > - gdb/testsuite/lib/gdb.exp: enables testing of full record mode for RISC-V > targets. > - gdb/syscalls/riscv-canonicalize-syscall-gen.py: a script to generate > function that canonicalizes RISC-V syscall. This script can simplify support > for syscalls on rv32 and rv64 system (currently support only for rv64). To > use this script you need to pass a path to a file with syscalls description > from riscv-glibc (example is in the help message). The script produces a I guess riscv-glibc is a fork of glibc that is running ahead of the upstream glibc project? Is there any reason that this cannot work with the official glibc project? That would be preferable I think unless there's a compelling reason, which ideally we'd document. I tried running the script using current HEAD of glibc, the only significant change is: diff --git i/gdb/riscv-canonicalize-syscall-gen.c w/gdb/riscv-canonicalize-syscall-gen.c index 3749fc32f33..03579984f4a 100644 --- i/gdb/riscv-canonicalize-syscall-gen.c +++ w/gdb/riscv-canonicalize-syscall-gen.c @@ -270,7 +270,7 @@ riscv64_canonicalize_syscall (int syscall) case 239: return gdb_sys_move_pages; /* case 240: return gdb_sys_rt_tgsigqueueinfo; */ /* case 241: return gdb_sys_perf_event_open; */ - /* case 242: return gdb_sys_accept4; */ + case 242: return gdb_sys_accept4; /* case 243: return gdb_sys_recvmmsg; */ /* case 258: return gdb_sys_riscv_hwprobe; */ /* case 259: return gdb_sys_riscv_flush_icache; */ There was also a bunch of new syscalls that are added, but commented out. I haven't tried to figure out if the change above is a bad thing or not though, maybe you could advise. > diff --git a/gdb/NEWS b/gdb/NEWS > index 964183910dc..20fdb571047 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -9581,3 +9581,5 @@ GDB now handles cross debugging. If you are remotely debugging between > two different machines, type ``./configure host -target=targ''. > Host is the machine where GDB will run; targ is the machine > where the program that you are debugging will run. > + > + * Add record full support for rv64gc architectures This entry needs to move to the correct section of the NEWS file. If you look for the lines starting '***' you'll see that the first header is '*** Changes since GDB 16', this is the section where you should place your entry, probably just before the '* New commands' line. > diff --git a/gdb/riscv-linux-tdep.h b/gdb/riscv-linux-tdep.h > new file mode 100644 > index 00000000000..0f481b168d1 > --- /dev/null > +++ b/gdb/riscv-linux-tdep.h > @@ -0,0 +1,29 @@ > +/* Copyright (C) 2024-2025 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#ifndef RISCV_LINUX_TDEP_H > +#define RISCV_LINUX_TDEP_H These include guards need to be renamed to GDB_RISCV_LINUX_TDEP_H. You can do this automatically if you like with: ./gdb/check-include-guards.py --update gdb/*.h > + > +#include "linux-record.h" > + > +/* riscv64_canonicalize_syscall maps from the native riscv Linux set > + of syscall ids into a canonical set of syscall ids used by > + process record. */ > + > +extern enum gdb_syscall riscv64_canonicalize_syscall (int syscall); > + > +#endif /* RISCV_LINUX_TDEP_H */ > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 410f99e3350..b048ac7078b 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -3718,7 +3718,8 @@ proc supports_reverse {} { > || [istarget "i\[34567\]86-*-linux*"] > || [istarget "aarch64*-*-linux*"] > || [istarget "powerpc*-*-linux*"] > - || [istarget "s390*-*-linux*"] } { > + || [istarget "s390*-*-linux*"] > + || [istarget "riscv*-*-*"] } { I notice that every other entry in this list restricts the match to Linux based targets. Is RISC-V really different here? Or should RISC-V be similarly restricted? Thanks, Andrew