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.129.124]) by sourceware.org (Postfix) with ESMTPS id 5DFF63858C51 for ; Tue, 3 May 2022 10:12:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5DFF63858C51 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-539-abvvP9dsM_S-PlvZSYpOnA-1; Tue, 03 May 2022 06:12:27 -0400 X-MC-Unique: abvvP9dsM_S-PlvZSYpOnA-1 Received: by mail-wm1-f71.google.com with SMTP id 26-20020a05600c021a00b003940660c053so5512514wmi.2 for ; Tue, 03 May 2022 03:12:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=fm2+E09QsSyHjLItvKSqlcKwN+LpOWY2yTcnT+1gnCk=; b=YvNrf2IHSXus8DUI3azn78XCcwb+npksixrCXR4NVv2MvAay72Hbh0Ep78ilfcO0B9 0r64h71jsK82yKn0mL4cvXq8dsCirEMaVnxxmZvn08l3hRjg4eCZKtr3BGyeag3GbjKT S2v7AUS14cqh8dGeFb7OZ44mXX8MpAtADXgLm/fr8/DaBNMdhDIZAtrflaX5Mod5nd9S /V7R6uWXka6wt34GCM8SOltqp4NxuscieHgqgtgBQHuqOjn5QPMnVCtWuehmFkMFtvjs ziExFeT6G6HsSDULdBx7HomGMQvZJgemNmEH4Ch1Le5GozZ78OK85pbrtIEBa+A96SM3 4Zow== X-Gm-Message-State: AOAM530xLmgi38tg50i78ENssElGbbRbmXP9how/7AtLOpU5BL7Rypob bB/Lb7yT0lQTUQ+AGSTj0qFmUblQVxvDvaF3HTDbFVFRzKzda+HW+s5zKFJOgbwHLiFN+gdIZU1 baM8wStpERN/WeC9YjMl6X2Ko+LqXrbVCjw8fkqgx/G10QNsb3ZWe5zO9IJUux0WrfU2jbdt2Mg == X-Received: by 2002:a05:600c:4e8a:b0:393:f169:b261 with SMTP id f10-20020a05600c4e8a00b00393f169b261mr2764588wmq.81.1651572745677; Tue, 03 May 2022 03:12:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdyaxy7w0uQzRe9/Kzc1SP30/e1lwyzxKnu9+yQPJZG28I6wcmDzGwCyrtTiaGnandeclbaw== X-Received: by 2002:a05:600c:4e8a:b0:393:f169:b261 with SMTP id f10-20020a05600c4e8a00b00393f169b261mr2764574wmq.81.1651572745374; Tue, 03 May 2022 03:12:25 -0700 (PDT) Received: from localhost (host81-136-113-48.range81-136.btcentralplus.com. [81.136.113.48]) by smtp.gmail.com with ESMTPSA id o3-20020adfba03000000b0020c5253d90asm9445676wrg.86.2022.05.03.03.12.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 03:12:24 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCHv4 0/5] Add Python API for the disassembler In-Reply-To: References: Date: Tue, 03 May 2022 11:12:23 +0100 Message-ID: <8735hqorg8.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 03 May 2022 10:12:30 -0000 Ping! I'd like to see if I can get this work moved forward. I'd probably just push this work on the grounds we could back it out if anyone complains after the fact ... except for patch #3, which extends the Python API, and I'd prefer at least a little review before I merge this, even if it was just reading the documentation to check the new API makes sense. All thoughts welcome, Thanks, Andrew Andrew Burgess writes: > Changes in v4: > > - Patch #1 from v3 series has been merged, > > - Addressed Eli's feedback on previous series, > > - Rebased onto current upstream/master. > > Changes in v3: > > - Rebased to current master, and retested, > > - Patch #1 is new in this series, > > - Patch #2 is changed slightly from v2, I've reworked the > disassembler classes in a slightly different way now, in order to > prepare for patches #5 and #6. > > - Patch #3 is unchanged from v2, > > - Patch #4 is unchanged from v2, > > - Patch #5 is new in v3. I've included it here as the changes in #2 > only make sense knowing that patch #5 is coming, > > - Patch #6 is a small cleanup only possible after #2 and #5 have landed. > > Changes in v2: > > - The first 3 patches from the v1 series were merged a while back, > these were all refactoring, or auxiliary features, > > - There's a new #1 patch in the v2 series that does some new > refactoring of GDB's disassembler classes, this was required in > order to simplify the #3 patch, > > - Patch #2 in the v2 series is largely unchanged from patch #4 in > the v1 series, > > - The syntax highlighting work that was in the v1 series was spun > out into its own patch, and has been merged separately, > > - The format_address helper function that appeared in the v1 series, > and that Simon suggested I make more general, was spun out into > its own patch, and merged separately, > > - Finally, patch #3 in the v2 series is pretty much a complete > rewrite from the v1 series in order to follow the approach > suggested by Simon. Results are now returned directly, either via > 'return' or by raising an exception, in contrast to the original > approach which involved "setting" the result into an existing > state object. > > --- > > Andrew Burgess (5): > gdb: add new base class to gdb_disassembler > gdb: add extension language print_insn hook > gdb/python: implement the print_insn extension language hook > gdb: refactor the non-printing disassemblers > gdb: unify two dis_asm_read_memory functions in disasm.c > > gdb/Makefile.in | 1 + > gdb/NEWS | 34 + > gdb/arc-linux-tdep.c | 15 +- > gdb/arc-tdep.c | 29 +- > gdb/arc-tdep.h | 5 - > gdb/arm-tdep.c | 4 +- > gdb/data-directory/Makefile.in | 1 + > gdb/disasm-selftests.c | 70 +- > gdb/disasm.c | 172 ++--- > gdb/disasm.h | 207 +++++- > gdb/doc/python.texi | 247 +++++++ > gdb/extension-priv.h | 15 + > gdb/extension.c | 20 + > gdb/extension.h | 17 + > gdb/guile/guile.c | 6 +- > gdb/mips-tdep.c | 4 +- > gdb/python/lib/gdb/disassembler.py | 109 +++ > gdb/python/py-disasm.c | 970 +++++++++++++++++++++++++ > gdb/python/python-internal.h | 16 + > gdb/python/python.c | 3 + > gdb/s12z-tdep.c | 26 +- > gdb/testsuite/gdb.python/py-disasm.c | 25 + > gdb/testsuite/gdb.python/py-disasm.exp | 150 ++++ > gdb/testsuite/gdb.python/py-disasm.py | 456 ++++++++++++ > 24 files changed, 2405 insertions(+), 197 deletions(-) > create mode 100644 gdb/python/lib/gdb/disassembler.py > create mode 100644 gdb/python/py-disasm.c > create mode 100644 gdb/testsuite/gdb.python/py-disasm.c > create mode 100644 gdb/testsuite/gdb.python/py-disasm.exp > create mode 100644 gdb/testsuite/gdb.python/py-disasm.py > > -- > 2.25.4