Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Pedro Alves <palves@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: GDB/MI reporting non-ASCII file names
Date: Fri, 09 Oct 2015 13:31:00 -0000	[thread overview]
Message-ID: <83si5ktbgf.fsf@gnu.org> (raw)
In-Reply-To: <5617A0FD.3020208@redhat.com>

> Date: Fri, 09 Oct 2015 12:11:57 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: gdb@sourceware.org
> 
> On 09/30/2015 04:51 PM, Eli Zaretskii wrote:
> 
> > If you compile a program from a source file whose name includes
> > non-ASCII characters, then debug that program with -i=mi, do you see
> > the file names correctly, after turning 7 bits off?
> > 
> 
> Looks like I see the same as you.  With a file named "çêá.c":
> 
> (gdb)
> set print sevenbit-strings on
> &"set print sevenbit-strings on\n"
> =cmd-param-changed,param="print sevenbit-strings",value="on"
> ^done
> (gdb) start
> ...
> *stopped,reason="breakpoint-hit",disp="del",bkptno="2",frame={addr="0x00000000004004fb",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffd838"}],file="\303\247\303\252\303\241.c",fullname="/home/pedro/gdb/tests/\303\247\303\252\303\241.c",line="5"},thread-id="1",stopped-threads="all",core="2"
> (gdb)
> 
> (gdb)
> set print sevenbit-strings off
> &"set print sevenbit-strings off\n"
> =cmd-param-changed,param="print sevenbit-strings",value="off"
> ^done
> (gdb) start
> ...
> *stopped,reason="breakpoint-hit",disp="del",bkptno="3",frame={addr="0x00000000004004fb",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffd838"}],file="çêá.c",fullname="/home/pedro/gdb/tests/çêá.c",line="5"},thread-id="1",stopped-threads="all",core="2"
> 
> 
> 
> 
> But with a file named "γλώσσα.c" + "set print sevenbit-strings off":
> 
> *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x00000000004004fb",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffd808"}],file="γλ�\216�\203�\203α.c",fullname="/home/pedro/gdb/tests/γλ�\216�\203�\203α.c",line="5"},thread-id="1",stopped-threads="all",core="3"
> =breakpoint-deleted,id="1"
> (gdb)

I think the 0x7F..0xA0 range is a left-over from the Latin-N era, and
is a bad idea with the current UTF-8 default.

Would something like the following be acceptable (if accompanied with
the suitable changes to NEWS and the manual)?

diff --git a/gdb/utils.c b/gdb/utils.c
index afeff12..56eb9d5 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1509,12 +1509,11 @@ printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
 	   void (*do_fprintf) (struct ui_file *, const char *, ...)
 	   ATTRIBUTE_FPTR_PRINTF_2, struct ui_file *stream, int quoter)
 {
-  c &= 0xFF;			/* Avoid sign bit follies */
+  c &= 0xFF;				/* Avoid sign bit follies */
 
-  if (c < 0x20 ||		/* Low control chars */
-      (c >= 0x7F && c < 0xA0) ||	/* DEL, High controls */
-      (sevenbit_strings && c >= 0x80))
-    {				/* high order bit set */
+  if (c < 0x20 ||			/* Low control chars */
+      (sevenbit_strings && c >= 0x80))	/* High order bit set */
+    {
       switch (c)
 	{
 	case '\n':


  reply	other threads:[~2015-10-09 13:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29  9:18 Eli Zaretskii
2015-09-30 11:52 ` Pedro Alves
2015-09-30 14:34   ` Eli Zaretskii
2015-09-30 14:49     ` Pedro Alves
2015-09-30 15:52       ` Eli Zaretskii
2015-10-09 11:12         ` Pedro Alves
2015-10-09 13:31           ` Eli Zaretskii [this message]
2015-10-09 16:48             ` Pedro Alves
2015-10-09 17:11               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83si5ktbgf.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox