From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id BVS3F5bMd2HEGgAAWB0awg (envelope-from ) for ; Tue, 26 Oct 2021 05:38:30 -0400 Received: by simark.ca (Postfix, from userid 112) id 4B57C1F0BD; Tue, 26 Oct 2021 05:38:30 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 ESMTPS id 16CC91E79C for ; Tue, 26 Oct 2021 05:38:29 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9466A3857C62 for ; Tue, 26 Oct 2021 09:38:28 +0000 (GMT) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 0FD6D3858033 for ; Tue, 26 Oct 2021 09:38:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0FD6D3858033 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42d.google.com with SMTP id e4so18011581wrc.7 for ; Tue, 26 Oct 2021 02:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VWQ/CQjHmc4uFNN4gykXqaoBAy1KI5MTdRGegLZBNwg=; b=K38vrISx4pgayOwi0kGbg33/BB3VumzyCZnBNPY7ZWHQ1vE6qPxsQnPNS/FRuD5cSg QT7v79MCDL4mo4mGYCpFAUNxls4nIMz/TfiRKRj+uIz2SlMGzgw8+XvyNUniZL/8DaYR plrVIf1qBjd9tBE8gvgQaFPpiDgnqBU9ldK72xOuow16bNTzKWjzdpkCb61/72o5oq2i owOBRVleZGB+gjfP2GnPuP6dqFo2oGsvxXwijwRHfIhno3CQjtYCq0/eaWpqFEJcUXzM wj75FpgI+MmydWlHdbViyjYoEb1yEfAiR0qQXl7fGtNmfTn/xybJ7DLZce1JjhYsJ62U A0JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VWQ/CQjHmc4uFNN4gykXqaoBAy1KI5MTdRGegLZBNwg=; b=XNchWFM9Bqb0C2m0o5hPa/alfcX2BxKXq/HZfk5EJLegYxHqW/LuasUoAseKOWH+2z H5SGMr0c8soduIvKH3li8mFjaZae0aWAX5ZsvRLWVZLkEawGR143raDC35AyhvIX682l pR8HBPej4SbM40rp5CQsSZpScpYleCT/2U8Via7TguaCFFSD5L5HwH/EsocyOvKEnaJm 5qe8rN2iXObfbEH1+icxnCUyaDLin5klzxqHPhkVlyfPyCpClSHQR8q+76VndgrAkkX6 Uuc4iiWHIczgDX1WCzcP9DVzULINNjZ9Pj0xhIUhM1mLwdjATulT39sVXQeNSXGDePMK MWMw== X-Gm-Message-State: AOAM531h6SDQ9PSkaI33waMJn1DUqggRWEoL8UY5sxZIC7RnMNBl+2Ze Vwtodb0CaDkxEnyPX5kTqHXSiPNIeNjM6g== X-Google-Smtp-Source: ABdhPJyrDH7J51y+l5cFlRu0RSrskEnXpekpvCIvfUpQE8egEWajhwCbAHft9Y11VriWkaRPp7Qewg== X-Received: by 2002:a05:6000:15c6:: with SMTP id y6mr30382383wry.210.1635241081854; Tue, 26 Oct 2021 02:38:01 -0700 (PDT) Received: from localhost (host86-180-62-146.range86-180.btcentralplus.com. [86.180.62.146]) by smtp.gmail.com with ESMTPSA id w10sm13717729wrq.88.2021.10.26.02.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 02:38:01 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCH 0/4] Disassembler Output Styling Date: Tue, 26 Oct 2021 10:37:55 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This series replaces some parts of this earlier series: https://sourceware.org/pipermail/gdb-patches/2021-October/182526.html Specifically, all of the disassembler styling related changes are now replaced by this series. In the earlier patch I develop a general API for augmenting the disassembler output. While I was working on that I realise I could use that API to provide styled disassembler output, so I did that, and included it in the earlier series. However, after reading the feedback, and working with the new API a little more, I realised that including the disassembler styling within the general disassembler API was a bad idea. It meant that when a user wrote a plugin to augment the disassembler output, they had to ensure that they also syntax-highlighted the output, this just seemed unnecessary. Instead, I think that syntax highlighting should be a separate step that is performed after the disassembler output has been constructed, whether that output is from GDB's builtin disassembler, or, in some future world, where the output originates from a new Python Disassembler API. One additional reason I wanted the syntax highlighting to be moved out of Python was, originally, so I could make use of libsource-highlight, as we do for source code highlighting, I figured it would be quicker to use that library than calling into Python, however, as I describe in patch #3, the output of libsource-highlight on assembler code is not great (currently), so in the end I stuck with the pure Python solution. If this series is accepted, then I plan to rebase the general purpose disassembler API on to this, with some simplifications made now that we don't need to support syntax highlighting. Thanks, Andrew --- Andrew Burgess (4): gdb/python: make some global variables static gdb: rename source_styling_changed observer gdb: use python to colorize disassembler output gdb/python: move styling support to gdb.styling gdb/NEWS | 6 ++ gdb/cli/cli-style.c | 28 +++++- gdb/cli/cli-style.h | 3 + gdb/data-directory/Makefile.in | 1 + gdb/disasm.c | 23 ++++- gdb/disasm.h | 6 ++ gdb/doc/gdb.texinfo | 15 ++++ gdb/extension-priv.h | 6 ++ gdb/extension.c | 20 +++++ gdb/extension.h | 8 ++ gdb/observable.c | 2 +- gdb/observable.h | 6 +- gdb/python/lib/gdb/__init__.py | 18 ---- gdb/python/lib/gdb/styling.py | 48 ++++++++++ gdb/python/python.c | 145 ++++++++++++++++++++++++------- gdb/testsuite/gdb.base/style.exp | 46 ++++++++-- gdb/tui/tui-winsource.c | 4 +- 17 files changed, 320 insertions(+), 65 deletions(-) create mode 100644 gdb/python/lib/gdb/styling.py -- 2.25.4