From patchwork Sat Sep 16 10:18:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 56139 Return-Path: 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 7F5283858298 for ; Sat, 16 Sep 2023 10:18:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F5283858298 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694859524; bh=9luH6IZVHBLspqV74KD9R4A6P+Qls6V4vctNFz8fTWY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=wbU9LHrWY2AOtVerrlcJqyZn1Ug6GPPofcBjuHWSdERMK+/E4CXORGeUmWGdnrDLa VPnMD3kV6qnILvCpr5nzT/18GdVtkObjyKcCIkbL10RPR6Dj5XL+jSXNF7IamW5Xh3 Onut4S4PgQWQelAwdG2iCdnTP7JRJl8lLb2FFAkM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0A44A3858D37 for ; Sat, 16 Sep 2023 10:18:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A44A3858D37 Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-sg5zkQnROzm4Pwb4ug3qOQ-1; Sat, 16 Sep 2023 06:18:16 -0400 X-MC-Unique: sg5zkQnROzm4Pwb4ug3qOQ-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-502f46691b4so1764016e87.3 for ; Sat, 16 Sep 2023 03:18:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694859494; x=1695464294; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9luH6IZVHBLspqV74KD9R4A6P+Qls6V4vctNFz8fTWY=; b=SZQEXkJKMEHhQo9UBlJ21CpokHDVPeNqrtpCDgbbRcCsShMHYEBoJgFrng3PsNA5Oy 0SQA+l5Au/4O2n72Lsmn0JVT91Ja5HMgxBSafkppKsEQP8aqxzxGiYRZKHqBCJ4ZfrjF +0EAd5ajocNpdxWd7w6Y8dhNq4t2QVsFff469W5HD9OPj4v4w04iT7DARAYCjefG8Ija NtwdfR/6yaf0GnaQedWUT2FxMMeDPRVTZeIIA8Fw1AKr3ULLMKp8PDLaG/YdNl3lDbFY TM+B+MRoTPP65DU+6rX/Xwk2VMwZjsGteF3EuDh2Q1QN0P/nMbt/bRsnUKLxsdF1wQb7 0KWg== X-Gm-Message-State: AOJu0YyAqnMXh6gzgdQwl3ruSiM1+UPVpSZi7hJC+FNOlBqWjCM6k2T/ 24I2m+G2smjDG33Y4fUnny2qptvAjX6bhfQQRDgDb1s5zPGiligQnDktGc7bT3B9tO+gvVbRiBF rOvcDdMnoOKTwCNWQpKAlBAAgjOjjkuWMHvaWC4KO/qwidZHqpoZwUYZ+F4B04LBi+8T5/KVy7W vV7aFLCA== X-Received: by 2002:a05:6512:1597:b0:4fd:fd97:a77b with SMTP id bp23-20020a056512159700b004fdfd97a77bmr4419485lfb.50.1694859494260; Sat, 16 Sep 2023 03:18:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPumw2A6tJ0EdiyEchODzMqISy/kwdCxEztaaiKQPVbfoCBiWfU2Up6lgH1U1QKmdaBIzQcA== X-Received: by 2002:a05:6512:1597:b0:4fd:fd97:a77b with SMTP id bp23-20020a056512159700b004fdfd97a77bmr4419467lfb.50.1694859493782; Sat, 16 Sep 2023 03:18:13 -0700 (PDT) Received: from localhost (92.40.218.107.threembb.co.uk. [92.40.218.107]) by smtp.gmail.com with ESMTPSA id 26-20020a05600c231a00b003fe1a96845bsm9868390wmo.2.2023.09.16.03.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 03:18:13 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH 0/9] Add executable_changed event to Python API Date: Sat, 16 Sep 2023 11:18:01 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" When I started, I thought this would be trivial; I wanted to expose the executable_changed observer through the Python API. Well, it turns out that the executable filename isn't directly visible from the Python API, so having an event for when it changes doesn't make a great deal of sense. So the first 3 patches sort that out. Then, once I started looking at how the executable_changed observer is used, it feels like it is currently overloaded a little, and, as a result, triggers more than it needs to. The next 3 patches try to sort this out. Then patch 7 adds some additional arguments to the executable changed observer. Patch 8 is the trivial patch that exposes the observer as an event in the Python API. .... And patch 9 fixes a final bug/annoyance which I ran into while writing the tests for patch 8. --- Andrew Burgess (9): gdb/doc: extend the description for Progspace.filename gdb/python: new Progspace.symbol_file attribute gdb/python: new Progspace.executable_filename attribute gdb: remove one user of the executable changed observer gdb: remove final user of the executable_changed observer gdb: remove unnecessary notification of executable_changed observer gdb: pass more arguments to the executable_changed observer gdb/python: make the executable_changed event available from Python gdb: use reopen_exec_file from reread_symbols gdb/NEWS | 16 ++ gdb/auxv.c | 10 +- gdb/doc/python.texi | 71 +++++++- gdb/exec.c | 11 +- gdb/observable.h | 18 +- gdb/python/py-all-events.def | 1 + gdb/python/py-event-types.def | 5 + gdb/python/py-progspace.c | 100 ++++++++++- gdb/symfile.c | 22 +-- gdb/symtab.c | 18 +- gdb/testsuite/gdb.python/py-exec-file.c | 22 +++ gdb/testsuite/gdb.python/py-exec-file.exp | 195 ++++++++++++++++++++++ gdb/testsuite/gdb.python/py-progspace.exp | 9 + 13 files changed, 458 insertions(+), 40 deletions(-) create mode 100644 gdb/testsuite/gdb.python/py-exec-file.c create mode 100644 gdb/testsuite/gdb.python/py-exec-file.exp base-commit: 5a6dafd5f1110e8b642fdf65c13d8543e469a09e