From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 29CF13858D28 for ; Thu, 29 Sep 2022 07:01:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29CF13858D28 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-298-eRO5Dd6ON1qCVRnGhEDqHw-1; Thu, 29 Sep 2022 03:01:45 -0400 X-MC-Unique: eRO5Dd6ON1qCVRnGhEDqHw-1 Received: by mail-wm1-f70.google.com with SMTP id 14-20020a05600c228e00b003b4d065282dso131641wmf.8 for ; Thu, 29 Sep 2022 00:01:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=G6Li3HJpQxKvNprlQ7UfYUPrUteDBpjs540tWUYi4i4=; b=aMcRT3SlITbqFS5R1XAFIOdTXRaCiFwh6i9JaZJujxukeL4uqCBGs29EkKKZoWLMCV vBnhiQGE178QdvU2/9KLMCghFk5R6QQc9bpnnOsbSzvuj9dJT3l7IPVZHRtFIqcBgTwN if1aU2ie1RQ83fqjl/xEsXbnkAZVmxuaR6ALUl4LsULH5FKW2DCpE2YPMp9LxenTixWP G5MTI6I7aofpDfn+xMcRib06Dtn4joUyLmLv1DNW3INSMDinoLUxE76dPtlF4T1gxYao lMcFoLXRBDrvYHHX6LOZNuC6TfrGySLbadmS3vN9kjfWoL/ojC1lHoI3+CBt0kr+5J5o KBPQ== X-Gm-Message-State: ACrzQf2DLh/M2fB0SyGy2h7k82lgHk/4RZyIY6mtrHK2WpomdxhO5QdR bz6L+LiVLjRq6pnqIptlMHdtue4r+nQ0RMmyGZlPPOsSR3Ndmi93ISb13VcjkfxBF47YcUUJRKT SGrU1zlPtydaHtWLz4DcOoQ== X-Received: by 2002:a05:600c:a195:b0:3b4:fc79:f778 with SMTP id id21-20020a05600ca19500b003b4fc79f778mr9347849wmb.177.1664434904425; Thu, 29 Sep 2022 00:01:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bihhxMleUCqByv4oBxNjYLlQV9ZaM4kMHZtcy3LVXqce9X2E8q5FK7eNvWG1D53zrH1EAeQ== X-Received: by 2002:a05:600c:a195:b0:3b4:fc79:f778 with SMTP id id21-20020a05600ca19500b003b4fc79f778mr9347828wmb.177.1664434904049; Thu, 29 Sep 2022 00:01:44 -0700 (PDT) Received: from [192.168.0.45] (ip-62-245-66-121.bb.vodafone.cz. [62.245.66.121]) by smtp.gmail.com with ESMTPSA id h5-20020a05600c350500b003b491f99a25sm3784715wmq.22.2022.09.29.00.01.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Sep 2022 00:01:43 -0700 (PDT) Message-ID: <7342727b-3947-c97a-f380-28b0252f3389@redhat.com> Date: Thu, 29 Sep 2022 09:01:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: [PINGv3][PATCH v4 0/5] Smart pointer wrapper for frame_info To: Bruno Larsen , Bruno Larsen via Gdb-patches References: <20220830100837.926692-1-blarsen@redhat.com> <2c1d8266-e990-3f20-4982-81baca607d23@redhat.com> From: Bruno Larsen In-Reply-To: <2c1d8266-e990-3f20-4982-81baca607d23@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2022 07:01:50 -0000 Ping! Cheers, Bruno On 21/09/2022 17:39, Bruno Larsen wrote: > Ping! > > Cheers, > Bruno > > On 13/09/2022 10:06, Bruno Larsen wrote: >> ping >> >> Cheers, >> Bruno >> >> On 30/08/2022 12:08, Bruno Larsen wrote: >>> GDB occasionally gets bugs where a frame_info is kept alive across a >>> call to reinit_frame_cache.  This causes a use-after-free and, if >>> you're lucky, a crash. >>> >>> This series aims to make this setup more "reliable", in the sense that >>> you'll always get a crash if you break the rules.  This is done by >>> wrapping frame_info in a smart pointer class, and having >>> reinit_frame_cache invalidate all the pointers. >>> >>> Tromey's original plan was that these pointers could be automatically >>> reinflated after being invalidated, but most uses of the class would >>> not >>> need to be reinflated, and setting everything up to be reinflatable >>> would be quite expensive, as calculating a frame_id requires some >>> unwinding. >>> >>> I added a prepare_reinflate method, which stashes the relevant frame_id >>> and allows the pointer to be reinflated. However, reinflation is done >>> manually for now because doing it when reinit_frame_cache was creating >>> weird problems. >>> >>> Changelog: >>> v3: >>>      Reverted instrusive list changes >>>      Guile doesn't get fancy pointers because of exceptions through >>> longjumps. >>> >>> v2: >>>      Fix commit squashing and email threading >>> Version 2 had some problematic squashing of commits, and I tried to add >>> some unit tests, but those didn't work out, so I eventually dropped >>> that. >>> >>> Bruno Larsen (2): >>>    Continue making GDB use frame_info_ptr >>>    gdb/frame: Add reinflation method for frame_info_ptr >>> >>> Tom Tromey (3): >>>    Remove frame_id_eq >>>    Introduce frame_info_ptr smart pointer class >>>    Change GDB to use frame_info_ptr >>> >>>   gdb/aarch64-fbsd-tdep.c                       |   2 +- >>>   gdb/aarch64-linux-tdep.c                      |   2 +- >>>   gdb/aarch64-tdep.c                            |  34 +- >>>   gdb/ada-lang.c                                |  10 +- >>>   gdb/ada-lang.h                                |   4 +- >>>   gdb/alpha-linux-tdep.c                        |   2 +- >>>   gdb/alpha-mdebug-tdep.c                       |  16 +- >>>   gdb/alpha-netbsd-tdep.c                       |   2 +- >>>   gdb/alpha-obsd-tdep.c                         |   2 +- >>>   gdb/alpha-tdep.c                              |  22 +- >>>   gdb/alpha-tdep.h                              |   2 +- >>>   gdb/amd64-darwin-tdep.c                       |   2 +- >>>   gdb/amd64-fbsd-tdep.c                         |   2 +- >>>   gdb/amd64-linux-tdep.c                        |   6 +- >>>   gdb/amd64-netbsd-tdep.c                       |   4 +- >>>   gdb/amd64-obsd-tdep.c                         |  12 +- >>>   gdb/amd64-sol2-tdep.c                         |   2 +- >>>   gdb/amd64-tdep.c                              |  34 +- >>>   gdb/amd64-tdep.h                              |   2 +- >>>   gdb/amd64-windows-tdep.c                      |  12 +- >>>   gdb/arc-linux-tdep.c                          |   4 +- >>>   gdb/arc-tdep.c                                |  20 +- >>>   gdb/arc-tdep.h                                |   4 +- >>>   gdb/arch-utils.c                              |   6 +- >>>   gdb/arch-utils.h                              |   8 +- >>>   gdb/arm-fbsd-tdep.c                           |   2 +- >>>   gdb/arm-linux-tdep.c                          |  14 +- >>>   gdb/arm-obsd-tdep.c                           |   2 +- >>>   gdb/arm-tdep.c                                |  64 ++-- >>>   gdb/arm-tdep.h                                |   4 +- >>>   gdb/arm-wince-tdep.c                          |   2 +- >>>   gdb/avr-tdep.c                                |  14 +- >>>   gdb/ax-gdb.c                                  |   2 +- >>>   gdb/bfin-linux-tdep.c                         |   2 +- >>>   gdb/bfin-tdep.c                               |  12 +- >>>   gdb/blockframe.c                              |   8 +- >>>   gdb/bpf-tdep.c                                |   8 +- >>>   gdb/break-catch-throw.c                       |   2 +- >>>   gdb/breakpoint.c                              |  20 +- >>>   gdb/c-lang.c                                  |   2 +- >>>   gdb/cli/cli-cmds.c                            |   2 +- >>>   gdb/compile/compile-c-symbols.c               |   2 +- >>>   gdb/compile/compile-cplus-symbols.c           |   2 +- >>>   gdb/compile/compile-loc2c.c                   |   2 +- >>>   gdb/cp-abi.c                                  |   2 +- >>>   gdb/cp-abi.h                                  |   6 +- >>>   gdb/cris-tdep.c                               |  36 +- >>>   gdb/csky-linux-tdep.c                         |   2 +- >>>   gdb/csky-tdep.c                               |  22 +- >>>   gdb/defs.h                                    |   2 +- >>>   gdb/dtrace-probe.c                            |   4 +- >>>   gdb/dummy-frame.c                             |  12 +- >>>   gdb/dummy-frame.h                             |   2 +- >>>   gdb/dwarf2/expr.c                             |  20 +- >>>   gdb/dwarf2/expr.h                             |   6 +- >>>   gdb/dwarf2/frame-tailcall.c                   |  41 +-- >>>   gdb/dwarf2/frame-tailcall.h                   |   6 +- >>>   gdb/dwarf2/frame.c                            |  39 +-- >>>   gdb/dwarf2/frame.h                            |  12 +- >>>   gdb/dwarf2/loc.c                              |  38 +-- >>>   gdb/dwarf2/loc.h                              |   8 +- >>>   gdb/elfread.c                                 |   4 +- >>>   gdb/eval.c                                    |   2 +- >>>   gdb/extension-priv.h                          |   2 +- >>>   gdb/extension.c                               |   2 +- >>>   gdb/extension.h                               |   4 +- >>>   gdb/f-valprint.c                              |   2 +- >>>   gdb/findvar.c                                 |  26 +- >>>   gdb/frame-base.c                              |   8 +- >>>   gdb/frame-base.h                              |  12 +- >>>   gdb/frame-id.h                                | 135 ++++++++ >>>   gdb/frame-info.h                              | 206 +++++++++++ >>>   gdb/frame-unwind.c                            |  26 +- >>>   gdb/frame-unwind.h                            |  36 +- >>>   gdb/frame.c                                   | 323 >>> +++++++++--------- >>>   gdb/frame.h                                   | 278 +++++---------- >>>   gdb/frv-linux-tdep.c                          |  10 +- >>>   gdb/frv-tdep.c                                |  10 +- >>>   gdb/ft32-tdep.c                               |   8 +- >>>   gdb/gcore.c                                   |   2 +- >>>   gdb/gdbarch-components.py                     |  30 +- >>>   gdb/gdbarch-gen.h                             |  60 ++-- >>>   gdb/gdbarch-selftests.c                       |   2 +- >>>   gdb/gdbarch.c                                 |  30 +- >>>   gdb/gdbtypes.h                                |   5 +- >>>   gdb/gnu-v3-abi.c                              |   2 +- >>>   gdb/h8300-tdep.c                              |  12 +- >>>   gdb/hppa-bsd-tdep.c                           |   2 +- >>>   gdb/hppa-linux-tdep.c                         |   8 +- >>>   gdb/hppa-netbsd-tdep.c                        |   4 +- >>>   gdb/hppa-tdep.c                               |  32 +- >>>   gdb/hppa-tdep.h                               |   8 +- >>>   gdb/i386-bsd-tdep.c                           |   2 +- >>>   gdb/i386-darwin-tdep.c                        |   4 +- >>>   gdb/i386-darwin-tdep.h                        |   2 +- >>>   gdb/i386-fbsd-tdep.c                          |   2 +- >>>   gdb/i386-gnu-tdep.c                           |   6 +- >>>   gdb/i386-linux-tdep.c                         |  10 +- >>>   gdb/i386-netbsd-tdep.c                        |   4 +- >>>   gdb/i386-nto-tdep.c                           |   4 +- >>>   gdb/i386-obsd-tdep.c                          |  10 +- >>>   gdb/i386-sol2-tdep.c                          |   2 +- >>>   gdb/i386-tdep.c                               |  54 +-- >>>   gdb/i386-tdep.h                               |  10 +- >>>   gdb/i386-windows-tdep.c                       |   2 +- >>>   gdb/i387-tdep.c                               |   6 +- >>>   gdb/i387-tdep.h                               |   8 +- >>>   gdb/ia64-libunwind-tdep.c                     |  12 +- >>>   gdb/ia64-libunwind-tdep.h                     |  12 +- >>>   gdb/ia64-tdep.c                               |  54 +-- >>>   gdb/ia64-tdep.h                               |   4 +- >>>   gdb/infcall.c                                 |   4 +- >>>   gdb/infcmd.c                                  |  30 +- >>>   gdb/inferior.h                                |   6 +- >>>   gdb/infrun.c                                  |  78 +++-- >>>   gdb/infrun.h                                  |   4 +- >>>   gdb/inline-frame.c                            |  14 +- >>>   gdb/inline-frame.h                            |   4 +- >>>   gdb/iq2000-tdep.c                             |  10 +- >>>   gdb/jit.c                                     |  12 +- >>>   gdb/language.c                                |   6 +- >>>   gdb/language.h                                |   8 +- >>>   gdb/lm32-tdep.c                               |   8 +- >>>   gdb/loongarch-linux-tdep.c                    |   4 +- >>>   gdb/loongarch-tdep.c                          |   8 +- >>>   gdb/loongarch-tdep.h                          |   2 +- >>>   gdb/m32c-tdep.c                               |  10 +- >>>   gdb/m32r-linux-tdep.c                         |  14 +- >>>   gdb/m32r-tdep.c                               |   8 +- >>>   gdb/m68hc11-tdep.c                            |  16 +- >>>   gdb/m68k-linux-tdep.c                         |  12 +- >>>   gdb/m68k-tdep.c                               |  18 +- >>>   gdb/m68k-tdep.h                               |   2 +- >>>   gdb/macroscope.c                              |   2 +- >>>   gdb/mep-tdep.c                                |   8 +- >>>   gdb/mi/mi-cmd-stack.c                         |  29 +- >>>   gdb/mi/mi-main.c                              |  12 +- >>>   gdb/microblaze-linux-tdep.c                   |   4 +- >>>   gdb/microblaze-tdep.c                         |  10 +- >>>   gdb/minsyms.c                                 |   2 +- >>>   gdb/mips-fbsd-tdep.c                          |   4 +- >>>   gdb/mips-linux-tdep.c                         |  22 +- >>>   gdb/mips-netbsd-tdep.c                        |   2 +- >>>   gdb/mips-sde-tdep.c                           |  12 +- >>>   gdb/mips-tdep.c                               |  96 +++--- >>>   gdb/mips-tdep.h                               |   2 +- >>>   gdb/mips64-obsd-tdep.c                        |   2 +- >>>   gdb/mn10300-linux-tdep.c                      |   4 +- >>>   gdb/mn10300-tdep.c                            |   8 +- >>>   gdb/moxie-tdep.c                              |   8 +- >>>   gdb/msp430-tdep.c                             |  10 +- >>>   gdb/nds32-tdep.c                              |  20 +- >>>   gdb/nios2-linux-tdep.c                        |   4 +- >>>   gdb/nios2-tdep.c                              |  22 +- >>>   gdb/nios2-tdep.h                              |   2 +- >>>   gdb/objc-lang.c                               |  10 +- >>>   gdb/observable.h                              |   2 +- >>>   gdb/or1k-linux-tdep.c                         |   4 +- >>>   gdb/or1k-tdep.c                               |  12 +- >>>   gdb/ppc-fbsd-tdep.c                           |   8 +- >>>   gdb/ppc-linux-tdep.c                          |  12 +- >>>   gdb/ppc-netbsd-tdep.c                         |   2 +- >>>   gdb/ppc-obsd-tdep.c                           |   8 +- >>>   gdb/ppc-tdep.h                                |   4 +- >>>   gdb/ppc64-tdep.c                              |  20 +- >>>   gdb/ppc64-tdep.h                              |   4 +- >>>   gdb/printcmd.c                                |   4 +- >>>   gdb/probe.c                                   |   4 +- >>>   gdb/probe.h                                   |   4 +- >>>   gdb/python/py-event.h                         |   2 +- >>>   gdb/python/py-finishbreakpoint.c              |   6 +- >>>   gdb/python/py-frame.c                         |  44 +-- >>>   gdb/python/py-framefilter.c                   |  22 +- >>>   gdb/python/py-inferior.c                      |   2 +- >>>   gdb/python/py-infevents.c                     |   4 +- >>>   gdb/python/py-symbol.c                        |   6 +- >>>   gdb/python/py-unwind.c                        |  12 +- >>>   gdb/python/python-internal.h                  |   6 +- >>>   gdb/record-btrace.c                           |  32 +- >>>   gdb/riscv-fbsd-tdep.c                         |   2 +- >>>   gdb/riscv-linux-tdep.c                        |   6 +- >>>   gdb/riscv-tdep.c                              |  12 +- >>>   gdb/riscv-tdep.h                              |   2 +- >>>   gdb/rl78-tdep.c                               |  12 +- >>>   gdb/rs6000-aix-tdep.c                         |  10 +- >>>   gdb/rs6000-tdep.c                             |  34 +- >>>   gdb/rx-tdep.c                                 |  16 +- >>>   gdb/s12z-tdep.c                               |  10 +- >>>   gdb/s390-linux-tdep.c                         |   8 +- >>>   gdb/s390-tdep.c                               |  38 +-- >>>   gdb/s390-tdep.h                               |   2 +- >>>   gdb/sentinel-frame.c                          |   6 +- >>>   gdb/sh-linux-tdep.c                           |   6 +- >>>   gdb/sh-tdep.c                                 |  16 +- >>>   gdb/skip.c                                    |   2 +- >>>   gdb/sol2-tdep.c                               |   2 +- >>>   gdb/sol2-tdep.h                               |   2 +- >>>   gdb/solib-svr4.c                              |   4 +- >>>   gdb/sparc-linux-tdep.c                        |   6 +- >>>   gdb/sparc-netbsd-tdep.c                       |  12 +- >>>   gdb/sparc-obsd-tdep.c                         |   8 +- >>>   gdb/sparc-sol2-tdep.c                         |   8 +- >>>   gdb/sparc-tdep.c                              |  20 +- >>>   gdb/sparc-tdep.h                              |  12 +- >>>   gdb/sparc64-fbsd-tdep.c                       |   8 +- >>>   gdb/sparc64-linux-tdep.c                      |   8 +- >>>   gdb/sparc64-netbsd-tdep.c                     |  10 +- >>>   gdb/sparc64-obsd-tdep.c                       |  16 +- >>>   gdb/sparc64-sol2-tdep.c                       |   8 +- >>>   gdb/sparc64-tdep.c                            |  10 +- >>>   gdb/sparc64-tdep.h                            |   4 +- >>>   gdb/stack.c                                   | 119 ++++--- >>>   gdb/stack.h                                   |   4 +- >>>   gdb/stap-probe.c                              |   4 +- >>>   gdb/std-regs.c                                |   8 +- >>>   gdb/symfile.h                                 |   2 +- >>>   gdb/symtab.h                                  |  10 +- >>>   .../gdb.python/pretty-print-call-by-hand.c    |  53 +++ >>>   .../gdb.python/pretty-print-call-by-hand.exp  | 136 ++++++++ >>>   .../gdb.python/pretty-print-call-by-hand.py   |  41 +++ >>>   gdb/tic6x-linux-tdep.c                        |   4 +- >>>   gdb/tic6x-tdep.c                              |  22 +- >>>   gdb/tic6x-tdep.h                              |   2 +- >>>   gdb/tilegx-linux-tdep.c                       |   2 +- >>>   gdb/tilegx-tdep.c                             |  12 +- >>>   gdb/top.c                                     |   2 +- >>>   gdb/tracepoint.c                              |   5 +- >>>   gdb/trad-frame.c                              |  10 +- >>>   gdb/trad-frame.h                              |  10 +- >>>   gdb/tramp-frame.c                             |  10 +- >>>   gdb/tramp-frame.h                             |   6 +- >>>   gdb/tui/tui-disasm.c                          |   2 +- >>>   gdb/tui/tui-disasm.h                          |   2 +- >>>   gdb/tui/tui-hooks.c                           |   6 +- >>>   gdb/tui/tui-regs.c                            |   8 +- >>>   gdb/tui/tui-regs.h                            |   4 +- >>>   gdb/tui/tui-source.c                          |   4 +- >>>   gdb/tui/tui-source.h                          |   2 +- >>>   gdb/tui/tui-stack.c                           |   4 +- >>>   gdb/tui/tui-stack.h                           |   4 +- >>>   gdb/tui/tui-winsource.c                       |   4 +- >>>   gdb/tui/tui-winsource.h                       |   2 +- >>>   gdb/user-regs.c                               |   4 +- >>>   gdb/user-regs.h                               |   6 +- >>>   gdb/v850-tdep.c                               |  10 +- >>>   gdb/valops.c                                  |  10 +- >>>   gdb/value.c                                   |   6 +- >>>   gdb/value.h                                   |  16 +- >>>   gdb/varobj.c                                  |   8 +- >>>   gdb/vax-tdep.c                                |  14 +- >>>   gdb/xstormy16-tdep.c                          |  12 +- >>>   gdb/xtensa-tdep.c                             |  22 +- >>>   gdb/z80-tdep.c                                |   6 +- >>>   253 files changed, 2172 insertions(+), 1702 deletions(-) >>>   create mode 100644 gdb/frame-id.h >>>   create mode 100644 gdb/frame-info.h >>>   create mode 100644 >>> gdb/testsuite/gdb.python/pretty-print-call-by-hand.c >>>   create mode 100644 >>> gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp >>>   create mode 100644 >>> gdb/testsuite/gdb.python/pretty-print-call-by-hand.py >>>