From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id RWBEKciPAmkcfRAAWB0awg (envelope-from ) for ; Wed, 29 Oct 2025 18:06:00 -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=nKu2Xv58; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9242B1E0BC; Wed, 29 Oct 2025 18:06: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=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED 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 AE3721E04C for ; Wed, 29 Oct 2025 18:05:59 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E706B3858C40 for ; Wed, 29 Oct 2025 22:05:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E706B3858C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1761775558; bh=ZhHehnI1x+gdW2g5G63BqCXTrZ97dlXH05P6Rl/870U=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nKu2Xv58BvlqLhCKIl+6rcJq22SchTzwUJw1n8ceE2Flv756WqclsDVSqmImmf/up BsuX4h466pph+W/LJzlisdaVTQkRd2no6YXUeulaowg7e5URLFemI8EH21auxrmXt5 QH2b6o6t4q0GhPUh/3oPTdTOWWK29Xt0mwA4QeKU= Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 02CE53858D20 for ; Wed, 29 Oct 2025 22:05:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 02CE53858D20 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 02CE53858D20 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761775513; cv=none; b=m9ivgqhHrw5i14W9zkXZnrfQ7kOY8ggnZ8zHcHBKnT9pZb4DWR4J5XmfbtMryIa/fc95MRDvbcrokqDaxx8wBCw4QWKOf1Fqfj7cvn4Al7KLIzzAkoORmqWn197h+ir2pnKoBaWzpseQg6Y0XnReWBMvTh/bv9LigZ/zT+kAlAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761775513; c=relaxed/simple; bh=C2LVXKsE0nJW4YXV2W589JriklBul9QJwGawwAe1yN0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=QY7pVOlqEaR00Ju0Mus0WGcSBGQhpHdnkwEwPb6MxvhdaoLnxFnbL54FkgilCbZ+5cKM2g7tdYJElgXQczz7Ff6dmQA7jeIGoJ2+s9b+SO4IJd9qGoiV0uoBnIL6VxsTvn+3esGprx9vOUtNElPEoBIAeI7vcW/a8syuBvYrpbA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02CE53858D20 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-475ca9237c2so1959155e9.3 for ; Wed, 29 Oct 2025 15:05:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761775512; x=1762380312; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZhHehnI1x+gdW2g5G63BqCXTrZ97dlXH05P6Rl/870U=; b=W26d9JqeUxpFB4eKlKTbx5veHFMTJDAqqgcF4UUwQ9plalQm2d9PDb99M44yvR2uY0 86nMBe0LBIRIamQ0cV77f+dxz5pRwb198gme0/l9vIdrAj89LodksL3vjpl9yBFZAUFo WMew5hXM+Hhb8pcWlmp6Qr4eKgqbfiN4MvLJbbed3aBWFgws7mIiBvgAzM8LpiTei0qx 8D0XN1WpQSkdBiIvbd+Fm8iSdrZ8kiWbnS5+2rplSOhGK2fNeJ9CwOCh1XS1qjMTUucS dv2+5OlXFvH2R/YtbhGPjtkCf09vbNUq2SnwHGHhs+UlWAJ5jX/JPzc1jAXja/hnVgw9 dixQ== X-Forwarded-Encrypted: i=1; AJvYcCVYgbMk1jXJbiudoZYzSRw483MquqptQhuoTFRfmbcxvmESwMkSjHcwDHRMm5Ud4+Q68RM=@sourceware.org X-Gm-Message-State: AOJu0Ywr8gpVTt1fULi1IOGxNQzZUjjNOMAyE7meuNPINZ3vbEG64/i1 rWf/hr1OjqpLTZ1DBElu7mRvFrUVxA+t2KS6h5WePRcNG27i+V0A7chn3iVqPg== X-Gm-Gg: ASbGnctHrMyDoAbyJwMmRDXVTAMyXQdKFNXW/Z+zBuhLdYzJldRfZTPWIEoSqkMdMSK MuwJAx4E9tOde2NfDmTBy9zAABKwd+etxK32aCS56JQeBtZZMEg6JT8E8FjCrGSJ9i/JbKVSrUH 0EPxj5Eh1yjwxpgcH5ySlmd91R7E4oq7QigKbjQ5gcgFupi75QrAFMUFHE4ERpgjNS0ghkElNVP q+9PGWDi7LewHsW3fDcytOIdKM+F0S5jvpMVvgLpwwtdVb0WfNTxiHGQvsWhqKTUmdMv95cNdy9 8KVMX/8KBoZmkpDs0bgqYjQl1QZlISCcYKGkwSVqVAnOkKJQWMbNnJ6UuGKZqtU5q1YOEM0W+Ji P5b2yDhYg+chsCdUsBYoHcWkdam+yxiYO+7g6kN2ceO0Yns6v+JLAZ/hdid+f32HGtD7RSXPZRU 4XAvWaj2Ba17Uw X-Google-Smtp-Source: AGHT+IHdXh8TDbIQmR/fyho6xP1P6JU0P3xybIlv76kfInh6lu/41IVRMsSwm3HkFtQH9JxWFcboLQ== X-Received: by 2002:a05:600c:5250:b0:46d:9d28:fb5e with SMTP id 5b1f17b1804b1-4771e16e471mr42881285e9.5.1761775511615; Wed, 29 Oct 2025 15:05:11 -0700 (PDT) Received: from [192.168.0.38] ([86.12.216.189]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771843eabfsm52550015e9.2.2025.10.29.15.05.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Oct 2025 15:05:11 -0700 (PDT) Message-ID: <28e28163-fdb3-4726-849a-79ab4cf2fb5e@gmail.com> Date: Wed, 29 Oct 2025 22:05:09 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: test gdb as it runs qemu simulator To: "Mock, George" , "gdb@sourceware.org" References: <938d2b5574b94d9584b758eee3c0c064@ti.com> Content-Language: en-US In-Reply-To: <938d2b5574b94d9584b758eee3c0c064@ti.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: Luis via Gdb Reply-To: Luis Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" Hi George, On 29/10/2025 20:21, Mock, George via Gdb wrote: > Hello! > > I work on a team that implements C/C++ cross compilers. Among other combinations, one cross compiler runs on Linux and generates code for RISC-V systems. I want to use the gdb testsuite. Not for the purpose of testing gdb, but to test whether the Dwarf generated by our compiler works with gdb. I need to test gdb while it controls execution of code running under a qemu simulator for RISC-V. > > The following shows a typical way, from Linux, to interactively use gdb on one program. > > # In one process > $ qemu-riscv32 -g 1234 riscv-program > > # In a different process > $ riscv32-unknown-elf-gdb riscv-program > (gdb) target remote localhost:1234 > (gdb) # typical gdb commands go here > > The option -g 1234 tells qemu-riscv32 to start gdbserver and wait for communication through port 1234. > > I have some familiarity with testing gdb. I learned how to build and test it for Linux. I built riscv32-unknown-elf-gdb, and I can interactively watch it work. I know how to configure the testsuite to build with our cross compiler. But I cannot find the configuration (I presume some combination of a board file and command line options) which causes the testsuite to interface with qemu-riscv32 in a manner similar to that interactive example. > > While I would appreciate a fully fleshed out solution, I'm sure that is too much to expect. I suspect many have done this before me, but none of my many searches have found the blog post (or whatever) which shows how they did it. You're right that this has been done before, but the extra code/framework required unfortunately never made its way upstream. It might still exist in some company's internal repo. The most important part is probably a dejagnu/TCL board file for user qemu (a qemu that acts as a gdbserver-like debugging stub). The complexity there is you'll need to implement/override the required TCL functions that can handle firing up QEMU, connecting to it, shutting it down for each testcase (or maybe just keeping a stable qemu running, but with a reset after each testcase) and the related quirks. If you're looking at implementing and contributing it (which would be very much appreciated) a good starting point is the gdbserver files in gdb/testsuite/config/gdbserver.exp, gdb/testsuite/boards/gdbserver-base.exp, gdb/testsuite/boards/native-gdbserver.exp and gdb/testsuite/lib/gdbserver-support.exp (you may be able to reuse some of the functions here). > > I'd appreciate any light you can shed. > > Thanks and regards, > > -George Mock >