From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#44173: 28.0.50; gdb-mi mangles strings with octal escapes Date: Fri, 23 Oct 2020 16:21:55 +0200 Message-ID: <2C183F78-8E7D-48AE-BCC2-1E32EC0A4E29@acm.org> References: <2A87D378-9FB9-4FC7-951E-5BA9832051CF@acm.org> <837drhjglr.fsf@gnu.org> <834kmljd01.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28443"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44173@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 23 16:23:14 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVxyM-0007J0-Bu for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Oct 2020 16:23:14 +0200 Original-Received: from localhost ([::1]:43126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVxyL-0004A6-8d for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Oct 2020 10:23:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVxyA-00049l-AB for bug-gnu-emacs@gnu.org; Fri, 23 Oct 2020 10:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46394) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVxyA-0000cp-0l for bug-gnu-emacs@gnu.org; Fri, 23 Oct 2020 10:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVxy9-00083H-RX for bug-gnu-emacs@gnu.org; Fri, 23 Oct 2020 10:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Oct 2020 14:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44173 X-GNU-PR-Package: emacs Original-Received: via spool by 44173-submit@debbugs.gnu.org id=B44173.160346293330876 (code B ref 44173); Fri, 23 Oct 2020 14:23:01 +0000 Original-Received: (at 44173) by debbugs.gnu.org; 23 Oct 2020 14:22:13 +0000 Original-Received: from localhost ([127.0.0.1]:57940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVxxM-00081v-SN for submit@debbugs.gnu.org; Fri, 23 Oct 2020 10:22:13 -0400 Original-Received: from mail1458c50.megamailservers.eu ([91.136.14.58]:50178 helo=mail267c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVxxJ-00081g-MH for 44173@debbugs.gnu.org; Fri, 23 Oct 2020 10:22:11 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1603462922; bh=lqdCEJ0YYvbA936LoWOb70Mqko3UmIVY6lR8wcUscRc=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=Qpu3ppvWMu44XT1hGIXKl3RKyiuTpRQvqAl0S0Qp9/zlV7iR9AVle90UcSOL9wyKm Mc8EZU+HwbE8kE0QWFseL8MkySaygBFuKFtctFmZmBo1ag9H4CAs/TH4nxw28/GV8A eFAvaWfrefYlyaCoL40gce4/IofM9T6K3OhOB8j4= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-304ee655.032-75-73746f71.bbcust.telenor.se [85.230.78.48]) (authenticated bits=0) by mail267c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 09NELuEW031073; Fri, 23 Oct 2020 14:21:59 +0000 In-Reply-To: <834kmljd01.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A782F1F.5F92E70A.0072:SCFSTAT76743386, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Cf92G4jl c=1 sm=1 tr=0 a=63Z2wlQ1NB3xHpgKFKE71g==:117 a=63Z2wlQ1NB3xHpgKFKE71g==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=aD-8tkJ-s0J0S0xM4JUA:9 a=CjuIK1q_8ugA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-Origin-Country: SE X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:191379 Archived-At: 23 okt. 2020 kl. 15.19 skrev Eli Zaretskii : > The basic ambiguity, AFAIR, is what is described last here: a string > reported bu GDB could include literal \nnn sequences, which are not > non-ASCII characters that GDB/MI converts to octal escapes. The > information which was which is lost once we receive the GDB/MI output. So you mean that GDB would produce the value "\303" that does not stand = for a string containing the single byte octal 303? When does this occur? > AFAIU, this bug's root cause is the way we solved the ambiguity, which > basically assumes one of the possible interpretations should be > preferred to another, because it is more popular/useful. Then we disagree. The code doesn't do the right thing if = gdb-mi-decode-string is nil, unless you by 'ambiguity' mean that GDB = sometimes inserts a spurious backslash that should be ignored. When = gdb-mi-decode-string is non-nil, it is sometimes wrong as well. > Let me turn the table and ask you how did you get that string you show > in the original report? A program in the C language containing the local declaration char *s =3D "\303\266"; produces nonsense in the 'Locals' window when debugged. It doesn't = matter what the string means; I would have been happy with gdb/emacs = interpreting it as utf-8, latin-1 or just raw bytes presented in octal = or hex. > And what will then happen to non-ASCII strings and file names reported > by GDB? How will our parser solve that? The parser can either leave the strings as undecoded unibyte strings -- = that is, "\303\266" would be a 2-char string -- or decode them according = to gdb-mi-decode-strings, in which case it might become a 1-char = multibyte string. In the former case, the code receiving the parse tree = could decide what to do with the strings and how to display them, = perhaps on a case-by-case basis. > Do you intend to extend the existing parser or write a new one from > scratch? Extending the existing one appears sensible, just replacing the JSON = tour.