From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 4B0643858C2F for ; Mon, 13 Nov 2023 20:08:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B0643858C2F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4B0643858C2F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699906085; cv=none; b=rp7wI+xICGVxlTuqFXHHSF8jwpC00wyVQBJ7xgyTdBN9xeJuDpDYCbAfnJBnWmg7vEMZ4aEp9LHf/BYfZGSr4ZmiT00RSvCljE7Xq7saAxzEA1UXSUkCw1ihc9ESamlgxG+u7WRFCyPOOAjB6czcACamD+hizMCEsGv2qRDDq8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699906085; c=relaxed/simple; bh=eUEkjl7l8fgGLjpsNNwZJ7QgVPOF4C+CPMT5ZWFxbcA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Vc/SQagGvcCGO1o73q60vkb+b5d5RQP0H5a6N28xvBVROY+lobr6cfMUBN7ay15XUECKUgAAt4GFPzNUxbj2/DmQ+UWZtC7ZvgdA9Ox+yO4GYK35NYJeD1YhwCPNs9Y3O8EY3+h0/fc99SYIpXDZY4idH+k9WjwrYo3Owqzw0VI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6002a.ext.cloudfilter.net ([10.0.30.222]) by cmsmtp with ESMTPS id 2WXrrCD14WcCI2dE1rXYRE; Mon, 13 Nov 2023 20:08:01 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 2dE0rCG6MM0U22dE0rzjz6; Mon, 13 Nov 2023 20:08:01 +0000 X-Authority-Analysis: v=2.4 cv=BuKOfKb5 c=1 sm=1 tr=0 ts=65528221 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=CCpqsmhAAAAA:8 a=M8aeOEF0CrST43B4fZ8A:9 a=ul9cdbp4aOFLsgKbc677:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vJZtid/M2S4jLoYESIzCTH3B/nlO7GtEMB9Y5Dixo0o=; b=FgMjzYx26vEuRbg+Ndm34ZbGNt PIpRQ+aaSI2omROt8Sd0ZvrNUWJVftmnuY/C2mxsq3gmDA/UKlgx3rv/e/kOzmBlyJDh2hNaBl5Oo 44NbbCF1FdEmyuYljjRictQwf; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:57862 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r2dE0-0000fm-1E; Mon, 13 Nov 2023 13:08:00 -0700 From: Tom Tromey To: Hannes Domani via Gdb-patches Cc: Hannes Domani Subject: Re: [PATCHv2 1/2] Implement locals TUI window References: <20210604162400.3255-1-ssbssa.ref@yahoo.de> <20210604162400.3255-1-ssbssa@yahoo.de> X-Attribution: Tom Date: Mon, 13 Nov 2023 13:07:59 -0700 In-Reply-To: <20210604162400.3255-1-ssbssa@yahoo.de> (Hannes Domani via Gdb-patches's message of "Fri, 4 Jun 2021 18:23:59 +0200") Message-ID: <8734x9s9gg.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.77.73 X-Source-L: No X-Exim-ID: 1r2dE0-0000fm-1E X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net (murgatroyd) [97.122.77.73]:57862 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfANZfHaMywdn3jr+pbEvSPx+j3PfEylXuIMfapYYZW7+85BzbGxmJLSpKXN8priQdu2L5FMb97YZgrykSRwifQGv2MVV5k3jaAKfSARyPwp7O3YCl7bI DfZMjpkAmGp2f5p/q/tBPJczFWyYtOYQysk0VPusEkemXFi574tSi9+FxqvJDtrWK4+JHJBRyfdX7fxFKrvVXAm61bhNyHmOl7U= X-Spam-Status: No, score=-3018.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Hannes" == Hannes Domani via Gdb-patches writes: I'm sorry about the extreme delay on this. Hannes> gdb/ChangeLog: Hannes> 2021-06-04 Hannes Domani Hannes> PR tui/17849 Hannes> * data-directory/Makefile.in: Add tui_windows.py. Hannes> * python/lib/gdb/command/tui_windows.py: New file. I recently became aware there was a v2 of this patch. I must have missed it when you originally sent it. Hannes> +PY3 = sys.version_info[0] == 3 Hannes> + Hannes> +if PY3: Hannes> + basestring = str Can drop this now. Hannes> +def val_cmp_color(prev, cur, sym_not_init, argument, empty=False): Hannes> + """Returns the color escape sequences for variable name and value.""" Hannes> + var_col_s, var_col_e, val_col_s, val_col_e = "", "", "", "" Hannes> + if empty: Hannes> + # Variable without contents Hannes> + var_col_s, var_col_e = "\033[1;30m", "\033[0m" Hannes> + elif prev is None: Hannes> + # New variable Hannes> + var_col_s, var_col_e = "\033[1;32m", "\033[0m" Hannes> + elif prev != cur: Hannes> + # Variable contents changed Hannes> + val_col_s, val_col_e = "\033[1;31m", "\033[0m" Hannes> + if argument: Hannes> + # Variable is a function argument Hannes> + var_col_s, var_col_e = "\033[1;35m", "\033[0m" Hannes> + elif sym_not_init: Hannes> + # Variable was not yet initialized Hannes> + var_col_s, var_col_e = "\033[33m", "\033[0m" Hannes> + return (var_col_s, var_col_e, val_col_s, val_col_e) Perhaps these should have 'set style' parameters? Or reuse existing ones? Hannes> +def is_string_element_type(t): Hannes> + """Return if an array of this type is considered a string.""" Hannes> + target_type = t.target().strip_typedefs() Hannes> + return target_type.code == gdb.TYPE_CODE_INT and ( Hannes> + target_type.name == "char" or is_typedef_of(t.target(), "wchar_t") Hannes> + ) There's a more direct way of doing some of this stuff now. This code can probably reuse the work done for DAP. Hannes> +class ArrayPrinter(object): Hannes> + """Pretty printer for arrays.""" Same for this and the other "no-op" printers. Hannes> +class StructPrinter(object): ... Hannes> + for f in fields: Hannes> + if not hasattr(f, "bitpos"): Hannes> + continue Oops, I think this points out a bug in NoOpStructPrinter. I'll fix that. Hannes> + # Disable dynamic_type for base classes, to prevent infinite Hannes> + # recursion. Hannes> + if child_v.type.code == gdb.TYPE_CODE_STRUCT and f.is_base_class: Hannes> + pp = None Hannes> + if not self.raw: Hmm I wonder if this is one as well. Hannes> + if key is not None: Hannes> + self.add_val( Hannes> + "[" + str(key) + "]", Hannes> + fnc, Hannes> + vc, Hannes> + inset + 1, Hannes> + 0, Hannes> + cur_vals, Hannes> + keep_prev, Hannes> + False, Hannes> + False, Hannes> + False, Hannes> + raw, Hannes> + fmt, Hannes> + None, Hannes> + ) Hannes> + else: Hannes> + self.add_val( Hannes> + "value", Hannes> + fnc, Hannes> + vc, Hannes> + inset + 1, Hannes> + 0, Hannes> + cur_vals, Hannes> + keep_prev, Hannes> + False, Hannes> + False, Hannes> + False, Hannes> + raw, Hannes> + fmt, Hannes> + None, Hannes> + ) Some things like this could probably be simplified? I found some of this code pretty hard to follow. Tom