public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC 0/6] Handle several character priniting problems (mainly related to mingw hosts)
@ 2013-09-26 19:54 Pierre Muller
  2013-09-26 19:57 ` [RFC 1/6] Fix display of tabulation character for mingw hosts Pierre Muller
                   ` (8 more replies)
  0 siblings, 9 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-26 19:54 UTC (permalink / raw)
  To: 'gdb-patches'

  This is my first attempt to use git format-patch ...

  It's not yet really easy, but I hope I will get over this 
at some point.

This email is a follow up to
https://sourceware.org/ml/gdb-patches/2013-08/msg00582.html

which was entitled:
PR 15873 UTF-8 incomplete/invalid chars go unnoticed

  Yao asked me to clarify my aim...
https://sourceware.org/ml/gdb-patches/2013-09/msg00722.html

  Which I tried to do in: 
https://sourceware.org/ml/gdb-patches/2013-09/msg00881.html

  This series handles part of the problem
related to display of wide chars inside GDB,
and especially on the numerous failures
you get in testsuite/gdb.base/printcmds.exp
for a mingw compiled GDB.

  This series does not handle the 
part about uniformisation of char versus string output and
warnings about invalid sequences in UTF-8.

Pierre Muller
GDB pascal language maintainer

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate.
  2013-09-26 19:54 [RFC 0/6] Handle several character priniting problems (mainly related to mingw hosts) Pierre Muller
  2013-09-26 19:57 ` [RFC 1/6] Fix display of tabulation character for mingw hosts Pierre Muller
@ 2013-09-26 19:57 ` Pierre Muller
  2013-10-01  1:19   ` Keith Seitz
  2013-09-26 20:01 ` [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command Pierre Muller
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Pierre Muller @ 2013-09-26 19:57 UTC (permalink / raw)
  To: 'gdb-patches'

    If charset is set to UTF-8
p "ABCD\340"
will output
  "ABC" <incomplete sequence \340>

  Note the missing character 'D'.

  This patch solves the issue by checking also for EINVAL
if character have been converted.


Pierre Muller
GDB pascal language maintainer




2013-09-26  Pierre Muller  <muller@sourceware.org>

 	charset.c (wchar_iterate): Also handle converted characters
 	when EINVAL is returned by iconv call.

From 8a93eac07fa4a5c3b9b77832cd6ebb50e2a07d68 Mon Sep 17 00:00:00 2001
From: Pierre Muller <muller@ics.u-strasbg.fr>
Date: Thu, 26 Sep 2013 17:34:01 +0200

---
 gdb/charset.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/charset.c b/gdb/charset.c
index 5835fd4..f0e258c 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -659,7 +659,7 @@ wchar_iterate (struct wchar_iterator *iter,
 		 converted a character; if so, return it.  */
 	      if (out_avail < out_request * sizeof (gdb_wchar_t))
 		break;
-	      
+
 	      /* Otherwise skip the first invalid character, and let
 		 the caller know about it.  */
 	      *out_result = wchar_iterate_invalid;
@@ -687,7 +687,10 @@ wchar_iterate (struct wchar_iterator *iter,
 
 	    case EINVAL:
 	      /* Incomplete input sequence.  Let the caller know, and
-		 arrange for future calls to see EOF.  */
+		 arrange for future calls to see EOF.
+		 Here also we might have converted something.  */
+	      if (out_avail < out_request * sizeof (gdb_wchar_t))
+		break;
 	      *out_result = wchar_iterate_incomplete;
 	      *ptr = iter->input;
 	      *len = iter->bytes;
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [RFC 1/6] Fix display of tabulation character for mingw hosts.
  2013-09-26 19:54 [RFC 0/6] Handle several character priniting problems (mainly related to mingw hosts) Pierre Muller
@ 2013-09-26 19:57 ` Pierre Muller
  2013-10-01  1:19   ` Keith Seitz
  2013-09-26 19:57 ` [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate Pierre Muller
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Pierre Muller @ 2013-09-26 19:57 UTC (permalink / raw)
  To: 'gdb-patches'


  Tabulation characters are sent out to stdout as real tabs
inside mingw compiled GDB.
  This is due to the fact that, contrery to other systems,
msvcrt DLL version of iswprint function returns 1
for tab character.
  This patch solves the issue by implementing a mingw-hdep
specific gdb_iswprint version, which returns 0 for tab char.

  Another possiblity would have been to change the implementation
of print_wchar to handle LCST('\t') before calling gdb_isprint.


Pierre Muller
GDB pascal language maintainer




2013-09-26  Pierre Muller  <muller@sourceware.org>

	Fix display of tabulation character for mingw hosts.
 	* gdb_wchar.h (gdb_iswprint): Declare as external function
 	if __MINGW32__ macro is set.
	* mingw-hdep.c (gdb_iswprint): New function.


From a06acf167fde7fb8502028f83cdfaf64fc2c307b Mon Sep 17 00:00:00 2001
From: Pierre Muller <muller@ics.u-strasbg.fr>
Date: Thu, 26 Sep 2013 16:20:38 +0200
---
 gdb/gdb_wchar.h  |    4 ++++
 gdb/mingw-hdep.c |    9 +++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
index 0e785e8..2d85b5e 100644
--- a/gdb/gdb_wchar.h
+++ b/gdb/gdb_wchar.h
@@ -65,7 +65,11 @@ typedef wchar_t gdb_wchar_t;
 typedef wint_t gdb_wint_t;
 
 #define gdb_wcslen wcslen
+#ifdef __MINGW32__
+extern int gdb_iswprint (gdb_wint_t);
+#else
 #define gdb_iswprint iswprint
+#endif
 #define gdb_iswdigit iswdigit
 #define gdb_btowc btowc
 #define gdb_WEOF WEOF
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index efc9848..976e9e8 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -80,6 +80,15 @@ safe_strerror (int errnum)
 
   return buffer;
 }
+/* Mingw specific version of iswprint to correct
+   difference concerning the tabulation character:
+   msvcrt dll iswprint returns 1 for '\t' while
+   UNIX uiswprint function returns 0 for '\t'.  */
+
+int gdb_iswprint (gdb_wint_t wc)
+{
+  return wc == LCST ('\t') ? 0 : iswprint (wc);
+}
 
 /* Return an absolute file name of the running GDB, if possible, or
    ARGV0 if not.  The return value is in malloc'ed storage.  */
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-26 19:54 [RFC 0/6] Handle several character priniting problems (mainly related to mingw hosts) Pierre Muller
  2013-09-26 19:57 ` [RFC 1/6] Fix display of tabulation character for mingw hosts Pierre Muller
  2013-09-26 19:57 ` [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate Pierre Muller
@ 2013-09-26 20:01 ` Pierre Muller
  2013-09-26 20:03 ` [RFC 4/6] Always set testsuite mode and interactive mode for mingw hosts Pierre Muller
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-26 20:01 UTC (permalink / raw)
  To: 'gdb-patches'

This patch is to add
maint set testsuite mode on/off
command.
  Finally, thanks to Yao's patch about handling of flushing of
stderr for mingw, it reduces to switching the
stdout and stderr between binary and text mode.

   Setting the file handles to binary mode avoid all the trouble
about double ^M that confuses DejaGnu so often when trying to
run the testsuite with a mingw compiled GDB.


Pierre Muller
GDB pascal language maintainer





2013-09-26  Pierre Muller  <muller@sourceware.org>

 	mingw-hdep.c (set_output_binary_mode): New function.
 	(set_output_normal_mode) : New function.
 	(maint_testsuite_mode): New static variable.
	(set_maint_testsuite_mode) : New function.
	(show_maint_testsuite_mode) : New function.
	(_initialize_mingw_hdep): Add "maint set testsuite-mode on/off"
 	command.

	(gdb_call_async_signal_handler):
	(void):


---
 gdb/mingw-hdep.c |   58
++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index 976e9e8..330f46b 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -21,6 +21,8 @@
 #include "main.h"
 #include "serial.h"
 #include "event-loop.h"
+#include "command.h"
+#include "gdbcmd.h"
 
 #include "gdb_assert.h"
 #include "gdb_select.h"
@@ -274,6 +276,50 @@ gdb_call_async_signal_handler (struct
async_signal_handler *handler,
   SetEvent (sigint_event);
 }
 
+/* Set stdout and stderr handles to binary unbuffered mode.  */
+
+static void
+set_output_binary_mode (void)
+{
+  /* In textmode, a '\n' is automatically expanded into "\r\n".  This
+     results in expect seeing "\r\r\n".  The tests aren't prepared
+     currently for other forms of eol.  As a workaround, we force the
+     output to binary mode.  */
+  setmode (fileno (stdout), O_BINARY);
+  setmode (fileno (stderr), O_BINARY);
+}
+
+/* Restore stdout and stderr handles to "normal" mode.  */
+
+static void
+set_output_normal_mode (void)
+{
+  setmode (fileno (stdout), O_TEXT);
+  setmode (fileno (stderr), O_TEXT);
+}
+
+static int maint_testsuite_mode = 0;
+
+/* Sets the maintenance testsuite mode using the static global
+   testuite_mode.  */
+
+static void
+set_maint_testsuite_mode (char *args, int from_tty,
+			       struct cmd_list_element *c)
+{
+  if (maint_testsuite_mode)
+    set_output_binary_mode ();
+  else
+    set_output_normal_mode ();
+}
+
+static void
+show_maint_testsuite_mode (struct ui_file *file, int from_tty,
+		struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Testsuite mode is %s.\n"), value);
+}
+
 /* -Wmissing-prototypes */
 extern initialize_file_ftype _initialize_mingw_hdep;
 
@@ -281,4 +327,16 @@ void
 _initialize_mingw_hdep (void)
 {
   sigint_event = CreateEvent (0, FALSE, FALSE, 0);
+  add_setshow_boolean_cmd ("testsuite-mode", class_maintenance,
+			   &maint_testsuite_mode, _("\
+Set to adapt to dejagnu testsuite runs."), _("\
+Show whether GDB is adapted to run testsuite."), _("\
+Use \"on\" to enable, \"off\" to disable.\n\
+If enabled, stdout and stderr are set to binary mode,\n\
+to allow better testing."),
+			   set_maint_testsuite_mode,
+			   show_maint_testsuite_mode,
+			   &maintenance_set_cmdlist,
+			   &maintenance_show_cmdlist);
+
 }
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [RFC 4/6] Always set testsuite mode and interactive mode for mingw hosts.
  2013-09-26 19:54 [RFC 0/6] Handle several character priniting problems (mainly related to mingw hosts) Pierre Muller
                   ` (2 preceding siblings ...)
  2013-09-26 20:01 ` [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command Pierre Muller
@ 2013-09-26 20:03 ` Pierre Muller
  2013-09-26 20:04 ` [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar Pierre Muller
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-26 20:03 UTC (permalink / raw)
  To: 'gdb-patches'


  In order to get reliable results on mingw compiled GDB,
we still need to convert output mode from text mode to binary mode.
We also need to for GDB to behave interactively, and mingw GDb
do not recognize correctly the pipes used by DejaGnu testsuite
as an interactive setup.


Pierre Muller
GDB pascal language maintainer




2013-09-26  Pierre Muller  <muller@sourceware.org>

 	lib/gdb.exp (mingw hosts): Add "maint set testsuite-mode on" and
 	"set interactive-mode on" to startup commands.


---
 gdb/testsuite/lib/gdb.exp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 5e3331a..031da7e 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -61,6 +61,10 @@ global INTERNAL_GDBFLAGS
 if ![info exists INTERNAL_GDBFLAGS] {
     set INTERNAL_GDBFLAGS "-nw -nx -data-directory $BUILD_DATA_DIRECTORY"
 }
+if [ishost "*-*-mingw*"] {
+    verbose "mingw host, needs testsuite-mode"
+    append INTERNAL_GDBFLAGS " -iex {maint set testsuite-mode on} -iex {set
interactive-mode on}"
+}
 
 # The variable gdb_prompt is a regexp which matches the gdb prompt.
 # Set it if it is not already set.
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar
  2013-09-26 19:54 [RFC 0/6] Handle several character priniting problems (mainly related to mingw hosts) Pierre Muller
                   ` (3 preceding siblings ...)
  2013-09-26 20:03 ` [RFC 4/6] Always set testsuite mode and interactive mode for mingw hosts Pierre Muller
@ 2013-09-26 20:04 ` Pierre Muller
  2013-10-01  1:19   ` Keith Seitz
  2013-09-26 20:05 ` [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts Pierre Muller
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Pierre Muller @ 2013-09-26 20:04 UTC (permalink / raw)
  To: 'gdb-patches'

  When "set print sevenbit-strings on"
is used, all characters above 127 should be displayed as
escapes.

  This patch does just that.


Pierre Muller
GDB pascal language maintainer




2013-09-26  Pierre Muller  <muller@sourceware.org>

 	valprint.c (print_wchar): Honor sevenbit_strings value.

---
 gdb/valprint.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gdb/valprint.c b/gdb/valprint.c
index 0f6d65e..912352c 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1926,9 +1926,10 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig,
   int need_escape = *need_escapep;
 
   *need_escapep = 0;
-  if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
-					    && w != LCST ('8')
-					    && w != LCST ('9'))))
+  if (gdb_iswprint (w)
+      && (!sevenbit_strings || (w > 0 && w < 0x7f))
+      && (!need_escape || (!gdb_iswdigit (w)
+			   && w != LCST ('8') && w != LCST ('9'))))
     {
       gdb_wchar_t wchar = w;
 
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts.
  2013-09-26 19:54 [RFC 0/6] Handle several character priniting problems (mainly related to mingw hosts) Pierre Muller
                   ` (4 preceding siblings ...)
  2013-09-26 20:04 ` [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar Pierre Muller
@ 2013-09-26 20:05 ` Pierre Muller
  2013-10-01  1:19   ` Keith Seitz
       [not found] ` <33207.6293569573$1380225714@news.gmane.org>
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Pierre Muller @ 2013-09-26 20:05 UTC (permalink / raw)
  To: 'gdb-patches'

Subject: [PATCH 

  This last patch fixes the remaining failures in
testsuite/gdb.base/printcmds.exp
for mingw hosts.
  The first part has to do with the fact that GDB prints
the memory address and the closest symbol while the test
doesn't cope for this.
  I simply fixed this by setting/unsetting printing of
addresses and symbols at specific locations.

  The last errors were generated by the use of Ctrl-V
to avoid problems with possible association of @ to kill command.
  mingw GDB doesn't handle this Ctrl-V, so I conditionally removed it for
*-*-mingw* hosts.


Pierre Muller
GDB pascal language maintainer



  
2013-09-26  Pierre Muller  <muller@sourceware.org>

 	printcmds.exp (test_print_trings): Disable  and reenable printing of
	addresses and symbols.
 	(test_artificial_arrays): Disable Ctrl-V use for mingw hosts.


---
 gdb/testsuite/gdb.base/printcmds.exp |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.base/printcmds.exp
b/gdb/testsuite/gdb.base/printcmds.exp
index 60e4a7f..128c5e1 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -488,6 +488,9 @@ proc test_print_strings {} {
 
     # Test that setting print elements unlimited doesn't completely
suppress
     # printing; this was a bug in older gdb's.
+    gdb_test_no_output "set print address off"
+    gdb_test_no_output "set print symbol off"
+
     gdb_test_no_output "set print elements 0"
     gdb_test "p teststring" \
 	" = (.unsigned char .. )?\"teststring contents\"" "p teststring with
elements set to 0"
@@ -504,6 +507,7 @@ proc test_print_strings {} {
     gdb_test "p teststring" \
 	" = (.unsigned char .. )?\"teststring contents\"" "p teststring with
elements set to 20"
 
+    gdb_test_no_output "set print symbol on"
     gdb_test_no_output "set print elements 8"
 
     gdb_test "p &ctable1\[0\]" \
@@ -622,8 +626,14 @@ proc test_print_typedef_arrays {} {
 
 proc test_artificial_arrays {} {
     # Send \026@ instead of just @ in case the kill character is @.
-    gdb_test_escape_braces "p int1dim\[0\]\026@2" " = {0, 1}" {p
int1dim[0]@2}
-    gdb_test_escape_braces "p int1dim\[0\]\026@2\026@3" \
+    # Mingw hosts do not seem to handle this correctly.
+    set ctrlv "\026"
+    if [ishost *-*-mingw*] {
+	set ctrlv ""
+    }
+
+    gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@2" " = {0, 1}" {p
int1dim[0]@2}
+    gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@2${ctrlv}@3" \
 	"({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
 	{p int1dim[0]@2@3}
     gdb_test_escape_braces {p/x (short [])0x12345678} \
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
       [not found] ` <"003201cebaf3$338a8b60$9a9fa220$@muller"@ics-cnrs.unistra.fr>
@ 2013-09-26 20:08   ` Eli Zaretskii
  2013-09-26 20:13     ` Pierre Muller
       [not found]     ` <"003e01cebaf4$e97923e0$bc6b6ba0$@muller"@ics-cnrs.unistra.fr>
  0 siblings, 2 replies; 52+ messages in thread
From: Eli Zaretskii @ 2013-09-26 20:08 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Date: Thu, 26 Sep 2013 22:01:33 +0200
> 
> This patch is to add
> maint set testsuite mode on/off
> command.

Shouldn't this command be supported on all platforms, and be a no-op
on all of them but MinGW?  Otherwise the test suite will fail for
tests that use this setting, won't it?

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-26 20:08   ` [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command Eli Zaretskii
@ 2013-09-26 20:13     ` Pierre Muller
       [not found]     ` <"003e01cebaf4$e97923e0$bc6b6ba0$@muller"@ics-cnrs.unistra.fr>
  1 sibling, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-26 20:13 UTC (permalink / raw)
  To: 'Eli Zaretskii'; +Cc: gdb-patches



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Eli Zaretskii
> Envoyé : jeudi 26 septembre 2013 22:08
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off"
> command.
> 
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > Date: Thu, 26 Sep 2013 22:01:33 +0200
> >
> > This patch is to add
> > maint set testsuite mode on/off
> > command.
> 
> Shouldn't this command be supported on all platforms, and be a no-op
> on all of them but MinGW?  Otherwise the test suite will fail for
> tests that use this setting, won't it?

  Yes, this is indeed a possibility, 
but I think that I suggested this already some time ago,
and that the feedback was not very positive...

  Anyhow, take a look at part 4 of the patch series,
which adds "-iex {maint set testsuite-mode on}" to GDBINTERNALFLAGS
if, and only if, the host is *-*-mingw*.
  This should avoid the problem you raise, no?

Pierre Muller 

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
       [not found]     ` <"003e01cebaf4$e97923e0$bc6b6ba0$@muller"@ics-cnrs.unistra.fr>
@ 2013-09-27  5:52       ` Eli Zaretskii
  2013-09-27  6:53         ` Pierre Muller
  0 siblings, 1 reply; 52+ messages in thread
From: Eli Zaretskii @ 2013-09-27  5:52 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Cc: <gdb-patches@sourceware.org>
> Date: Thu, 26 Sep 2013 22:13:47 +0200
> 
> > Shouldn't this command be supported on all platforms, and be a no-op
> > on all of them but MinGW?  Otherwise the test suite will fail for
> > tests that use this setting, won't it?
> 
>   Yes, this is indeed a possibility, 
> but I think that I suggested this already some time ago,
> and that the feedback was not very positive...
> 
>   Anyhow, take a look at part 4 of the patch series,
> which adds "-iex {maint set testsuite-mode on}" to GDBINTERNALFLAGS
> if, and only if, the host is *-*-mingw*.
>   This should avoid the problem you raise, no?

Yes, but it puts the burden of remembering that on the person who
writes the test, which IMO is sub-optimal.

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-27  5:52       ` Eli Zaretskii
@ 2013-09-27  6:53         ` Pierre Muller
  0 siblings, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-27  6:53 UTC (permalink / raw)
  To: 'Eli Zaretskii'; +Cc: gdb-patches



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Eli Zaretskii
> Envoyé : vendredi 27 septembre 2013 07:52
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off"
> command.
> 
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > Cc: <gdb-patches@sourceware.org>
> > Date: Thu, 26 Sep 2013 22:13:47 +0200
> >
> > > Shouldn't this command be supported on all platforms, and be a no-op
> > > on all of them but MinGW?  Otherwise the test suite will fail for
> > > tests that use this setting, won't it?
> >
> >   Yes, this is indeed a possibility,
> > but I think that I suggested this already some time ago,
> > and that the feedback was not very positive...
> >
> >   Anyhow, take a look at part 4 of the patch series,
> > which adds "-iex {maint set testsuite-mode on}" to GDBINTERNALFLAGS
> > if, and only if, the host is *-*-mingw*.
> >   This should avoid the problem you raise, no?
> 
> Yes, but it puts the burden of remembering that on the person who
> writes the test, which IMO is sub-optimal.

  Hi Eli,

  I don't think so,
this is added at the parsing of lib/gdb.exp,
which means that the additional parameters are automatically
used for all tests if my patch number 4 is correct...

  I must confess that I am still a little bit confused about the subtle
differences
that seem to exist between target, host and build
in the runtest meaning versus the GDB makefiles meaning.

  Example:
  in src/gdb/testsuite,
when I run the tesuite using cygwin environment
for a x86_64-w65-mingw32 host GDB, the
x86_64-w64-mingw32- prefix for the compilers are not passed to the
testsuite,
because they expect that runtest will be run on host, which is the same as
target...
But here we still run dejagnu on build system (cygwin),
and thus runtest uses gcc (cygwin version) instead of x86_64-w64-mingw32-gcc
executable
which of course leads to lots of errors...
  This is why overriding CC_FOR_TARGET and friends is also required to
correctly run
ming host testsuite on cygwin environment.

  I don't know if there is a way to correctly fix this...
especially as host could also be a remote system, that only has mingw
environment,
in such a case, the settings would be correct.

Pierre Muller

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
       [not found] ` <33207.6293569573$1380225714@news.gmane.org>
@ 2013-09-27  8:07   ` asmwarrior
  2013-09-27  8:11     ` asmwarrior
  2013-09-27 15:07   ` Tom Tromey
  1 sibling, 1 reply; 52+ messages in thread
From: asmwarrior @ 2013-09-27  8:07 UTC (permalink / raw)
  To: Pierre Muller, 'gdb-patches'

On 2013-9-27 4:01, Pierre Muller wrote:
> This patch is to add
> maint set testsuite mode on/off
> command.
>   Finally, thanks to Yao's patch about handling of flushing of
> stderr for mingw, it reduces to switching the
> stdout and stderr between binary and text mode.
> 
[SKIP]
> 
> ---
>  gdb/mingw-hdep.c |   58
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 58 insertions(+), 0 deletions(-)
> 
> diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
> index 976e9e8..330f46b 100644
> --- a/gdb/mingw-hdep.c
> +++ b/gdb/mingw-hdep.c
> @@ -21,6 +21,8 @@
>  #include "main.h"
>  #include "serial.h"
>  #include "event-loop.h"
> +#include "command.h"
> +#include "gdbcmd.h"
>  
>  #include "gdb_assert.h"
>  #include "gdb_select.h"
> @@ -274,6 +276,50 @@ gdb_call_async_signal_handler (struct
> async_signal_handler *handler,
>    SetEvent (sigint_event);
>  }
>  

I failed to apply this patch:
Here is the log:

zyh23@ZYH /f/build_gdb/gdb/gdbgit/gdb (my_build)
$ git am ../patches/muller/*.eml
Applying: Fix display of tabulation character for mingw hosts.
Applying: Avoid missing char before incomplete sequence in wchar_iterate.
Applying: mingw-hdep: Add "maint set testuite-mode on/off" command.
fatal: corrupt patch at line 20
Patch failed at 0003 mingw-hdep: Add "maint set testuite-mode on/off" command.
The copy of the patch that failed is found in:
   f:/build_gdb/gdb/gdbgit/gdb/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

I just look at the line around 274, it is:

....
void
gdb_call_async_signal_handler (struct async_signal_handler *handler,
			       int immediate_p)
{
  if (immediate_p)
    sigint_handler = handler;
  else
    {
      mark_async_signal_handler (handler);
      sigint_handler = NULL;
    }
  SetEvent (sigint_event);
}

/* -Wmissing-prototypes */
extern initialize_file_ftype _initialize_mingw_hdep;
.....

So, I can't find the line in your patch
> @@ -274,6 +276,50 @@ gdb_call_async_signal_handler (struct
> async_signal_handler *handler,

Oh, I found that this line (function name and its parameter get wrapped)....
I fix those kind of errors by manually editing those eml files.

Besides that, the last patch, I see the email title have a CRLF after the word "PATCH", so when applied, I see the log message is lost.

So, Sending those patches as attachment should not have such problem.

Thanks

Yuanhui Zhang

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-27  8:07   ` [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command asmwarrior
@ 2013-09-27  8:11     ` asmwarrior
  2013-09-27 12:12       ` Pierre Muller
  0 siblings, 1 reply; 52+ messages in thread
From: asmwarrior @ 2013-09-27  8:11 UTC (permalink / raw)
  To: Pierre Muller, 'gdb-patches'

On 2013-9-27 16:14, asmwarrior wrote:
> I failed to apply this patch:
> Here is the log:
> 
> zyh23@ZYH /f/build_gdb/gdb/gdbgit/gdb (my_build)
> $ git am ../patches/muller/*.eml
> Applying: Fix display of tabulation character for mingw hosts.
> Applying: Avoid missing char before incomplete sequence in wchar_iterate.
> Applying: mingw-hdep: Add "maint set testuite-mode on/off" command.
> fatal: corrupt patch at line 20
> Patch failed at 0003 mingw-hdep: Add "maint set testuite-mode on/off" command.
> The copy of the patch that failed is found in:
>    f:/build_gdb/gdb/gdbgit/gdb/.git/rebase-apply/patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".

BTW: I save your emails to eml files in Thunderbird, under WindowsXP.

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-27  8:11     ` asmwarrior
@ 2013-09-27 12:12       ` Pierre Muller
  0 siblings, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-27 12:12 UTC (permalink / raw)
  To: 'asmwarrior', 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de asmwarrior
> Envoyé : vendredi 27 septembre 2013 10:18
> À : Pierre Muller; 'gdb-patches'
> Objet : Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off"
> command.
> 
> On 2013-9-27 16:14, asmwarrior wrote:
> > I failed to apply this patch:
> > Here is the log:
> >
> > zyh23@ZYH /f/build_gdb/gdb/gdbgit/gdb (my_build)
> > $ git am ../patches/muller/*.eml
> > Applying: Fix display of tabulation character for mingw hosts.
> > Applying: Avoid missing char before incomplete sequence in wchar_iterate.
> > Applying: mingw-hdep: Add "maint set testuite-mode on/off" command.
> > fatal: corrupt patch at line 20
> > Patch failed at 0003 mingw-hdep: Add "maint set testuite-mode on/off"
> command.
> > The copy of the patch that failed is found in:
> >    f:/build_gdb/gdb/gdbgit/gdb/.git/rebase-apply/patch
> > When you have resolved this problem, run "git am --continue".
> > If you prefer to skip this patch, run "git am --skip" instead.
> > To restore the original branch and stop patching, run "git am --abort".

  I know that the automatic insertion of newlines is one of the
major burden with Outlook when pasting the patches directly into the text...
If anyone knows a good tip to avoid this...

  But, on the other hand, I still think that the preferred format
is direct insertion of the patch in the body of the email.

  If anyone has a script to automate the conversion from
patches generate with 'git format-path' to emails ready to be sent with Outlook,
I would be very glad to use them...

  
 
> BTW: I save your emails to eml files in Thunderbird, under WindowsXP.

  The problem is definitively on my side,
and I apologize for the inconvience...

Pierre Muller

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
       [not found] ` <33207.6293569573$1380225714@news.gmane.org>
  2013-09-27  8:07   ` [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command asmwarrior
@ 2013-09-27 15:07   ` Tom Tromey
  2013-09-27 17:42     ` Pierre Muller
       [not found]     ` <5245c3a0.a3e2440a.4b98.ffffd279SMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 2 replies; 52+ messages in thread
From: Tom Tromey @ 2013-09-27 15:07 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre> This patch is to add
Pierre> maint set testsuite mode on/off
Pierre> command.
Pierre>   Finally, thanks to Yao's patch about handling of flushing of
Pierre> stderr for mingw, it reduces to switching the
Pierre> stdout and stderr between binary and text mode.

I thought Yao had a different patch to really fix the problem.

Tom

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar
       [not found] ` <11813.6176527061$1380225854@news.gmane.org>
@ 2013-09-27 15:13   ` Tom Tromey
  2013-09-27 15:23     ` Pierre Muller
  0 siblings, 1 reply; 52+ messages in thread
From: Tom Tromey @ 2013-09-27 15:13 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre>   When "set print sevenbit-strings on"
Pierre> is used, all characters above 127 should be displayed as
Pierre> escapes.

Pierre>   This patch does just that.

Does it fix any test?
If so, could you say which one?
If not, please add a test case.

Do you actually use this setting?  I'm curious.

Tom

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar
  2013-09-27 15:13   ` [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar Tom Tromey
@ 2013-09-27 15:23     ` Pierre Muller
  0 siblings, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-27 15:23 UTC (permalink / raw)
  To: 'Tom Tromey'; +Cc: 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : vendredi 27 septembre 2013 17:14
> À : Pierre Muller
> Cc : 'gdb-patches'
> Objet : Re: [RFC 5/6] Handle "set print sevenbit-strings on" in
print_wchar
> 
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
writes:
> 
> Pierre>   When "set print sevenbit-strings on"
> Pierre> is used, all characters above 127 should be displayed as
> Pierre> escapes.
> 
> Pierre>   This patch does just that.
> 
> Does it fix any test?
  This helps a lot in reducing the number
of failures on mingw hosts for gdb.base/printcmds.exp

https://sourceware.org/bugzilla/show_bug.cgi?id=15873

Basically it all comes from the fact that
by default mingw host GDb have a default charset which allow
to print most chars between 128 and 255 numeric value,
thus leading to failures when printing ctable1[x]
for x in that range.

> If so, could you say which one?
> If not, please add a test case.
  As said, its already in printcmds.exp 
> Do you actually use this setting?  I'm curious.

  I don't but this test does!

Pierre

PS: The fact that the results are better for executables
that have UTF-8 as default charset is an error in my opinion,
as no warning is printed for invalid or incomplete sequence chars!
  But this was in my first by RFC, and I did not yet
resubmit it in this series.

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-27 15:07   ` Tom Tromey
@ 2013-09-27 17:42     ` Pierre Muller
       [not found]     ` <5245c3a0.a3e2440a.4b98.ffffd279SMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-27 17:42 UTC (permalink / raw)
  To: 'Tom Tromey'; +Cc: 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : vendredi 27 septembre 2013 17:08
> À : Pierre Muller
> Cc : 'gdb-patches'
> Objet : Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off"
> command.
> 
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
writes:
> 
> Pierre> This patch is to add
> Pierre> maint set testsuite mode on/off
> Pierre> command.
> Pierre>   Finally, thanks to Yao's patch about handling of flushing of
> Pierre> stderr for mingw, it reduces to switching the
> Pierre> stdout and stderr between binary and text mode.
> 
> I thought Yao had a different patch to really fix the problem.
   Yao posted a while ago a first proposition where
stdout and stderr would be set to binary at start, even if normal
usage (i.e. outside of the testsuite environment).

https://sourceware.org/ml/gdb-patches/2013-08/msg00337.html

But later, he came with another (old) idea of 
allowing the testsuite to accept one or two \r before the \n.

https://sourceware.org/ml/gdb-patches/2013-09/msg00497.html

But, honestly,  given the time I spent on it a few years ago, I doubt
that this is an easier route...

That is the reason of this proposal.


Pierre Muller

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
       [not found]     ` <5245c3a0.a3e2440a.4b98.ffffd279SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2013-09-27 19:36       ` Pedro Alves
  2013-09-27 19:40         ` Pedro Alves
  2013-09-29 13:45         ` Yao Qi
  0 siblings, 2 replies; 52+ messages in thread
From: Pedro Alves @ 2013-09-27 19:36 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'Tom Tromey', 'gdb-patches'

On 09/27/2013 06:42 PM, Pierre Muller wrote:

>> I thought Yao had a different patch to really fix the problem.
>    Yao posted a while ago a first proposition where
> stdout and stderr would be set to binary at start, even if normal
> usage (i.e. outside of the testsuite environment).
> 
> https://sourceware.org/ml/gdb-patches/2013-08/msg00337.html
> 
> But later, he came with another (old) idea of 
> allowing the testsuite to accept one or two \r before the \n.
> 
> https://sourceware.org/ml/gdb-patches/2013-09/msg00497.html
> 
> But, honestly,  given the time I spent on it a few years ago, I doubt
> that this is an easier route...
> 
> That is the reason of this proposal.

There was also a promising tcl/expect know that is supposed to
disable the unnecessary \n -> \r\n translation...

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-27 19:36       ` Pedro Alves
@ 2013-09-27 19:40         ` Pedro Alves
  2013-09-27 21:12           ` Pierre Muller
  2013-09-29 13:45         ` Yao Qi
  1 sibling, 1 reply; 52+ messages in thread
From: Pedro Alves @ 2013-09-27 19:40 UTC (permalink / raw)
  Cc: Pierre Muller, 'Tom Tromey', 'gdb-patches'

On 09/27/2013 08:36 PM, Pedro Alves wrote:

> There was also a promising tcl/expect know that is supposed to
> disable the unnecessary \n -> \r\n translation...

Sigh...  s/know/knob/

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-27 19:40         ` Pedro Alves
@ 2013-09-27 21:12           ` Pierre Muller
  0 siblings, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-27 21:12 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: 'Tom Tromey', 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : vendredi 27 septembre 2013 21:39
> Cc : Pierre Muller; 'Tom Tromey'; 'gdb-patches'
> Objet : Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off"
> command.
> 
> On 09/27/2013 08:36 PM, Pedro Alves wrote:
> 
> > There was also a promising tcl/expect know that is supposed to
> > disable the unnecessary \n -> \r\n translation...
> 
> Sigh...  s/know/knob/
Yes, I know, this was also another suggestion I made,
but I have still no clue how to use it inside DejaGnu :(

Pierre Muller

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-27 19:36       ` Pedro Alves
  2013-09-27 19:40         ` Pedro Alves
@ 2013-09-29 13:45         ` Yao Qi
  2013-09-29 18:51           ` Pedro Alves
  1 sibling, 1 reply; 52+ messages in thread
From: Yao Qi @ 2013-09-29 13:45 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Pierre Muller, 'Tom Tromey', 'gdb-patches'

On 09/28/2013 03:36 AM, Pedro Alves wrote:
> There was also a promising tcl/expect know that is supposed to
> disable the unnecessary \n -> \r\n translation...

What is that?  Can you elaborate?

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-29 13:45         ` Yao Qi
@ 2013-09-29 18:51           ` Pedro Alves
  2013-09-29 23:00             ` Pierre Muller
       [not found]             ` <10148.9390749068$1380495630@news.gmane.org>
  0 siblings, 2 replies; 52+ messages in thread
From: Pedro Alves @ 2013-09-29 18:51 UTC (permalink / raw)
  To: Yao Qi; +Cc: Pierre Muller, 'Tom Tromey', 'gdb-patches'

On 09/29/2013 02:44 PM, Yao Qi wrote:
> On 09/28/2013 03:36 AM, Pedro Alves wrote:
>> There was also a promising tcl/expect know that is supposed to 
>> disable the unnecessary \n -> \r\n translation...
> 
> What is that?  Can you elaborate?
> 

https://sourceware.org/ml/gdb-patches/2013-09/msg00612.html

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-29 18:51           ` Pedro Alves
@ 2013-09-29 23:00             ` Pierre Muller
  2013-09-30  9:38               ` Pedro Alves
                                 ` (2 more replies)
       [not found]             ` <10148.9390749068$1380495630@news.gmane.org>
  1 sibling, 3 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-29 23:00 UTC (permalink / raw)
  To: 'Pedro Alves', 'Yao Qi'
  Cc: 'Tom Tromey', 'gdb-patches'

I found out that this patch

$ cvs diff -up
cvs diff: Diffing .
Index: gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.246
diff -u -p -r1.246 gdb.exp
--- gdb.exp     20 Sep 2013 21:47:05 -0000      1.246
+++ gdb.exp     29 Sep 2013 22:50:10 -0000
@@ -1454,6 +1454,9 @@ proc default_gdb_start { } {
        perror "Spawning $GDB failed."
        return 1
     }
+    if [ishost "*-*-mingw*"] {
+       fconfigure $res -translation {crlf crlf}
+    }
     gdb_expect 360 {
        -re "\[\r\n\]$gdb_prompt $" {
            verbose "GDB initialized."


works... but only for cygwin dejagnu...

It doesn't on the dejagnu I found for msys system :(
After a looong debugging, it seems to turn out to be because

(on msys)$ runtest --version
WARNING: Couldn't find the global config file.
Expect version is       5.26
Tcl version is          8.4
Framework version is    1.4.2.x

while on cygwin:
$ runtest --version
Expect version is       5.45
Tcl version is          8.5
Framework version is    1.5

Which leads to the fact that remote_spawn directly calls spawn in 5.26,
while it uses open command in version 5.45...
The problem is that only the open command returns a channeled suitable for
fconfigure...
which leads to the following error on msys:

ERROR: tcl error sourcing ../../../puresrc/gdb/testsuite/gdb.base/co1.exp.
ERROR: can not find channel named "6"
    while executing
"fconfigure $res -translation {crlf crlf}"
    invoked from within
"if [ishost "*-*-mingw*"] {
        fconfigure $res -translation {crlf crlf}
    }"
    (procedure "default_gdb_start" line 37)
    invoked from within
"default_gdb_start"
    (procedure "gdb_start" line 2)
    invoked from within
"gdb_start"
    (procedure "clean_restart" line 7)
    invoked from within
"clean_restart $executable"
    (procedure "prepare_for_testing" line 6)
    invoked from within
"prepare_for_testing $testfile.exp $testfile  [list $srcfile $srcfile2] {debug n
owarnings}"
    (file "../../../puresrc/gdb/testsuite/gdb.base/co1.exp" line 1)
    ("uplevel" body line 1)
    invoked from within
"catch "uplevel #0 source $test_file_name""

Any suggestions, other that throwing away the old dejagnu ...
Of course, if someone as a more recent dejagnu for msys, 
I am all for it!


Pierre Muller

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : dimanche 29 septembre 2013 20:51
> À : Yao Qi
> Cc : Pierre Muller; 'Tom Tromey'; 'gdb-patches'
> Objet : Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off"
> command.
> 
> On 09/29/2013 02:44 PM, Yao Qi wrote:
> > On 09/28/2013 03:36 AM, Pedro Alves wrote:
> >> There was also a promising tcl/expect know that is supposed to
> >> disable the unnecessary \n -> \r\n translation...
> >
> > What is that?  Can you elaborate?
> >
> 
> https://sourceware.org/ml/gdb-patches/2013-09/msg00612.html
> 
> --
> Pedro Alves

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
       [not found]             ` <10148.9390749068$1380495630@news.gmane.org>
@ 2013-09-29 23:54               ` asmwarrior
  2013-09-30 19:23               ` Tom Tromey
  1 sibling, 0 replies; 52+ messages in thread
From: asmwarrior @ 2013-09-29 23:54 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 2013-9-30 6:57, Pierre Muller wrote:
> (on msys)$ runtest --version
> WARNING: Couldn't find the global config file.
> Expect version is       5.26
> Tcl version is          8.4
> Framework version is    1.4.2.x
> 
> while on cygwin:
> $ runtest --version
> Expect version is       5.45
> Tcl version is          8.5
> Framework version is    1.5
Hi, Pierre
You can try the new MSYS2 from:
https://sourceforge.net/projects/msys2/
It is a project supported by MinGW-w64 project, so discussion are in there maillist.
It has code ported from latest cygwin, also support x64 and x32.
The latest 32 bit version is: x32-msys2-develop-20130909.tar.xz

Here is the result:

$ runtest --version
WARNING: Couldn't find the global config file.
Expect version is       5.45
Tcl version is          8.5
Framework version is    1.5.1

I have not tried this msys2 to build GDB, but as I know, someone has already use msys2 to build clang or other projects.

Yuanhui Zhang

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-29 23:00             ` Pierre Muller
@ 2013-09-30  9:38               ` Pedro Alves
  2013-09-30 12:33               ` Yao Qi
  2013-10-01 19:42               ` Keith Seitz
  2 siblings, 0 replies; 52+ messages in thread
From: Pedro Alves @ 2013-09-30  9:38 UTC (permalink / raw)
  To: Pierre Muller
  Cc: 'Yao Qi', 'Tom Tromey', 'gdb-patches'

On 09/29/2013 11:57 PM, Pierre Muller wrote:
> I found out that this patch
> 
> $ cvs diff -up
> cvs diff: Diffing .
> Index: gdb.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
> retrieving revision 1.246
> diff -u -p -r1.246 gdb.exp
> --- gdb.exp     20 Sep 2013 21:47:05 -0000      1.246
> +++ gdb.exp     29 Sep 2013 22:50:10 -0000
> @@ -1454,6 +1454,9 @@ proc default_gdb_start { } {
>         perror "Spawning $GDB failed."
>         return 1
>      }
> +    if [ishost "*-*-mingw*"] {
> +       fconfigure $res -translation {crlf crlf}
> +    }
>      gdb_expect 360 {
>         -re "\[\r\n\]$gdb_prompt $" {
>             verbose "GDB initialized."
> 
> 
> works... 

That's great news!

> but only for cygwin dejagnu...
> 
> It doesn't on the dejagnu I found for msys system :(
> After a looong debugging, it seems to turn out to be because
> 
> (on msys)$ runtest --version
> WARNING: Couldn't find the global config file.
> Expect version is       5.26
> Tcl version is          8.4
> Framework version is    1.4.2.x
> 
> while on cygwin:
> $ runtest --version
> Expect version is       5.45
> Tcl version is          8.5
> Framework version is    1.5
> 
> Which leads to the fact that remote_spawn directly calls spawn in 5.26,
> while it uses open command in version 5.45...
> The problem is that only the open command returns a channeled suitable for
> fconfigure...
> which leads to the following error on msys:
> 
> ERROR: tcl error sourcing ../../../puresrc/gdb/testsuite/gdb.base/co1.exp.
> ERROR: can not find channel named "6"
>     while executing
> "fconfigure $res -translation {crlf crlf}"
>     invoked from within
> "if [ishost "*-*-mingw*"] {
>         fconfigure $res -translation {crlf crlf}
>     }"
>     (procedure "default_gdb_start" line 37)
>     invoked from within
> "default_gdb_start"
>     (procedure "gdb_start" line 2)
>     invoked from within
> "gdb_start"
>     (procedure "clean_restart" line 7)
>     invoked from within
> "clean_restart $executable"
>     (procedure "prepare_for_testing" line 6)
>     invoked from within
> "prepare_for_testing $testfile.exp $testfile  [list $srcfile $srcfile2] {debug n
> owarnings}"
>     (file "../../../puresrc/gdb/testsuite/gdb.base/co1.exp" line 1)
>     ("uplevel" body line 1)
>     invoked from within
> "catch "uplevel #0 source $test_file_name""
> 
> Any suggestions, other that throwing away the old dejagnu ...

You can always try overriding remote_spawn -- in tcl, whatever definition
of a procedure is loaded last overrides previous definitions.  You could try
copying new newer remote_spawn that uses open to your board file.  Or copy
the older remote_spawn, and tweak it just enough to use open.  I have no idea
if that would require a cascading series of replacements or other functions,
but maybe still worth a try.

But, anyway, if an easy workaround is not found, just requiring a
newer dejagnu is reasonable and the way to go, IMO.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-29 23:00             ` Pierre Muller
  2013-09-30  9:38               ` Pedro Alves
@ 2013-09-30 12:33               ` Yao Qi
  2013-10-01 19:42               ` Keith Seitz
  2 siblings, 0 replies; 52+ messages in thread
From: Yao Qi @ 2013-09-30 12:33 UTC (permalink / raw)
  To: Pierre Muller
  Cc: 'Pedro Alves', 'Tom Tromey', 'gdb-patches'

On 09/30/2013 06:57 AM, Pierre Muller wrote:
> Which leads to the fact that remote_spawn directly calls spawn in 5.26,
> while it uses open command in version 5.45...
> The problem is that only the open command returns a channeled suitable for
> fconfigure...
> which leads to the following error on msys:

Pierre,
I am a little confused by the difference causing the error.  Is it 
Expect or dejagnu?  I diff proc remote_spawn in lib/remote.exp in 
dejagnu of version 1.4.2 and 1.5, but I don't find the difference you 
described.  Am I missing something?

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
       [not found]             ` <10148.9390749068$1380495630@news.gmane.org>
  2013-09-29 23:54               ` asmwarrior
@ 2013-09-30 19:23               ` Tom Tromey
  2013-09-30 19:34                 ` Eli Zaretskii
  1 sibling, 1 reply; 52+ messages in thread
From: Tom Tromey @ 2013-09-30 19:23 UTC (permalink / raw)
  To: Pierre Muller
  Cc: 'Pedro Alves', 'Yao Qi', 'gdb-patches'

Pierre> (on msys)$ runtest --version
Pierre> WARNING: Couldn't find the global config file.
Pierre> Expect version is       5.26

Pierre> while on cygwin:
Pierre> $ runtest --version
Pierre> Expect version is       5.45

I wonder whether some version between the two works.

5.26 was released in 1998 -- so, it is ancient.  It's reasonable to
require something newer.

5.45 was released in 2010.  I think it is reasonable enough to require
this version.

Tom

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-30 19:23               ` Tom Tromey
@ 2013-09-30 19:34                 ` Eli Zaretskii
  2013-09-30 19:45                   ` Pedro Alves
  0 siblings, 1 reply; 52+ messages in thread
From: Eli Zaretskii @ 2013-09-30 19:34 UTC (permalink / raw)
  To: Tom Tromey; +Cc: pierre.muller, palves, yao, gdb-patches

> From: Tom Tromey <tromey@redhat.com>
> Cc: "'Pedro Alves'" <palves@redhat.com>, "'Yao Qi'" <yao@codesourcery.com>,        "'gdb-patches'" <gdb-patches@sourceware.org>
> Date: Mon, 30 Sep 2013 13:22:57 -0600
> 
> 5.26 was released in 1998 -- so, it is ancient.  It's reasonable to
> require something newer.

What if MSYS provides no newer versions?

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-30 19:34                 ` Eli Zaretskii
@ 2013-09-30 19:45                   ` Pedro Alves
  2013-09-30 22:41                     ` Pierre Muller
  0 siblings, 1 reply; 52+ messages in thread
From: Pedro Alves @ 2013-09-30 19:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Tom Tromey, pierre.muller, yao, gdb-patches

On 09/30/2013 08:34 PM, Eli Zaretskii wrote:
>> From: Tom Tromey <tromey@redhat.com>
>> Cc: "'Pedro Alves'" <palves@redhat.com>, "'Yao Qi'" <yao@codesourcery.com>,        "'gdb-patches'" <gdb-patches@sourceware.org>
>> Date: Mon, 30 Sep 2013 13:22:57 -0600
>>
>> 5.26 was released in 1998 -- so, it is ancient.  It's reasonable to
>> require something newer.
> 
> What if MSYS provides no newer versions?

Somebody should work on providing it, IMO, if they want to
run the testsuite against it.  (this is testing we're talking about,
not building GDB itself).  I'm familiar with the history behind MSYS (old
Cygwin fork, etc.), but this not really a core MSYS component one would
assume would require a bunch of effort to compile for MSYS -- I'd imagine
it not to be hard.  Maybe a few patches to forward port, if any.  Then
we'd just need a wiki page explaining the whole 'testing Windows GDB under
Cygwin or MSYS' -- a good idea regardless, IMO.

(The MSYS-redone-on-top-of-newer-cygwin-as-a-sort-of-plugin/mode effort
will hopefully make these MSYS-stuck-in-the-dark-ages issues all be
history sooner than later).

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-30 19:45                   ` Pedro Alves
@ 2013-09-30 22:41                     ` Pierre Muller
  0 siblings, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-09-30 22:41 UTC (permalink / raw)
  To: 'Pedro Alves', 'Eli Zaretskii'
  Cc: 'Tom Tromey', yao, gdb-patches



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : lundi 30 septembre 2013 21:45
> À : Eli Zaretskii
> Cc : Tom Tromey; pierre.muller@ics-cnrs.unistra.fr; yao@codesourcery.com;
> gdb-patches@sourceware.org
> Objet : Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off"
> command.
> 
> On 09/30/2013 08:34 PM, Eli Zaretskii wrote:
> >> From: Tom Tromey <tromey@redhat.com>
> >> Cc: "'Pedro Alves'" <palves@redhat.com>, "'Yao Qi'"
> <yao@codesourcery.com>,        "'gdb-patches'"
<gdb-patches@sourceware.org>
> >> Date: Mon, 30 Sep 2013 13:22:57 -0600
> >>
> >> 5.26 was released in 1998 -- so, it is ancient.  It's reasonable to
> >> require something newer.
> >
> > What if MSYS provides no newer versions?
> 
> Somebody should work on providing it, IMO, if they want to
> run the testsuite against it.  (this is testing we're talking about,
> not building GDB itself).  I'm familiar with the history behind MSYS (old
> Cygwin fork, etc.), but this not really a core MSYS component one would
> assume would require a bunch of effort to compile for MSYS -- I'd imagine
> it not to be hard.  Maybe a few patches to forward port, if any.  Then
> we'd just need a wiki page explaining the whole 'testing Windows GDB under
> Cygwin or MSYS' -- a good idea regardless, IMO.

  I must confess that I am now totally confused :(
Even with cygwin shell I have problems...

  I was hoping that this would be the correct solution to the mingw host
GDBs testsuite runs... But I am really unable to get it to work...
  I tried 
  fconfigure $res -translation  {XXX YYY}
By default is seems to be {lf lf} (this can be seen by adding verbose
"[fconfigure $res]"
The first is supposed to change the input channel behavior and the second
the output channel behavior..
but changing only the first from lf to crlf, I get
a removal of the second ^M in the output produced by GDB (which is good)
but also a change in the strings sent to GDB "set args" in
gdb.base/a2-run.exp
in gdb_test_no_output is sent as "set args\n" instead of "set args\r\n"
which is BAD :(

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 1/6] Fix display of tabulation character for mingw hosts.
  2013-09-26 19:57 ` [RFC 1/6] Fix display of tabulation character for mingw hosts Pierre Muller
@ 2013-10-01  1:19   ` Keith Seitz
  2013-10-01  8:02     ` [RFC 1/6 -V2] " Pierre Muller
       [not found]     ` <10182.1932978512$1380614580@news.gmane.org>
  0 siblings, 2 replies; 52+ messages in thread
From: Keith Seitz @ 2013-10-01  1:19 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 09/26/2013 12:56 PM, Pierre Muller wrote:
> 2013-09-26  Pierre Muller  <muller@sourceware.org>
>
> 	Fix display of tabulation character for mingw hosts.
                                                 ^^^^^
Probably want to keep this a little formal and use "MinGW".

>   	* gdb_wchar.h (gdb_iswprint): Declare as external function
>   	if __MINGW32__ macro is set.
> 	* mingw-hdep.c (gdb_iswprint): New function.

I think this is a reasonable approach, but it will break builds that 
don't have a working/good iconv (amongst other reasons). I noticed this 
attempting to build --build=i686-unknown-linux 
--target=--host=i686-pc-mingw32:

../../gdb/gdb/mingw-hdep.c:88:5: error: 'isprint' redeclared without 
dllimport attribute: previous dllimport ignored [-Werror=attributes]

This happens because we end up in the very last section of gdb_wchar.h 
("If we got here and have wchar_t support, we might be on a system with 
some problem.  So, we just disable everything.") and that does:

#define gdb_iswprint isprint

 > +/* Mingw specific version of iswprint to correct

"MinGW-specific"

 > +   difference concerning the tabulation character:
 > +   msvcrt dll iswprint returns 1 for '\t' while
 > +   UNIX uiswprint function returns 0 for '\t'.  */
 > +
 > +int gdb_iswprint (gdb_wint_t wc)
    ^^^^^^^^^^^^^^^^^
 > +{
 > +  return wc == LCST ('\t') ? 0 : iswprint (wc);
 > +}

The return type should be on a line by itself and the function name 
should start in column zero. Also please double-check that there is a 
newline between the closing brace of safe_strerror and the comment for 
this new function. [Maybe your patch got munged a bit?]

Does this fix the output of many tests in the test suite already? If 
not, it would be really, really nice to have a test to check (and 
demonstrate) this quirk.

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar
  2013-09-26 20:04 ` [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar Pierre Muller
@ 2013-10-01  1:19   ` Keith Seitz
  2013-10-01 13:23     ` Pierre Muller
  0 siblings, 1 reply; 52+ messages in thread
From: Keith Seitz @ 2013-10-01  1:19 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 09/26/2013 01:03 PM, Pierre Muller wrote:

> 2013-09-26  Pierre Muller  <muller@sourceware.org>
>
>   	valprint.c (print_wchar): Honor sevenbit_strings value.
>

[Your ChangeLog entry got munged...] I would prefer that you ChangeLog 
entry be a little more explicit about what changed, e.g., "Print escaped 
characters if sevenbit-strings is set."

I think this patch is okay, but it definitely needs a test (and a 
maintainer to approve). It took me a non-trivial amount of time to 
actually get the patch to show any difference in the output.

The trick (on linux) was changing the charset to something where 
(char)0x80 and up are printable characters. I used CP1252, and then I 
could see what this patch actually did.

Perhaps this can be used in a test that will run on more than just MinGW 
hosts.

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate.
  2013-09-26 19:57 ` [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate Pierre Muller
@ 2013-10-01  1:19   ` Keith Seitz
  2013-10-01 12:48     ` Pierre Muller
       [not found]     ` <33559.6669152894$1380631692@news.gmane.org>
  0 siblings, 2 replies; 52+ messages in thread
From: Keith Seitz @ 2013-10-01  1:19 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 09/26/2013 12:57 PM, Pierre Muller wrote:
>      If charset is set to UTF-8
> p "ABCD\340"
> will output
>    "ABC" <incomplete sequence \340>
>
>    Note the missing character 'D'.
>
>    This patch solves the issue by checking also for EINVAL
> if character have been converted.

This looks okay to me, but it needs a test (and a maintainer to approve).

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts.
  2013-09-26 20:05 ` [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts Pierre Muller
@ 2013-10-01  1:19   ` Keith Seitz
  2013-10-01 13:39     ` Pierre Muller
  0 siblings, 1 reply; 52+ messages in thread
From: Keith Seitz @ 2013-10-01  1:19 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

Hi, Pierre,

On 09/26/2013 01:04 PM, Pierre Muller wrote:
>    The first part has to do with the fact that GDB prints
> the memory address and the closest symbol while the test
> doesn't cope for this.
>    I simply fixed this by setting/unsetting printing of
> addresses and symbols at specific locations.

Can you provide an example? I notice no difference on linux with/without 
those options set. Is the output really different on MinGW? [I wouldn't 
have guessed that they are.]

In any case, this bit seems harmless enough. If you say it fixes 
problems, I believe you, and I'm all for it!

>    The last errors were generated by the use of Ctrl-V
> to avoid problems with possible association of @ to kill command.
>    mingw GDB doesn't handle this Ctrl-V, so I conditionally removed it for
> *-*-mingw* hosts.

This isn't so much a question for you specifically, but I thought I'd 
throw this out to the greater wisdom of the list.

I searched around the test suite and found a bunch of places where this 
character is used without the ^V hack. Is it (still) necessary at all? 
Perhaps we can just get rid of it entirely?

Otherwise, given the harmless nature of the changes, I'd recommend that 
a maintainer approve this.

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [RFC 1/6 -V2] Fix display of tabulation character for mingw hosts.
  2013-10-01  1:19   ` Keith Seitz
@ 2013-10-01  8:02     ` Pierre Muller
  2013-10-22 18:24       ` Keith Seitz
       [not found]     ` <10182.1932978512$1380614580@news.gmane.org>
  1 sibling, 1 reply; 52+ messages in thread
From: Pierre Muller @ 2013-10-01  8:02 UTC (permalink / raw)
  To: 'Keith Seitz'; +Cc: 'gdb-patches'

  Hi Keith,

  Thanks a lot for this review.

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Keith Seitz
> Envoyé : mardi 1 octobre 2013 03:19
> À : Pierre Muller
> Cc : 'gdb-patches'
> Objet : Re: [RFC 1/6] Fix display of tabulation character for mingw hosts.
> 
> On 09/26/2013 12:56 PM, Pierre Muller wrote:
> > 2013-09-26  Pierre Muller  <muller@sourceware.org>
> >
> > 	Fix display of tabulation character for mingw hosts.
>                                                  ^^^^^
> Probably want to keep this a little formal and use "MinGW".

  
 
> >   	* gdb_wchar.h (gdb_iswprint): Declare as external function
> >   	if __MINGW32__ macro is set.
> > 	* mingw-hdep.c (gdb_iswprint): New function.
> 
> I think this is a reasonable approach, but it will break builds that
> don't have a working/good iconv (amongst other reasons). I noticed this
> attempting to build --build=i686-unknown-linux
> --target=--host=i686-pc-mingw32:
> 
> ../../gdb/gdb/mingw-hdep.c:88:5: error: 'isprint' redeclared without
> dllimport attribute: previous dllimport ignored [-Werror=attributes]

  Yes, I also noticed this, but too late.
I checked and the msvcvrt DLL function isprint does not return 1 for
tabulation...
So the fix is only needed for the wide char version.

 
> This happens because we end up in the very last section of gdb_wchar.h
> ("If we got here and have wchar_t support, we might be on a system with
> some problem.  So, we just disable everything.") and that does:
> 
> #define gdb_iswprint isprint
> 
>  > +/* Mingw specific version of iswprint to correct
> 
> "MinGW-specific"
  Whoops, I hadn't noticed that this was always capitalized like that...
 
>  > +   difference concerning the tabulation character:
>  > +   msvcrt dll iswprint returns 1 for '\t' while
>  > +   UNIX uiswprint function returns 0 for '\t'.  */
>  > +
>  > +int gdb_iswprint (gdb_wint_t wc)
>     ^^^^^^^^^^^^^^^^^
>  > +{
>  > +  return wc == LCST ('\t') ? 0 : iswprint (wc);
>  > +}
> 
> The return type should be on a line by itself and the function name
> should start in column zero. Also please double-check that there is a
> newline between the closing brace of safe_strerror and the comment for
> this new function. [Maybe your patch got munged a bit?]

  Yes, I must confess that I broke more coding style rules
than I usually do here, sorry about that...

 
> Does this fix the output of many tests in the test suite already? If
> not, it would be really, really nice to have a test to check (and
> demonstrate) this quirk.

It does fix 2 failures inside printcmds.exp

288-p ctable1[9]
289:$50 = 9 '\t'
290-(gdb) PASS: gdb.base/printcmds.exp: p ctable1[9]
291-p ctable1[10]
292-$51 = 10 '\n'
--
1869-$560 = (unsigned char *) <ctable1+1> "\001\002\003\004\005\006\a\b"...
1870-(gdb) PASS: gdb.base/printcmds.exp: p &ctable1[1]
1871-p &ctable1[1*8]
1872:$561 = (unsigned char *) <ctable1+8> "\b\t\n\v\f\r\016\017"...
1873-(gdb) PASS: gdb.base/printcmds.exp: p &ctable1[1*8]
1874-p &ctable1[2*8]
1875-$562 = (unsigned char *) <ctable1+16>
"\020\021\022\023\024\025\026\027"...

Is this enough?

  Here is a new patch version.
To avoid the very complicated preprocessor checks that decides if we
use wide chars inside gdb_wchar.h, I added a new macro
HAVE_MINGW_GDB_ISWPRINT.
  While the idea seems good to me, I am unsure about the choice
of this macro name, are there similar examples already inside the code?



Pierre

ChangeLog entry:

2013-10-01  Pierre Muller <muller@sourceware.org>

 	Fix display of tabulation character for MinGW hosts.
 	* gdb_wchar.h (gdb_iswprint): Declare as external function
 	if __MINGW32__ macro is set.
	(HAVE_MINGW_GDB_ISWPRINT): New macro, declared only for
 	MinGW hosts using wide characters.
 	* mingw-hdep.c (gdb_iswprint): New function.
	Implemented only if HAVE_MINGW_GDB_ISWPRINT macro is defined.

---
 gdb/gdb_wchar.h  |    5 +++++
 gdb/mingw-hdep.c |   13 +++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
index 0e785e8..9a07da2 100644
--- a/gdb/gdb_wchar.h
+++ b/gdb/gdb_wchar.h
@@ -65,7 +65,12 @@ typedef wchar_t gdb_wchar_t;
 typedef wint_t gdb_wint_t;
 
 #define gdb_wcslen wcslen
+#ifdef __MINGW32__
+#define HAVE_MINGW_GDB_ISWPRINT
+extern int gdb_iswprint (gdb_wint_t);
+#else
 #define gdb_iswprint iswprint
+#endif
 #define gdb_iswdigit iswdigit
 #define gdb_btowc btowc
 #define gdb_WEOF WEOF
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index efc9848..86d0023 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -81,6 +81,19 @@ safe_strerror (int errnum)
   return buffer;
 }
 
+#ifdef HAVE_MINGW_GDB_ISWPRINT
+/* MinGW-specific version of iswprint to correct
+   difference concerning the tabulation character:
+   msvcrt dll iswprint returns 1 for '\t' while
+   UNIX uiswprint function returns 0 for '\t'.  */
+
+int
+gdb_iswprint (gdb_wint_t wc)
+{
+  return wc == LCST ('\t') ? 0 : iswprint (wc);
+}
+#endif
+
 /* Return an absolute file name of the running GDB, if possible, or
    ARGV0 if not.  The return value is in malloc'ed storage.  */
 
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate.
  2013-10-01  1:19   ` Keith Seitz
@ 2013-10-01 12:48     ` Pierre Muller
  2013-10-22 18:25       ` Keith Seitz
       [not found]     ` <33559.6669152894$1380631692@news.gmane.org>
  1 sibling, 1 reply; 52+ messages in thread
From: Pierre Muller @ 2013-10-01 12:48 UTC (permalink / raw)
  To: 'Keith Seitz'; +Cc: 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Keith Seitz
> Envoyé : mardi 1 octobre 2013 03:19
> À : Pierre Muller
> Cc : 'gdb-patches'
> Objet : Re: [RFC 2/6] Avoid missing char before incomplete sequence in
> wchar_iterate.
> 
> On 09/26/2013 12:57 PM, Pierre Muller wrote:
> >      If charset is set to UTF-8
> > p "ABCD\340"
> > will output
> >    "ABC" <incomplete sequence \340>
> >
> >    Note the missing character 'D'.
> >
> >    This patch solves the issue by checking also for EINVAL
> > if character have been converted.
> 
> This looks okay to me, but it needs a test (and a maintainer to approve).
> 
> Keith

Here is a test, maybe this is overkill...
  On a linux machine with charset set to UTF-8,
I do get failures, but not all are related to the fix in the patch...
Some are due to the fact that <incomplete sequence is printed out..
Nevertheless, incomplete_LSE, incomplete_RSE and incomplete_SSE
do show one missing char.

FAIL: gdb.base/printcmds.exp: print incomplete_LLE
FAIL: gdb.base/printcmds.exp: print incomplete_RLE
FAIL: gdb.base/printcmds.exp: print incomplete_SLE
FAIL: gdb.base/printcmds.exp: print incomplete_LRE
FAIL: gdb.base/printcmds.exp: print incomplete_RRE
FAIL: gdb.base/printcmds.exp: print incomplete_SRE
FAIL: gdb.base/printcmds.exp: print incomplete_LSE
FAIL: gdb.base/printcmds.exp: print incomplete_RSE
FAIL: gdb.base/printcmds.exp: print incomplete_SSE


Pierre Muller

PS: One missing thing is the re-indentation of the exp
file for the additional foreach loop...
But using vim in visual mode and '>' command 
added directly 8 spaces, instead of 4...
Doing all that by hand is really frustrating...
Should .exp files be treated differently from other tcl files?




gdb Changelog entry:

2013-10-01  Pierre Muller  <muller@sourceware.org>

	charset.c (wchar_iterate): Also handle converted characters
 	when EINVAL is returned by iconv call.

testsuite Changelog entry:

2013-10-01  Pierre Muller  <muller@sourceware.org>

	* gdb.base/printcmds.c: Add strings with incomplete sequence.
	* gdb.base/printcmds.exp (test_repeat_bytes): Check output of 
	strings containing incomplete sequence.

---
 gdb/charset.c                        |    7 ++-
 gdb/testsuite/gdb.base/printcmds.c   |   82
++++++++++++++++++++++++++++++++++
 gdb/testsuite/gdb.base/printcmds.exp |   19 ++++++--
 3 files changed, 101 insertions(+), 7 deletions(-)

diff --git a/gdb/charset.c b/gdb/charset.c
index 5835fd4..f0e258c 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -659,7 +659,7 @@ wchar_iterate (struct wchar_iterator *iter,
 		 converted a character; if so, return it.  */
 	      if (out_avail < out_request * sizeof (gdb_wchar_t))
 		break;
-	      
+
 	      /* Otherwise skip the first invalid character, and let
 		 the caller know about it.  */
 	      *out_result = wchar_iterate_invalid;
@@ -687,7 +687,10 @@ wchar_iterate (struct wchar_iterator *iter,
 
 	    case EINVAL:
 	      /* Incomplete input sequence.  Let the caller know, and
-		 arrange for future calls to see EOF.  */
+		 arrange for future calls to see EOF.
+		 Here also we might have converted something.  */
+	      if (out_avail < out_request * sizeof (gdb_wchar_t))
+		break;
 	      *out_result = wchar_iterate_incomplete;
 	      *ptr = iter->input;
 	      *len = iter->bytes;
diff --git a/gdb/testsuite/gdb.base/printcmds.c
b/gdb/testsuite/gdb.base/printcmds.c
index d80c13d..4a645d1 100644
--- a/gdb/testsuite/gdb.base/printcmds.c
+++ b/gdb/testsuite/gdb.base/printcmds.c
@@ -214,6 +214,88 @@ char invalid_RRR[] = "aaaaaaaaaaaaaaaaaaaa"
   "\240\240\240\240\240\240\240\240\240\240"
   "\240\240\240\240\240\240\240\240\240\240cccccccccccccccccccc";
 
+/* Same with incomplete \340 prefix.  */
+char incomplete_ESE[] = "\340";
+char incomplete_SSE[] = "a\340";
+char incomplete_LSE[] = "abaabbaaabbb\340";
+char incomplete_RSE[] = "aaaaaaaaaaaaaaaaaaaa\340";
+char incomplete_ESS[] = "\340c";
+char incomplete_SSS[] = "a\340c";
+char incomplete_LSS[] = "abaabbaaabbb\340c";
+char incomplete_RSS[] = "aaaaaaaaaaaaaaaaaaaa\340c";
+char incomplete_ESL[] = "\340cdccddcccddd";
+char incomplete_SSL[] = "a\340cdccddcccddd";
+char incomplete_LSL[] = "abaabbaaabbb\340cdccddcccddd";
+char incomplete_RSL[] = "aaaaaaaaaaaaaaaaaaaa\340cdccddcccddd";
+char incomplete_ESR[] = "\340cccccccccccccccccccc";
+char incomplete_SSR[] = "a\340cccccccccccccccccccc";
+char incomplete_LSR[] = "abaabbaaabbb\340cccccccccccccccccccc";
+char incomplete_RSR[] = "aaaaaaaaaaaaaaaaaaaa\340cccccccccccccccccccc";
+char incomplete_ELE[] = "\340\340\340\340";
+char incomplete_SLE[] = "a\340\340\340\340";
+char incomplete_LLE[] = "abaabbaaabbb\340\340\340\340";
+char incomplete_RLE[] = "aaaaaaaaaaaaaaaaaaaa\340\340\340\340";
+char incomplete_ELS[] = "\340\340\340\340c";
+char incomplete_SLS[] = "a\340\340\340\340c";
+char incomplete_LLS[] = "abaabbaaabbb\340\340\340\340c";
+char incomplete_RLS[] = "aaaaaaaaaaaaaaaaaaaa\340\340\340\340c";
+char incomplete_ELL[] = "\340\340\340\340cdccddcccddd";
+char incomplete_SLL[] = "a\340\340\340\340cdccddcccddd";
+char incomplete_LLL[] = "abaabbaaabbb\340\340\340\340cdccddcccddd";
+char incomplete_RLL[] = "aaaaaaaaaaaaaaaaaaaa\340\340\340\340cdccddcccddd";
+char incomplete_ELR[] = "\340\340\340\340cccccccccccccccccccc";
+char incomplete_SLR[] = "a\340\340\340\340cccccccccccccccccccc";
+char incomplete_LLR[] = "abaabbaaabbb\340\340\340\340cccccccccccccccccccc";
+char incomplete_RLR[] =
"aaaaaaaaaaaaaaaaaaaa\340\340\340\340cccccccccccccccccccc";
+char incomplete_ERE[] = ""
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340";
+char incomplete_LRE[] = "abaabbaaabbb"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340";
+char incomplete_RRE[] = "aaaaaaaaaaaaaaaaaaaa"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340";
+char incomplete_ERS[] = ""
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340c";
+char incomplete_ERL[] = ""
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340cdccddcccddd";
+char incomplete_ERR[] = ""
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340cccccccccccccccccccc";
+char incomplete_SRE[] = "a"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340";
+char incomplete_SRS[] = "a"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340c";
+char incomplete_SRL[] = "a"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340cdccddcccddd";
+char incomplete_SRR[] = "a"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340cccccccccccccccccccc";
+char incomplete_LRS[] = "abaabbaaabbb"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340c";
+char incomplete_LRL[] = "abaabbaaabbb"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340cdccddcccddd";
+char incomplete_LRR[] = "abaabbaaabbb"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340cccccccccccccccccccc";
+char incomplete_RRS[] = "aaaaaaaaaaaaaaaaaaaa"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340c";
+char incomplete_RRL[] = "aaaaaaaaaaaaaaaaaaaa"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340cdccddcccddd";
+char incomplete_RRR[] = "aaaaaaaaaaaaaaaaaaaa"
+  "\340\340\340\340\340\340\340\340\340\340"
+  "\340\340\340\340\340\340\340\340\340\340cccccccccccccccccccc";
+
 /* -- */
 
 int main ()
diff --git a/gdb/testsuite/gdb.base/printcmds.exp
b/gdb/testsuite/gdb.base/printcmds.exp
index 60e4a7f..36149bc 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -827,6 +827,10 @@ proc test_repeat_bytes {} {
     set invalid(S) {\\240}
     set invalid(L) {\\240\\240\\240\\240}
     set invalid(R) {'\\240' <repeats 20 times>}
+    set incomplete(S) {\\340}
+    set incomplete(L) {\\340\\340\\340\\340}
+    set incomplete(R) {'\\340' <repeats 20 times>}
+
 
     set fmt(SSS) "\"%s%s%s\""
     set fmt(SSR) "\"%s%s\", %s"
@@ -843,12 +847,16 @@ proc test_repeat_bytes {} {
     set fmt(SS) "\"%s%s\""
 
     # Test the various permutations of invalid characters
-    foreach i [array names invalid] {
+    foreach prefix { invalid incomplete } {
+    foreach i [array names $prefix] {
 	set I $i
 
 	if {$i == "L"} {
 	    set i "S"
 	}
+	set prefname "${prefix}($I)"
+	set pref [subst "$$prefname"]
+	verbose "prefname=$prefname, pref=$pref"
 
 	foreach s [array names start] {
 	    set S $s
@@ -870,19 +878,20 @@ proc test_repeat_bytes {} {
 
 		# Special cases...
 		if {$s == "E"} {
-		    set result [format $fmt($i$e) $invalid($I) $end($E)]
+		    set result [format $fmt($i$e) $pref $end($E)]
 		} elseif {$e == "E"} {
-		    set result [format $fmt($s$i) $start($S) $invalid($I)]
+		    set result [format $fmt($s$i) $start($S) $pref]
 		} else {
 		    set result [format $fmt($s$i$e) \
-				    $start($S) $invalid($I) $end($E)]
+				    $start($S) $pref $end($E)]
 		}
 
 		send_log "expecting: = $result\n"
-		gdb_test "print invalid_$S$I$E" "= $result"
+		gdb_test "print ${prefix}_$S$I$E" "= $result"
 	    }
 	}
     }
+    }
 }
 
 # Start with a fresh gdb.
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar
  2013-10-01  1:19   ` Keith Seitz
@ 2013-10-01 13:23     ` Pierre Muller
  2013-10-22 18:25       ` Keith Seitz
  0 siblings, 1 reply; 52+ messages in thread
From: Pierre Muller @ 2013-10-01 13:23 UTC (permalink / raw)
  To: 'Keith Seitz'; +Cc: 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Keith Seitz
> Envoyé : mardi 1 octobre 2013 03:19
> À : Pierre Muller
> Cc : 'gdb-patches'
> Objet : Re: [RFC 5/6] Handle "set print sevenbit-strings on" in
print_wchar
> 
> On 09/26/2013 01:03 PM, Pierre Muller wrote:
> 
> > 2013-09-26  Pierre Muller  <muller@sourceware.org>
> >
> >   	valprint.c (print_wchar): Honor sevenbit_strings value.
> >
> 
> [Your ChangeLog entry got munged...] I would prefer that you ChangeLog
> entry be a little more explicit about what changed, e.g., "Print escaped
> characters if sevenbit-strings is set."
> 
> I think this patch is okay, but it definitely needs a test (and a
> maintainer to approve). It took me a non-trivial amount of time to
> actually get the patch to show any difference in the output.
> 
> The trick (on linux) was changing the charset to something where
> (char)0x80 and up are printable characters. I used CP1252, and then I
> could see what this patch actually did.
  Sorry, I should have mentioned that..
 
> Perhaps this can be used in a test that will run on more than just MinGW
> hosts.

What about the following:

Pierre

ChangeLog entry:

2013-10-01  Pierre Muller  <muller@sourceware.org>

	* valprint.c (print_wchar): Print all char above seven-bit
 	as octal or hexadecimal if SEVENBIT_STRINGS is non-zero.

testsuite ChangeLog:

2013-10-01  Pierre Muller  <muller@sourceware.org>
	gdb.base/charset.exp: Add test to print char \242 in charset CP1252
	with or without "set print sevenbit-strings on".

---
 gdb/testsuite/gdb.base/charset.exp |   13 +++++++++++++
 gdb/valprint.c                     |    7 ++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/charset.exp
b/gdb/testsuite/gdb.base/charset.exp
index a5dbb28..01129e4 100644
--- a/gdb/testsuite/gdb.base/charset.exp
+++ b/gdb/testsuite/gdb.base/charset.exp
@@ -627,5 +627,18 @@ foreach name {short int long} {
 	"assign string to $name array"
 }
 
+# Set the target charset to CP1252.
+gdb_test_no_output "set charset CP1252"
+
+# \242 is a valid CP1252 character.
+gdb_test "print \"\\242\"" " = \".\"" \
+  "\\242 character in CP1252"
+
+gdb_test_no_output "set print sevenbit-strings on"
+
+# \242 is a valid CP1252 character, nut must now be printed in octal.
+gdb_test "print \"\\242\"" " = \"\\\\242\"" \
+  "\\242 character in CP1252, with seven-bit limitation"
+
 
 gdb_exit 
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 0f6d65e..912352c 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1926,9 +1926,10 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig,
   int need_escape = *need_escapep;
 
   *need_escapep = 0;
-  if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
-					    && w != LCST ('8')
-					    && w != LCST ('9'))))
+  if (gdb_iswprint (w)
+      && (!sevenbit_strings || (w > 0 && w < 0x7f))
+      && (!need_escape || (!gdb_iswdigit (w)
+			   && w != LCST ('8') && w != LCST ('9'))))
     {
       gdb_wchar_t wchar = w;
 
-- 
1.7.9

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts.
  2013-10-01  1:19   ` Keith Seitz
@ 2013-10-01 13:39     ` Pierre Muller
  2013-10-22 18:26       ` Keith Seitz
  0 siblings, 1 reply; 52+ messages in thread
From: Pierre Muller @ 2013-10-01 13:39 UTC (permalink / raw)
  To: 'Keith Seitz'; +Cc: 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Keith Seitz
> Envoyé : mardi 1 octobre 2013 03:20
> À : Pierre Muller
> Cc : 'gdb-patches'
> Objet : Re: [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for
> mingw hosts.
> 
> Hi, Pierre,
> 
> On 09/26/2013 01:04 PM, Pierre Muller wrote:
> >    The first part has to do with the fact that GDB prints
> > the memory address and the closest symbol while the test
> > doesn't cope for this.
> >    I simply fixed this by setting/unsetting printing of
> > addresses and symbols at specific locations.
> 
> Can you provide an example? I notice no difference on linux with/without
> those options set. Is the output really different on MinGW? [I wouldn't
> have guessed that they are.]
This is what I get if I remove this part 6 of the patch series:

$ grep -C 3 FAIL gdb.log
(gdb) PASS: gdb.base/printcmds.exp: p 1.5l
p 0x1.1
Invalid number "0x1.1".
(gdb) XFAIL: gdb.base/printcmds.exp: p 0x1.1
p 123DEADBEEF
Invalid number "123DEADBEEF".
(gdb) PASS: gdb.base/printcmds.exp: reject p 123DEADBEEF
--
(gdb) PASS: gdb.base/printcmds.exp: set print elements 0
p teststring
$554 = <__cygwin_cxx_malloc+128> "teststring contents"
(gdb) FAIL: gdb.base/printcmds.exp: p teststring with elements set to 0
set print elements 1
(gdb) PASS: gdb.base/printcmds.exp: set print elements 1
p teststring
$555 = <__cygwin_cxx_malloc+128> "t"...
(gdb) FAIL: gdb.base/printcmds.exp: p teststring with elements set to 1
set print elements 5
(gdb) PASS: gdb.base/printcmds.exp: set print elements 5
p teststring
$556 = <__cygwin_cxx_malloc+128> "tests"...
(gdb) FAIL: gdb.base/printcmds.exp: p teststring with elements set to 5
set print elements 19
(gdb) PASS: gdb.base/printcmds.exp: set print elements 19
p teststring
$557 = <__cygwin_cxx_malloc+128> "teststring contents"
(gdb) FAIL: gdb.base/printcmds.exp: p teststring with elements set to 19
set print elements 20
(gdb) PASS: gdb.base/printcmds.exp: set print elements 20
p teststring
$558 = <__cygwin_cxx_malloc+128> "teststring contents"
(gdb) FAIL: gdb.base/printcmds.exp: p teststring with elements set to 20
set print elements 8
(gdb) PASS: gdb.base/printcmds.exp: set print elements 8
p &ctable1[0]
--
(gdb) PASS: gdb.base/printcmds.exp: set print null-stop off
p int1dim[0]@2
Invalid character '' in expression.
(gdb) FAIL: gdb.base/printcmds.exp: p int1dim[0]@2
p int1dim[0]@2@3
Invalid character '' in expression.
(gdb) FAIL: gdb.base/printcmds.exp: p int1dim[0]@2@3
p/x (short [])0x12345678
$607 = {0x5678, 0x1234}
(gdb) set print elements 24
 

The last two are due to the Ctrl-V problem,
the others are due to the fact that the teststring
is close to an address __cygwin_cxx_malloc (this is with
the cygwin gcc used instead of the i686-w64-mingw32-gcc...)
Well, in fact, those 5 errors disappear with the cross-compiler,
but they are also present when I run the test for a native cygwin debugger.

> In any case, this bit seems harmless enough. If you say it fixes
> problems, I believe you, and I'm all for it!
> 
> >    The last errors were generated by the use of Ctrl-V
> > to avoid problems with possible association of @ to kill command.
> >    mingw GDB doesn't handle this Ctrl-V, so I conditionally removed it
for
> > *-*-mingw* hosts.
> 
> This isn't so much a question for you specifically, but I thought I'd
> throw this out to the greater wisdom of the list.
> 
> I searched around the test suite and found a bunch of places where this
> character is used without the ^V hack. Is it (still) necessary at all?
> Perhaps we can just get rid of it entirely?

  I have no idea...
I just played it save by disabling only for MinGW hosts...

 
> Otherwise, given the harmless nature of the changes, I'd recommend that
> a maintainer approve this.

   Thanks again for all this reviews,

Pierre

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command.
  2013-09-29 23:00             ` Pierre Muller
  2013-09-30  9:38               ` Pedro Alves
  2013-09-30 12:33               ` Yao Qi
@ 2013-10-01 19:42               ` Keith Seitz
  2 siblings, 0 replies; 52+ messages in thread
From: Keith Seitz @ 2013-10-01 19:42 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 09/29/2013 03:57 PM, Pierre Muller wrote:
> I found out that this patch
>
> $ cvs diff -up
> cvs diff: Diffing .
> Index: gdb.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
> retrieving revision 1.246
> diff -u -p -r1.246 gdb.exp
> --- gdb.exp     20 Sep 2013 21:47:05 -0000      1.246
> +++ gdb.exp     29 Sep 2013 22:50:10 -0000
> @@ -1454,6 +1454,9 @@ proc default_gdb_start { } {
>          perror "Spawning $GDB failed."
>          return 1
>       }
> +    if [ishost "*-*-mingw*"] {
> +       fconfigure $res -translation {crlf crlf}
> +    }
>       gdb_expect 360 {
>          -re "\[\r\n\]$gdb_prompt $" {
>              verbose "GDB initialized."
>
>
> works... but only for cygwin dejagnu...

Yeah, you can't generally run fconfigure on $res here because $res is a 
an expect spawn_id, not a Tcl file channel.

[I *think*] You can get a file channel by using:

set fc [exp_open -leaveopen -i $res]; # WARNING: I have zero experience 
with this. I read about it in the expect man page.
fconfigure $fc -translation ...

Another thing that might be worth investigating with is expect's 
built-in stty command.

I am planning on playing with mingw testing this week. At the very 
least, I hope to duplicate some of your problems!

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 1/6 -V2] Fix display of tabulation character for mingw hosts.
  2013-10-01  8:02     ` [RFC 1/6 -V2] " Pierre Muller
@ 2013-10-22 18:24       ` Keith Seitz
  0 siblings, 0 replies; 52+ messages in thread
From: Keith Seitz @ 2013-10-22 18:24 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 10/01/2013 01:02 AM, Pierre Muller wrote:
>> -----Message d'origine-----
>> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] De la part de Keith Seitz
>> Envoyé : mardi 1 octobre 2013 03:19
>> À : Pierre Muller
>> Cc : 'gdb-patches'
>> Objet : Re: [RFC 1/6] Fix display of tabulation character for mingw hosts.
>>
>    Yes, I must confess that I broke more coding style rules
> than I usually do here, sorry about that...

It happens to all of us; don't worry about it.

>> Does this fix the output of many tests in the test suite already? If
>> not, it would be really, really nice to have a test to check (and
>> demonstrate) this quirk.
>
> It does fix 2 failures inside printcmds.exp
>
> 288-p ctable1[9]
> 289:$50 = 9 '\t'
> 290-(gdb) PASS: gdb.base/printcmds.exp: p ctable1[9]
> 291-p ctable1[10]
> 292-$51 = 10 '\n'
> --
> 1869-$560 = (unsigned char *) <ctable1+1> "\001\002\003\004\005\006\a\b"...
> 1870-(gdb) PASS: gdb.base/printcmds.exp: p &ctable1[1]
> 1871-p &ctable1[1*8]
> 1872:$561 = (unsigned char *) <ctable1+8> "\b\t\n\v\f\r\016\017"...
> 1873-(gdb) PASS: gdb.base/printcmds.exp: p &ctable1[1*8]
> 1874-p &ctable1[2*8]
> 1875-$562 = (unsigned char *) <ctable1+16>
> "\020\021\022\023\024\025\026\027"...
>
> Is this enough?

Yes, I just wanted to make sure that if this regressed, it would be 
caught by some test. I am still having difficulties running tests on MinGW.

>    Here is a new patch version.
> To avoid the very complicated preprocessor checks that decides if we
> use wide chars inside gdb_wchar.h, I added a new macro
> HAVE_MINGW_GDB_ISWPRINT.
>    While the idea seems good to me, I am unsure about the choice
> of this macro name, are there similar examples already inside the code?

To be honest, I'm not a really big fan of putting platform-specific 
knowledge into the source code without abstraction, but in this case, 
the alternative of creating, e.g., a nm.h file for this and replicating 
all the #if ... logic in gdb_wchar.h is even less appealing to me. 
[There is some precedent for this approach, too.]

I would just drop the "MINGW" part of the name. There's always the 
possibility that some other platform might require a similar workaround. 
Perhaps a maintainer will chime in here with a more 
elegant/attractive/appropriate approach.

> ChangeLog entry:
>
> 2013-10-01  Pierre Muller <muller@sourceware.org>
>
>   	Fix display of tabulation character for MinGW hosts.
>   	* gdb_wchar.h (gdb_iswprint): Declare as external function
>   	if __MINGW32__ macro is set.

I think you can simply use: "Declare as external function on MinGW."

> 	(HAVE_MINGW_GDB_ISWPRINT): New macro, declared only for
>   	MinGW hosts using wide characters.
>   	* mingw-hdep.c (gdb_iswprint): New function.
> 	Implemented only if HAVE_MINGW_GDB_ISWPRINT macro is defined.

The custom IIRC is to use:
	* mingw-hdep.c (gdb_iswprint) [HVAE_MINGW_ISWPRINT]: New function.

I think it is time for a maintainer to review this.

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar
  2013-10-01 13:23     ` Pierre Muller
@ 2013-10-22 18:25       ` Keith Seitz
  2013-11-06 21:43         ` Tom Tromey
  0 siblings, 1 reply; 52+ messages in thread
From: Keith Seitz @ 2013-10-22 18:25 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 10/01/2013 06:23 AM, Pierre Muller wrote:
> ChangeLog entry:
>
> 2013-10-01  Pierre Muller  <muller@sourceware.org>
>
> 	* valprint.c (print_wchar): Print all char above seven-bit
>   	as octal or hexadecimal if SEVENBIT_STRINGS is non-zero.
>
> testsuite ChangeLog:
>
> 2013-10-01  Pierre Muller  <muller@sourceware.org>
> 	gdb.base/charset.exp: Add test to print char \242 in charset CP1252
> 	with or without "set print sevenbit-strings on".

Thank you for the test. This is exactly the kind of thing that is needed.

There is one little problem with this, though. As is, the first test, 
"print \"\\242\"" will fail on linux (at least it does for me). This is 
because gdb_init (in testsuite/lib/gdb.exp) overrides the environment's 
locale settings. So we should probably force en_US.UTF-8 and restart gdb 
before running your new tests:

setenv LANG en_US.UTF-8
setenv LC_ALL en_US.UTF-8
setenv LC_TYPE en_US.UTF-8

clean_restart $testfile

gdb_test "set charset CP1252" ...

With this, the test will pass.

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate.
  2013-10-01 12:48     ` Pierre Muller
@ 2013-10-22 18:25       ` Keith Seitz
  0 siblings, 0 replies; 52+ messages in thread
From: Keith Seitz @ 2013-10-22 18:25 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 10/01/2013 05:47 AM, Pierre Muller wrote:
> Here is a test, maybe this is overkill...

There is no such thing as overkill in testing. :-)

>    On a linux machine with charset set to UTF-8,
> I do get failures, but not all are related to the fix in the patch...
> Some are due to the fact that <incomplete sequence is printed out..
> Nevertheless, incomplete_LSE, incomplete_RSE and incomplete_SSE
> do show one missing char.
>
> FAIL: gdb.base/printcmds.exp: print incomplete_LLE
> FAIL: gdb.base/printcmds.exp: print incomplete_RLE
> FAIL: gdb.base/printcmds.exp: print incomplete_SLE
> FAIL: gdb.base/printcmds.exp: print incomplete_LRE
> FAIL: gdb.base/printcmds.exp: print incomplete_RRE
> FAIL: gdb.base/printcmds.exp: print incomplete_SRE
> FAIL: gdb.base/printcmds.exp: print incomplete_LSE
> FAIL: gdb.base/printcmds.exp: print incomplete_RSE
> FAIL: gdb.base/printcmds.exp: print incomplete_SSE

I'm not seeing these fail on my box, which defaults to UTF-8.

But there are two minor problems. It looks like py-prettyprint.exp needs 
updating. That test prints a string with an invalid sequence much like 
what you're trying to fix:

print estring2
$9 = "embedded x", <incomplete sequence \302>
(gdb) FAIL: gdb.python/py-prettyprint.exp: print estring2

In this case, the 'x' is "new" to the output. [It does this twice, in 
both tests named "print estring2". Ick. This file has duplicate test names.]

> PS: One missing thing is the re-indentation of the exp
> file for the additional foreach loop...
> But using vim in visual mode and '>' command
> added directly 8 spaces, instead of 4...
> Doing all that by hand is really frustrating...
> Should .exp files be treated differently from other tcl files?

Not as far as I know... At least, I've never done anything special with 
indentation, but I use emacs, and that picks up gdb/.dir-locals.el, 
which specifies 4-space tabs for Tcl:

(tcl-mode . ((tcl-indent-level . 4)
               (tcl-continued-indent-level . 4)
               (indent-tabs-mode . t)))

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts.
  2013-10-01 13:39     ` Pierre Muller
@ 2013-10-22 18:26       ` Keith Seitz
  2013-11-06 21:53         ` Tom Tromey
  0 siblings, 1 reply; 52+ messages in thread
From: Keith Seitz @ 2013-10-22 18:26 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

On 10/01/2013 06:39 AM, Pierre Muller wrote:
> (gdb) PASS: gdb.base/printcmds.exp: set print elements 0
> p teststring
> $554 = <__cygwin_cxx_malloc+128> "teststring contents"
[snip]

Ah, that's good enough evidence for me.

>>>     The last errors were generated by the use of Ctrl-V
>>> to avoid problems with possible association of @ to kill command.
>>>     mingw GDB doesn't handle this Ctrl-V, so I conditionally removed it
> for
>>> *-*-mingw* hosts.
>>
>> This isn't so much a question for you specifically, but I thought I'd
>> throw this out to the greater wisdom of the list.
>>
>> I searched around the test suite and found a bunch of places where this
>> character is used without the ^V hack. Is it (still) necessary at all?
>> Perhaps we can just get rid of it entirely?
>
>    I have no idea...
> I just played it save by disabling only for MinGW hosts...

I say get rid of it. This is the only place where this is done, and if 
this is really necessary, there are several other places where it should 
have been done. So I'm assuming it is no longer strictly necessary.

>> Otherwise, given the harmless nature of the changes, I'd recommend that
>> a maintainer approve this.

With that, I think a maintainer should give this a final review and 
approval.

Keith

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 1/6 -V2] Fix display of tabulation character for mingw hosts.
       [not found]     ` <10182.1932978512$1380614580@news.gmane.org>
@ 2013-11-06 21:24       ` Tom Tromey
  2013-11-08 10:26         ` Pierre Muller
  0 siblings, 1 reply; 52+ messages in thread
From: Tom Tromey @ 2013-11-06 21:24 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'Keith Seitz', 'gdb-patches'

>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre> 2013-10-01  Pierre Muller <muller@sourceware.org>
Pierre>  	Fix display of tabulation character for MinGW hosts.
Pierre>  	* gdb_wchar.h (gdb_iswprint): Declare as external function
Pierre>  	if __MINGW32__ macro is set.
Pierre> 	(HAVE_MINGW_GDB_ISWPRINT): New macro, declared only for
Pierre>  	MinGW hosts using wide characters.
Pierre>  	* mingw-hdep.c (gdb_iswprint): New function.
Pierre> 	Implemented only if HAVE_MINGW_GDB_ISWPRINT macro is defined.

If this is just for working around one mingw bug in one spot in gdb, I
think on the whole it would be simpler to just check for \t directly in
print_wchar.  I think with a short comment it will be simpler in the end
than a new macro and a new host-specific function.

Tom

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate.
       [not found]     ` <33559.6669152894$1380631692@news.gmane.org>
@ 2013-11-06 21:38       ` Tom Tromey
  2013-11-08 11:21         ` Pierre Muller
       [not found]         ` <"007201cedc72$46a78810$d3f69830$@muller"@ics-cnrs.unistra.fr>
  0 siblings, 2 replies; 52+ messages in thread
From: Tom Tromey @ 2013-11-06 21:38 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'Keith Seitz', 'gdb-patches'

>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre> 2013-10-01  Pierre Muller  <muller@sourceware.org>
Pierre> 	charset.c (wchar_iterate): Also handle converted characters
Pierre>  	when EINVAL is returned by iconv call.
Pierre> 2013-10-01  Pierre Muller  <muller@sourceware.org>
Pierre> 	* gdb.base/printcmds.c: Add strings with incomplete sequence.
Pierre> 	* gdb.base/printcmds.exp (test_repeat_bytes): Check output of 
Pierre> 	strings containing incomplete sequence.

This looks good to me, but Keith had reported some additional
regressions from this patch in gdb.python.
Do you see those?

Tom

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar
  2013-10-22 18:25       ` Keith Seitz
@ 2013-11-06 21:43         ` Tom Tromey
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Tromey @ 2013-11-06 21:43 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Pierre Muller, 'gdb-patches'

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> setenv LANG en_US.UTF-8
Keith> setenv LC_ALL en_US.UTF-8
Keith> setenv LC_TYPE en_US.UTF-8
Keith> clean_restart $testfile
Keith> gdb_test "set charset CP1252" ...
Keith> With this, the test will pass.

Thanks Keith.

I think the settings would have to be undone afterward to avoid messing
with the environment of subsequent tests.

Tom

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts.
       [not found] ` <9177.88728042996$1380225912@news.gmane.org>
@ 2013-11-06 21:50   ` Tom Tromey
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Tromey @ 2013-11-06 21:50 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'gdb-patches'

>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre> 2013-09-26  Pierre Muller  <muller@sourceware.org>
Pierre>  	printcmds.exp (test_print_trings): Disable  and reenable printing of
Pierre> 	addresses and symbols.
Pierre>  	(test_artificial_arrays): Disable Ctrl-V use for mingw hosts.

Thanks Pierre.  This is ok.

Tom

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts.
  2013-10-22 18:26       ` Keith Seitz
@ 2013-11-06 21:53         ` Tom Tromey
  0 siblings, 0 replies; 52+ messages in thread
From: Tom Tromey @ 2013-11-06 21:53 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Pierre Muller, 'gdb-patches'

[ the mysterious C-v ]

Keith> I say get rid of it. This is the only place where this is done, and if
Keith> this is really necessary, there are several other places where it
Keith> should have been done. So I'm assuming it is no longer strictly
Keith> necessary.

I think so as well.

Tom

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 1/6 -V2] Fix display of tabulation character for mingw hosts.
  2013-11-06 21:24       ` Tom Tromey
@ 2013-11-08 10:26         ` Pierre Muller
  0 siblings, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-11-08 10:26 UTC (permalink / raw)
  To: 'Tom Tromey'; +Cc: 'Keith Seitz', 'gdb-patches'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : mercredi 6 novembre 2013 22:16
> À : Pierre Muller
> Cc : 'Keith Seitz'; 'gdb-patches'
> Objet : Re: [RFC 1/6 -V2] Fix display of tabulation character for mingw
> hosts.
> 
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
> 
> Pierre> 2013-10-01  Pierre Muller <muller@sourceware.org>
> Pierre>  	Fix display of tabulation character for MinGW hosts.
> Pierre>  	* gdb_wchar.h (gdb_iswprint): Declare as external function
> Pierre>  	if __MINGW32__ macro is set.
> Pierre> 	(HAVE_MINGW_GDB_ISWPRINT): New macro, declared only for
> Pierre>  	MinGW hosts using wide characters.
> Pierre>  	* mingw-hdep.c (gdb_iswprint): New function.
> Pierre> 	Implemented only if HAVE_MINGW_GDB_ISWPRINT macro is
> defined.
> 
> If this is just for working around one mingw bug in one spot in gdb, I
> think on the whole it would be simpler to just check for \t directly in
> print_wchar.  I think with a short comment it will be simpler in the
> end
> than a new macro and a new host-specific function.


  I tried to move the change inside print_wchar function,
but I couldn't get it into something smaller than
that (the patch below also contains the other changes of the same series).
  Should I resubmit this formally, despite the fact that it is
not as simple as one might have expected?

Pierre





diff --git a/gdb/valprint.c b/gdb/valprint.c
index 0ecea0c..7e864f6 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1929,73 +1929,79 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig,
   int need_escape = *need_escapep;
 
   *need_escapep = 0;
-  if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
-					    && w != LCST ('8')
-					    && w != LCST ('9'))))
-    {
-      gdb_wchar_t wchar = w;
 
-      if (w == gdb_btowc (quoter) || w == LCST ('\\'))
-	obstack_grow_wstr (output, LCST ("\\"));
-      obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
-    }
-  else
+  /* iswprint implementation returns 1 on mingw hosts.
+     In order to avoid different printout on this host,
+     we explicitly use wchar_printable function.  */
+  switch (w)
     {
-      switch (w)
+      case LCST ('\a'):
+	obstack_grow_wstr (output, LCST ("\\a"));
+	break;
+      case LCST ('\b'):
+	obstack_grow_wstr (output, LCST ("\\b"));
+	break;
+      case LCST ('\f'):
+	obstack_grow_wstr (output, LCST ("\\f"));
+	break;
+      case LCST ('\n'):
+	obstack_grow_wstr (output, LCST ("\\n"));
+	break;
+      case LCST ('\r'):
+	obstack_grow_wstr (output, LCST ("\\r"));
+	break;
+      case LCST ('\t'):
+	obstack_grow_wstr (output, LCST ("\\t"));
+	break;
+      case LCST ('\v'):
+	obstack_grow_wstr (output, LCST ("\\v"));
+	break;
+      default:
 	{
-	case LCST ('\a'):
-	  obstack_grow_wstr (output, LCST ("\\a"));
-	  break;
-	case LCST ('\b'):
-	  obstack_grow_wstr (output, LCST ("\\b"));
-	  break;
-	case LCST ('\f'):
-	  obstack_grow_wstr (output, LCST ("\\f"));
-	  break;
-	case LCST ('\n'):
-	  obstack_grow_wstr (output, LCST ("\\n"));
-	  break;
-	case LCST ('\r'):
-	  obstack_grow_wstr (output, LCST ("\\r"));
-	  break;
-	case LCST ('\t'):
-	  obstack_grow_wstr (output, LCST ("\\t"));
-	  break;
-	case LCST ('\v'):
-	  obstack_grow_wstr (output, LCST ("\\v"));
-	  break;
-	default:
-	  {
-	    int i;
+	  if (wchar_printable (w)
+	      && (!sevenbit_strings || (w >= 0 && w < 0x7f))
+	      && (!need_escape || (!gdb_iswdigit (w)
+				   && w != LCST ('8')
+				   && w != LCST ('9'))))
+	    {
+	      gdb_wchar_t wchar = w;
 
-	    for (i = 0; i + width <= orig_len; i += width)
-	      {
-		char octal[30];
-		ULONGEST value;
+	      if (w == gdb_btowc (quoter) || w == LCST ('\\'))
+		obstack_grow_wstr (output, LCST ("\\"));
+	      obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
+	    }
+	  else
+	    {
+	      int i;
+
+	      for (i = 0; i + width <= orig_len; i += width)
+		{
+		  char octal[30];
+		  ULONGEST value;
 
-		value = extract_unsigned_integer (&orig[i], width,
+		  value = extract_unsigned_integer (&orig[i], width,
 						  byte_order);
-		/* If the value fits in 3 octal digits, print it that
-		   way.  Otherwise, print it as a hex escape.  */
-		if (value <= 0777)
-		  xsnprintf (octal, sizeof (octal), "\\%.3o",
-			     (int) (value & 0777));
-		else
-		  xsnprintf (octal, sizeof (octal), "\\x%lx", (long) value);
-		append_string_as_wide (octal, output);
-	      }
-	    /* If we somehow have extra bytes, print them now.  */
-	    while (i < orig_len)
-	      {
-		char octal[5];
+		  /* If the value fits in 3 octal digits, print it that
+		     way.  Otherwise, print it as a hex escape.  */
+		  if (value <= 0777)
+		    xsnprintf (octal, sizeof (octal), "\\%.3o",
+			       (int) (value & 0777));
+		  else
+		    xsnprintf (octal, sizeof (octal), "\\x%lx", (long)
value);
+		  append_string_as_wide (octal, output);
+		}
+	      /* If we somehow have extra bytes, print them now.  */
+	      while (i < orig_len)
+		{
+		  char octal[5];
 
-		xsnprintf (octal, sizeof (octal), "\\%.3o", orig[i] & 0xff);
-		append_string_as_wide (octal, output);
-		++i;
-	      }
+		  xsnprintf (octal, sizeof (octal), "\\%.3o", orig[i] &
0xff);
+		  append_string_as_wide (octal, output);
+		  ++i;
+		}
 
-	    *need_escapep = 1;
-	  }
+	      *need_escapep = 1;
+	    }
 	  break;
 	}
     }

^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate.
  2013-11-06 21:38       ` Tom Tromey
@ 2013-11-08 11:21         ` Pierre Muller
       [not found]         ` <"007201cedc72$46a78810$d3f69830$@muller"@ics-cnrs.unistra.fr>
  1 sibling, 0 replies; 52+ messages in thread
From: Pierre Muller @ 2013-11-08 11:21 UTC (permalink / raw)
  To: 'Tom Tromey'; +Cc: 'Keith Seitz', 'gdb-patches'

Hi Tom,

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : mercredi 6 novembre 2013 22:35
> À : Pierre Muller
> Cc : 'Keith Seitz'; 'gdb-patches'
> Objet : Re: [RFC 2/6] Avoid missing char before incomplete sequence in
> wchar_iterate.
> 
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
> 
> Pierre> 2013-10-01  Pierre Muller  <muller@sourceware.org>
> Pierre> 	charset.c (wchar_iterate): Also handle converted characters
> Pierre>  	when EINVAL is returned by iconv call.
> Pierre> 2013-10-01  Pierre Muller  <muller@sourceware.org>
> Pierre> 	* gdb.base/printcmds.c: Add strings with incomplete
> sequence.
> Pierre> 	* gdb.base/printcmds.exp (test_repeat_bytes): Check output
> of
> Pierre> 	strings containing incomplete sequence.
> 
> This looks good to me, but Keith had reported some additional
> regressions from this patch in gdb.python.
> Do you see those?

  I had big troubles getting a gdb with mingw32 python library
included (still had to tweak the configure script to
convert Windows style paths to cygwin style..)

  Anyhow, I did see indeed two failures that seem
to be related to that change: 
"print estring" and "print estring2"
The second is easily fixed by adding the 'x' char as Keith suggested,
but the first is also a problem of different starting charset
for mingw versus linux.
  The solution for that one probably is as Keith suggested to 
force the value of the charset by setting the encoding explicitly before.

  Moving the line
     gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
  before "print estring" test seems to remove the failure,
but shouldn't these be invalid sequences for UFT-8?


Pierre



diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp
b/gdb/testsuite/gdb.python/py-prettyprint.exp
index adbe88d..76e7ad2 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -91,7 +91,7 @@ proc run_lang_tests {exefile lang} {
     gdb_test "print estring" " = \"embedded
x\\\\201\\\\202\\\\203\\\\204\""

     gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
-    gdb_test "print estring2" "\"embedded \", <incomplete sequence
\\\\302>"
+    gdb_test "print estring2" "\"embedded x\", <incomplete sequence
\\\\302>"

     gdb_test_no_output "set python print-stack full"
     gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val"

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate.
       [not found]         ` <"007201cedc72$46a78810$d3f69830$@muller"@ics-cnrs.unistra.fr>
@ 2013-11-08 11:43           ` Eli Zaretskii
  0 siblings, 0 replies; 52+ messages in thread
From: Eli Zaretskii @ 2013-11-08 11:43 UTC (permalink / raw)
  To: Pierre Muller; +Cc: tromey, keiths, gdb-patches

> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Cc: "'Keith Seitz'" <keiths@redhat.com>,        "'gdb-patches'" <gdb-patches@sourceware.org>
> Date: Fri, 8 Nov 2013 12:04:18 +0100
> 
>   I had big troubles getting a gdb with mingw32 python library
> included (still had to tweak the configure script to
> convert Windows style paths to cygwin style..)

Not sure why you needed to do that.  Just install the Python DLL from
somewhere (e.g., as part of installation of a native Windows Python
interpreter), then point GDB's configure to that DLL using the
--with-python switch at configure time.  That's what I do, and have
yet to see any problems with building GDB with Python support.

^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2013-11-08 11:21 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-26 19:54 [RFC 0/6] Handle several character priniting problems (mainly related to mingw hosts) Pierre Muller
2013-09-26 19:57 ` [RFC 1/6] Fix display of tabulation character for mingw hosts Pierre Muller
2013-10-01  1:19   ` Keith Seitz
2013-10-01  8:02     ` [RFC 1/6 -V2] " Pierre Muller
2013-10-22 18:24       ` Keith Seitz
     [not found]     ` <10182.1932978512$1380614580@news.gmane.org>
2013-11-06 21:24       ` Tom Tromey
2013-11-08 10:26         ` Pierre Muller
2013-09-26 19:57 ` [RFC 2/6] Avoid missing char before incomplete sequence in wchar_iterate Pierre Muller
2013-10-01  1:19   ` Keith Seitz
2013-10-01 12:48     ` Pierre Muller
2013-10-22 18:25       ` Keith Seitz
     [not found]     ` <33559.6669152894$1380631692@news.gmane.org>
2013-11-06 21:38       ` Tom Tromey
2013-11-08 11:21         ` Pierre Muller
     [not found]         ` <"007201cedc72$46a78810$d3f69830$@muller"@ics-cnrs.unistra.fr>
2013-11-08 11:43           ` Eli Zaretskii
2013-09-26 20:01 ` [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command Pierre Muller
2013-09-26 20:03 ` [RFC 4/6] Always set testsuite mode and interactive mode for mingw hosts Pierre Muller
2013-09-26 20:04 ` [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar Pierre Muller
2013-10-01  1:19   ` Keith Seitz
2013-10-01 13:23     ` Pierre Muller
2013-10-22 18:25       ` Keith Seitz
2013-11-06 21:43         ` Tom Tromey
2013-09-26 20:05 ` [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts Pierre Muller
2013-10-01  1:19   ` Keith Seitz
2013-10-01 13:39     ` Pierre Muller
2013-10-22 18:26       ` Keith Seitz
2013-11-06 21:53         ` Tom Tromey
     [not found] ` <33207.6293569573$1380225714@news.gmane.org>
2013-09-27  8:07   ` [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command asmwarrior
2013-09-27  8:11     ` asmwarrior
2013-09-27 12:12       ` Pierre Muller
2013-09-27 15:07   ` Tom Tromey
2013-09-27 17:42     ` Pierre Muller
     [not found]     ` <5245c3a0.a3e2440a.4b98.ffffd279SMTPIN_ADDED_BROKEN@mx.google.com>
2013-09-27 19:36       ` Pedro Alves
2013-09-27 19:40         ` Pedro Alves
2013-09-27 21:12           ` Pierre Muller
2013-09-29 13:45         ` Yao Qi
2013-09-29 18:51           ` Pedro Alves
2013-09-29 23:00             ` Pierre Muller
2013-09-30  9:38               ` Pedro Alves
2013-09-30 12:33               ` Yao Qi
2013-10-01 19:42               ` Keith Seitz
     [not found]             ` <10148.9390749068$1380495630@news.gmane.org>
2013-09-29 23:54               ` asmwarrior
2013-09-30 19:23               ` Tom Tromey
2013-09-30 19:34                 ` Eli Zaretskii
2013-09-30 19:45                   ` Pedro Alves
2013-09-30 22:41                     ` Pierre Muller
     [not found] ` <11813.6176527061$1380225854@news.gmane.org>
2013-09-27 15:13   ` [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar Tom Tromey
2013-09-27 15:23     ` Pierre Muller
     [not found] ` <9177.88728042996$1380225912@news.gmane.org>
2013-11-06 21:50   ` [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts Tom Tromey
     [not found] <"002901cebaf2$35ec65a0$a1c530e0$@muller"@ics-cnrs.unistra.fr>
     [not found] ` <"003201cebaf3$338a8b60$9a9fa220$@muller"@ics-cnrs.unistra.fr>
2013-09-26 20:08   ` [RFC 3/6] mingw-hdep: Add "maint set testuite-mode on/off" command Eli Zaretskii
2013-09-26 20:13     ` Pierre Muller
     [not found]     ` <"003e01cebaf4$e97923e0$bc6b6ba0$@muller"@ics-cnrs.unistra.fr>
2013-09-27  5:52       ` Eli Zaretskii
2013-09-27  6:53         ` Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).