From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by sourceware.org (Postfix) with ESMTPS id 0A3FE3858003 for ; Wed, 21 Jul 2021 16:07:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A3FE3858003 Received: by mail-qk1-x72c.google.com with SMTP id z9so2550337qkg.5 for ; Wed, 21 Jul 2021 09:07:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=onwbCL4dSZsvAx51M2/3kD/fDaS5XUg/zpGmPvbjTD8=; b=rCfGL/WmjGfe6+NLz6o4UHz4Baze2favo/PIwRN0+1cqhFGtDQeE94opkoBvomTysM KAOLt476AT3vKbMo8M7uEHbZsNzKjJQ3w9k/VbsKzQU+1NbW97i1TDap9e3OXwCsfT3w tJWmF/uhA59ckVmPoMskSwG3ESJ6c2oP5EQSNWoDM2FP8+9+EPDPDmfrm62gv9n+xo56 bjMykE5TnaPTvFtlqH2OFA/XenyYKEvSleoQHPmr5EUlzChJJs8Opwb21UyyJ7xwFlhj DiKXRQ/XwEOOtEpBjUJ5kde1vLnTHqXi+DC+zcrGKb8s/afj+ND0Ge0yri61ZyKK936A QBRA== X-Gm-Message-State: AOAM532KWU3/UrADdJ41DrGkJOU5fKAyi+2CSAtb9CMCSpI+sZUH6ZTn KiVAfl4NRBRzYava/0o801qmuLugpSrSmA== X-Google-Smtp-Source: ABdhPJyZwaO24Uyu6qXRfYLFeyxOqpJ4nAdKZe22duyh5pDW8gjMbwgMbDAdwRCCt+VPV//kgGUtMA== X-Received: by 2002:a05:620a:1139:: with SMTP id p25mr35457157qkk.334.1626883677484; Wed, 21 Jul 2021 09:07:57 -0700 (PDT) Received: from [192.168.1.127] ([192.222.216.4]) by smtp.gmail.com with ESMTPSA id f11sm9308666qtp.85.2021.07.21.09.07.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Jul 2021 09:07:56 -0700 (PDT) From: Philippe Blain Subject: Re: [PATCH] Allow use of Pygments to colorize source code To: Tom Tromey , gdb-patches@sourceware.org References: <20200104033132.21583-1-tromey@adacore.com> Message-ID: <4316072c-aeed-90a7-33a5-def6ff09ee93@gmail.com> Date: Wed, 21 Jul 2021 12:07:55 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20200104033132.21583-1-tromey@adacore.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: Wed, 21 Jul 2021 16:07:59 -0000 Hi Tom! [Sorry for the resend, the pipermail mbox archive does not include the list in the To: header and I forgot to manually add it] Le 2020-01-03 à 22:31, Tom Tromey a écrit : > While GNU Source Highlight is good, it's also difficult to build and > distribute. For one thing, it needs Boost. For another, it has an > unusual configuration and installation setup. > > Pygments, a Python library, doesn't suffer from these issues, and so I > thought it would be a reasonable fallback. > > This patch implements this idea. GNU Source Highlight is preferred, > but if it is unavailable (or fails), the extension languages are > tried. This patch also implements support for Pygments. > > Something similar could be done for Guile, using: > > https://dthompson.us/projects/guile-syntax-highlight.html > > However, I don't know enough about Guile internals to make this > happen, so I have not done it here. > > gdb/ChangeLog > 2020-01-03 Tom Tromey > > * source-cache.c (source_cache::ensure): Call ext_lang_colorize. > * python/python.c (python_extension_ops): Update. > (gdbpy_colorize): New function. > * python/lib/gdb/__init__.py (colorize): New function. > * extension.h (ext_lang_colorize): Declare. > * extension.c (ext_lang_colorize): New function. > * extension-priv.h (struct extension_language_ops) : New > member. > * cli/cli-style.c (_initialize_cli_style): Update help text. > > Change-Id: I5e21623ee05f1f66baaa6deaeca78b578c031bf4 > --- > gdb/ChangeLog | 12 ++++++ > gdb/cli/cli-style.c | 5 ++- > gdb/extension-priv.h | 7 ++++ > gdb/extension.c | 21 ++++++++++ > gdb/extension.h | 9 +++++ > gdb/python/lib/gdb/__init__.py | 14 +++++++ > gdb/python/python.c | 72 ++++++++++++++++++++++++++++++++++ > gdb/source-cache.c | 14 ++++++- > 8 files changed, 150 insertions(+), 4 deletions(-) > It took me a quite a while to understand why my GDB was able to highlight my source code even if I knew I had not compiled it with source-highlight. Any reason why this change was not mentioned in the NEWS file at the time, or in the doc ? It's quite a nice improvement. It would be great if the requirement to install Pygments was mentioned somewhere in the documentation :) Cheers, Philippe.