| Message ID | 20241222163153.11297-1-liuyang22@iscas.ac.cn |
|---|---|
| State | New |
| Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F24F385840E for <patchwork@sourceware.org>; Sun, 22 Dec 2024 16:33:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F24F385840E X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from cstnet.cn (smtp21.cstnet.cn [159.226.251.21]) by sourceware.org (Postfix) with ESMTPS id 741643858C35 for <gdb-patches@sourceware.org>; Sun, 22 Dec 2024 16:32:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 741643858C35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=iscas.ac.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 741643858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=159.226.251.21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734885175; cv=none; b=hjnIFV/fO5pRKaFU/jLqHeGs1sGfD5iYvR3MN6aDTHKvWi5DSLV1j6PnbpD4eWX0gzpZQw4OQAkbysJiK6+k7jJOmafNEq0zPm4cYrIDY58W+1FrZbbGUwRhU8nnJVSzHgPDsVBTQu2h63y+4JCdJMwOVSdo/0zhNQlCJTwbzOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734885175; c=relaxed/simple; bh=jbcc7IiqaNbsPoEjLBREc2zieEQA9ljIz6kTMygDfrU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=cN4O//UE6LdTG5UJlXRirfueWJWLPUYYfdcaqO11m9ASohW2j1R2Gx34GWYHMTo9+hVOFZreAqnhHRNvU15XNvc3MUWX5CuMcVWmp+dVffi4CHtk9QsUdJeW7J1Ks9BGNTa7UimmqzpJdJ5nG6T+WM/VYrzhz008B94V/9IH84U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 741643858C35 Received: from localhost.localdomain (unknown [113.120.165.207]) by APP-01 (Coremail) with SMTP id qwCowAD3_tIuP2hnCZ5fAw--.16463S2; Mon, 23 Dec 2024 00:32:48 +0800 (CST) From: Yang Liu <liuyang22@iscas.ac.cn> To: gdb-patches@sourceware.org Cc: tom@tromey.com, simon.marchi@polymtl.ca, Yang Liu <liuyang22@iscas.ac.cn> Subject: [PATCH] gdb/jit: fix jit-reader linetable integrity Date: Mon, 23 Dec 2024 00:31:53 +0800 Message-ID: <20241222163153.11297-1-liuyang22@iscas.ac.cn> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: qwCowAD3_tIuP2hnCZ5fAw--.16463S2 X-Coremail-Antispam: 1UD129KBjvJXoWrury5CF1UWFyrXF1DGF48JFb_yoW8Jr48pF n8u3y3KryrGryfAwnrtaykZFy09ryqgFy3XrW8W348Ar4UXFyvqFWjyr13Wa4xAr4vyr4j qFn0yrWUZrZ8ZFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkG14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8JV W8Jr1lnxkEFVAIw20F6cxK64vIFxWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xv F2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r 4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I 648v4I1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67 AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIY rxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14 v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x0JUq-erUUU UU= X-Originating-IP: [113.120.165.207] X-CM-SenderInfo: 5olx5tdqjsjq5lvft2wodfhubq/ X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, 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-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
gdb/jit: fix jit-reader linetable integrity
|
|
Checks
| Context | Check | Description |
|---|---|---|
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Build passed |
Commit Message
Yang Liu
Dec. 22, 2024, 4:31 p.m. UTC
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. --- gdb/jit.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
Sorry, forgot to put a v2 in the title, please ignore this one. On 2024/12/23 00:31, 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. > --- > gdb/jit.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gdb/jit.c b/gdb/jit.c > index 77d41bf86ba..21c17c145c9 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.push_back (0); > + objfile->sect_index_text = 0; > objfile->per_bfd->gdbarch = priv_data->gdbarch; > > for (gdb_symtab &symtab : obj->symtabs)
diff --git a/gdb/jit.c b/gdb/jit.c index 77d41bf86ba..21c17c145c9 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.push_back (0); + objfile->sect_index_text = 0; objfile->per_bfd->gdbarch = priv_data->gdbarch; for (gdb_symtab &symtab : obj->symtabs)