From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id A935138378D4 for ; Wed, 14 Dec 2022 03:34:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A935138378D4 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca 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 2BE3YhTp029124 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 22:34:47 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2BE3YhTp029124 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1670988887; bh=mb+dHXU2onq+wTzB69BT4RA8c7Sbg/D5sycf/EFMvtk=; h=From:To:Cc:Subject:Date:From; b=g9VbXpcrN4EgF3sZbtuo8TIT4MgLGjrPiVCz3aGSGmk/s/13L+ptjQXvXoLMcyCYO oLhb90/rvxDunXdMd8d51NlPg/iz9LwOk1Qn9CAGhO8CD9pAIbZIsGiPMT7fQuSj90 YYU0Xh/3LB4c/iLlfiAsXVSI0V8fm856G2buih/M= Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CE00E1E0CD; Tue, 13 Dec 2022 22:34:42 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 00/13] Make frame_info_ptr automatic Date: Tue, 13 Dec 2022 22:34:28 -0500 Message-Id: <20221214033441.499512-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 14 Dec 2022 03:34:43 +0000 X-Spam-Status: No, score=-3183.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 List-Id: This is v2 of: https://inbox.sourceware.org/gdb-patches/20221202180052.212745-1-simon.marchi@polymtl.ca/ The first main change is that I dropped the patch removing the user of frame_info_ptr at many places, following Tom's comment. If we end up trying to reinflate a frame at a moment where it's not possible (because the frame's id is being computed), we'll hit an assert in frame_info_ptr. This is fine, because it indicates some logic problem in GDB. The second main change, found after doing the first one, is to fix a bug with the user-created frame reinflation. In v1, if we had two frame_info_ptr wrapping the same user-created frame_info object, they would each create their own frame_info instance on reinflation. And that confused GDB down the line. There are a few new patches to deal with that, by adding user-created frames to the frame stash, so they can be found by frame_info_ptr when reinflating. At the end of the series, frame_info_ptr::frame_info_ptr (at the end of the series) accesses some frame_info internals (the frame's id, without calling get_frame_id), so I decided to move frame_info_ptr to frame.{c,h} (patch 6). I think that makes sense anyway, as the logic in the implementation of frame_info_ptr is tightly coupled to the rest of the frame stuff. However, to do so, we need to break some inclusion cycles. This is done in the few patches before. Patches 1 and 2 are not strictly necessary, but fix oddities I found along the way. Regression-tested on Ubuntu 22.04 x86-64. Simon Marchi (13): gdb: move type_map_instance to compile/compile.c gdb: move compile_instance to compile/compile.h gdb: remove language.h include from frame.h gdb: move sect_offset and cu_offset to dwarf2/types.h gdb: move call site types to call-site.h gdb: move frame_info_ptr to frame.{c,h} gdb: add frame_id::user_created_p gdb: add user-created frames to stash gdb: add create_new_frame(frame_id) overload gdb: make it possible to restore selected user-created frames gdb: make user-created frames reinflatable gdb: make frame_info_ptr grab frame level and id on construction gdb: make frame_info_ptr auto-reinflatable gdb/Makefile.in | 2 +- gdb/aarch64-tdep.c | 1 + gdb/amd64-tdep.c | 1 + gdb/arm-tdep.c | 1 + gdb/c-lang.c | 1 - gdb/c-lang.h | 2 + gdb/compile/compile-c.h | 1 + gdb/compile/compile-cplus.h | 1 + gdb/compile/compile-internal.h | 129 ------------ gdb/compile/compile.c | 13 ++ gdb/compile/compile.h | 116 +++++++++++ gdb/cp-abi.c | 1 + gdb/cp-support.c | 1 + gdb/dwarf2/abbrev-cache.h | 1 - gdb/dwarf2/attribute.h | 2 +- gdb/dwarf2/call-site.h | 244 +++++++++++++++++++++++ gdb/dwarf2/comp-unit-head.h | 5 +- gdb/dwarf2/cooked-index.h | 2 +- gdb/dwarf2/expr.h | 2 +- gdb/dwarf2/line-header.h | 2 - gdb/dwarf2/types.h | 40 ++++ gdb/expop.h | 1 + gdb/f-lang.h | 1 + gdb/frame-id.h | 4 + gdb/frame-info.c | 65 ------ gdb/frame-info.h | 211 -------------------- gdb/frame.c | 127 ++++++++++-- gdb/frame.h | 206 ++++++++++++++++++- gdb/gdbtypes.h | 229 --------------------- gdb/gnu-v3-abi.c | 1 + gdb/go-lang.h | 1 + gdb/infcmd.c | 2 - gdb/language.c | 1 - gdb/m2-typeprint.c | 1 + gdb/mi/mi-cmd-stack.c | 2 - gdb/ppc-sysv-tdep.c | 1 + gdb/python/py-disasm.c | 1 + gdb/python/py-frame.c | 1 + gdb/stack.c | 16 -- gdb/symtab.c | 1 + gdb/symtab.h | 1 + gdb/testsuite/gdb.base/frame-view.c | 80 ++++++++ gdb/testsuite/gdb.base/frame-view.exp | 109 ++++++++++ gdb/testsuite/gdb.base/frame-view.py | 41 ++++ gdb/thread.c | 1 + gdb/unittests/frame_info_ptr-selftests.c | 76 +++++++ 46 files changed, 1065 insertions(+), 683 deletions(-) create mode 100644 gdb/dwarf2/call-site.h create mode 100644 gdb/dwarf2/types.h delete mode 100644 gdb/frame-info.c delete mode 100644 gdb/frame-info.h create mode 100644 gdb/testsuite/gdb.base/frame-view.c create mode 100644 gdb/testsuite/gdb.base/frame-view.exp create mode 100644 gdb/testsuite/gdb.base/frame-view.py create mode 100644 gdb/unittests/frame_info_ptr-selftests.c base-commit: a4b83845ded201e7d46220213d3e38950c30dbb5 -- 2.38.1