From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YGQVHAN2Z2czfygAWB0awg (envelope-from ) for ; Sat, 21 Dec 2024 21:14:27 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=default header.b=UDOi/NEU; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6F5BD1E097; Sat, 21 Dec 2024 21:14:27 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 autolearn=unavailable autolearn_force=no version=4.0.0 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 F2C471E091 for ; Sat, 21 Dec 2024 21:14:26 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4AE543858C54 for ; Sun, 22 Dec 2024 02:14:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AE543858C54 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=default header.b=UDOi/NEU Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 97FF13858C54 for ; Sun, 22 Dec 2024 02:12:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97FF13858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 97FF13858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734833568; cv=none; b=oBIPUd//yLH8Nl4PAQTC+Tub+gc5T9VTmJUPBHCk6yf18IMqlPaHV+9DGYIn5o7u7lw9D0OfCyYp9kj8ypPt6ntQBEnbIrfCc2fVtFkNuvV5NcgKd00y/FP0/pB6s51A1l7Y7cWB0v0mj4qKglRnedUhHoMr1WJwEmrz92Kr/Z4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734833568; c=relaxed/simple; bh=/Ne8r2+c1RDSSRf7Kl72TimwZeMpd1oHHA2EEg5xjBo=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=WfbW/62kQA5KT1CbKStBqtr1CQbw2KexT+uQTal9rUIX/tjK5EJTE4jWd85jHGcWTc6H7/ynrLTiv4X5IMEBOl4OENCKTjFX48UlUPA9Q/mpnBu4/R52KycQZLeIZZXhQvUmUgLDCmxII+g6RKHVxTxRB6eLe+y2zQyiHYeIXJI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97FF13858C54 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 4BM2ChYI089018 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 21 Dec 2024 21:12:47 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 4BM2ChYI089018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1734833568; bh=eo8Hyoe8vBNVqkvWIAh9Ia1GGoyLU+6Ylp8MQtXI5KA=; h=Date:Subject:To:Cc:From:In-Reply-To:From; b=UDOi/NEUkH220vlME6fX3YMFsd3iQEK5DGVAcd8GYQEpcSjA0vkf1FUgCJz7Amoj1 9feg0gB1/OFZTGRL1S3L5BXdWWXUFw7hM5uNd5wreF9q7kr2FG6oS7cc7sgtvNVxFm R7Pjvh5x6+GpkriMiF/FrHm4r7T1+FluD268s6q4= Received: by simark.ca (Postfix, from userid 112) id 09B7A1E0BB; Sat, 21 Dec 2024 21:12:43 -0500 (EST) Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id AEF981E091; Sat, 21 Dec 2024 21:12:36 -0500 (EST) Message-ID: <1ad29b94-a73f-4190-9ce8-7173cabf144d@polymtl.ca> Date: Sat, 21 Dec 2024 21:12:36 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb/jit: fix jit-reader linetable integrity To: Yang Liu , gdb-patches@sourceware.org Cc: tom@tromey.com References: <20241221083035.80249-1-liuyang22@iscas.ac.cn> Content-Language: en-US From: Simon Marchi In-Reply-To: <20241221083035.80249-1-liuyang22@iscas.ac.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sun, 22 Dec 2024 02:12:43 +0000 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 On 2024-12-21 03:30, Yang Liu wrote: > The custom linetable functionality in GDB's JIT Interface has been broken > since commit 1acc9dca423f78e44553928f0de839b618c13766. > > In that commit, linetables were made independent from the objfile, which > requires objfile->section_offsets to be initialized. However, section_offsets > were never initialized in objfiles generated by GDB's JIT Interface > with custom jit-readers, leading to GDB crashes when stepping into JITed code > blocks with the following command already executed: > > jit-reader-load libmygdbjitreader.so > > This patch fixes the issue by initializing the minimum section_offsets required > for linetable parsing procedures. I can imagine how the problem can manifest, but do you have a reproducer? I tried stepping with the binary of test gdb.base/jit-reader.exp, but I couldn't get it to crash. Ideally, this fix should come with a test to demonstrate the problem and the fix. > --- > gdb/jit.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gdb/jit.c b/gdb/jit.c > index 77d41bf86ba..7027c84b5bf 100644 > --- a/gdb/jit.c > +++ b/gdb/jit.c > @@ -665,6 +665,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb, > > objfile *objfile = objfile::make (nullptr, current_program_space, > objfile_name.c_str (), OBJF_NOT_FILENAME); > + objfile->section_offsets.assign (1, 0); I would suggest using push_back instead of assign. Everybody knows push_back, whereas I had to look up what assign does, I guess I'm not the only one. Simon