From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 00026385840C for ; Wed, 30 Mar 2022 10:38:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 00026385840C 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-x435.google.com with SMTP id h23so28620303wrb.8 for ; Wed, 30 Mar 2022 03:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=1+e913+LT9bRlf4eelgscLIdbt1SIrNX69zYuVnKsC4=; b=QrbHNVDuOGtchdQepIqKgOiy2DQrik3B1+2za0HLJtwVPcWwAP2wMR3Wi83kWE8OcV lm+Tn/jLjGtykUK2FZDzZOH7m4+YLB/RDzAoO3e0GRwjRcXST1xVcn4UFb2KKNRWj4Vl WpAge2KWxJo/4o/g+bFRRshTufDOxzVeoaKW2/LPunWtzbCNrnwmW9gWITM9q8IocvXm GOyfvcmNV8E4z9cw5BqfMiNbBzh0mf73b30D6pwZmCMYM8TNlmoZ+KqAoDMmT2OsegMA Cufbo28309kpZ8UXKo3ZgJZscuQCyKBsRe6Zoq99v/PsLYJFNpKG6A2hC/Xxm0+cCL3c VUTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=1+e913+LT9bRlf4eelgscLIdbt1SIrNX69zYuVnKsC4=; b=K02yOCPk4Uhl508yWLnkxhPsk/T+jK4KiqBMDbdsk4NfqBtyKe7njFLgn6AmqfBgPh fQS85xh25Gfhzm/nVK/9YHZqN8u26G45P5CfBPz2pMBfvsjJsKGYSfWHVQACxp333cFn caNbon+cXcTfCj1bQj6VM1ic1p94DlPZ4liLeCQEyGidsw6VMnhkVOJCJQ5Ns98TmOoj JcaaLmvTqkyy7njTvF6vwdBLXcJRa6/wkW6awxTCYBcsCq2Z/Ex/VA3Ug+u+UNarQR40 6NRrt/c3amDttZ6ssaMw+ipxpA66JzToXkQjiVchUyciewIepLjaOBnK1CoOK/92nVZx dd+g== X-Gm-Message-State: AOAM532FdZB5COopGF2SpLfUvWrZ6ZDlVH12o6CBV0nopSzmG5B4fQMG FPbk+VY6xMxfHHQvrSD2GfloRvBJBsfP4g== X-Google-Smtp-Source: ABdhPJx33jbKSISm5PshOGPh8PEDAOPM6oNx6twzLVRcfEbHZc/NRdmq9nxxWFl0jr2bwaThofc5Pw== X-Received: by 2002:a05:6000:1acf:b0:203:fe67:a8dc with SMTP id i15-20020a0560001acf00b00203fe67a8dcmr35362523wry.212.1648636692809; Wed, 30 Mar 2022 03:38:12 -0700 (PDT) Received: from [192.168.0.201] ([212.69.42.53]) by smtp.gmail.com with ESMTPSA id r14-20020a0560001b8e00b00205918bd86esm17004985wru.78.2022.03.30.03.38.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2022 03:38:12 -0700 (PDT) Date: Wed, 30 Mar 2022 11:38:11 +0100 (BST) From: "Maciej W. Rozycki" To: Tom Tromey cc: Eli Zaretskii , gdb-patches@sourceware.org, simonsobisch@web.de, Andrew Burgess Subject: Re: [PATCH v4 7/8] GDB: Add a character string limiting option In-Reply-To: <874k45g246.fsf@tromey.com> Message-ID: References: <83o82eewgh.fsf@gnu.org> <83mthye2yu.fsf@gnu.org> <874k45g246.fsf@tromey.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Wed, 30 Mar 2022 10:38:15 -0000 On Thu, 10 Mar 2022, Tom Tromey wrote: > Maciej> NB is there a way to orchestrate a wide character string in a way that > Maciej> wouldn't show gibberish on a plain-ASCII terminal > > If the host encoding is ASCII, then I think non-ASCII characters in a > wide string should be printed as escapes. This should always happen, > though see my series about string printing -- fully generic encoding > support when printing was not implemented for all languages, and that > series aims to unify it. That is still pending some updates by me, and > some missing reviews. That sounds good (and I also mean the sources used in the test suite). Also while preparing changes for the docs in v5 I have noticed this old NEWS piece: >>GDB supports wide- and unicode-literals in C, that is, L'x', L"string", u'x', u"string", U'x', and U"string" syntax.<< which I think means we can do verification by hand, because the limit is of course also respected for strings supplied from the UI (and even with no target connected), e.g.: (gdb) print "foobar" $1 = "foobar" (gdb) set print characters 4 (gdb) print "foobar" $2 = "foob"... (gdb) Though I'd yet have to figure out how to use the syntax quoted in NEWS in a meaningful manner, and an artificial program may also be required, because: (gdb) print L"foobar" No type named wchar_t. (gdb) print u"foobar" No type named char16_t. (gdb) print U"foobar" No type named char32_t. (gdb) though I guess the data types do not actually have to be system-supplied, and it will be enough if they are reasonably defined. Maciej