mi: Use the value in mi_console_file->quote as the quoting character

Message ID 1398550240-8712-1-git-send-email-simon.marchi@ericsson.com
State Committed
Headers

Commit Message

Simon Marchi April 26, 2014, 10:10 p.m. UTC
  In mi_interpreter_init, multiple MI consoles/channels are created and a quoting
character is given.  In mi_console_raw_packet, we check if the value is not 0
to decide if we should quote the string, but we don't use the value. It is
hardcoded to ".  We might never use another quoting character than an actual
quote, but I suggest we change it, for correctness.  There is not visible
behavior change.

I changed the latest fputs_unfiltered changed to fputc_unfiltered just to stay
consistent.

gdb/ChangeLog:

2014-04-26  Simon Marchi  <simon.marchi@ericsson.com>

	* mi/mi-console.c (mi_console_raw_packet): Use the value from
	mi_console->quote as the quoting character.
---
 gdb/mi/mi-console.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Comments

Tom Tromey April 29, 2014, 5:21 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:

Simon> 2014-04-26  Simon Marchi  <simon.marchi@ericsson.com>

Simon> 	* mi/mi-console.c (mi_console_raw_packet): Use the value from
Simon>  mi_console-> quote as the quoting character.

Thanks, this is ok.

Tom
  
Simon Marchi May 12, 2014, 7:41 p.m. UTC | #2
On Tue 29 Apr 2014 01:21:11 PM EDT, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>
> Simon> 2014-04-26  Simon Marchi  <simon.marchi@ericsson.com>
>
> Simon> 	* mi/mi-console.c (mi_console_raw_packet): Use the value from
> Simon>  mi_console-> quote as the quoting character.
>
> Thanks, this is ok.
>
> Tom

I am pushing this.

Thanks.
  

Patch

diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c
index dbad199..0880bd3 100644
--- a/gdb/mi/mi-console.c
+++ b/gdb/mi/mi-console.c
@@ -110,15 +110,16 @@  mi_console_raw_packet (void *data, const char *buf, long length_buf)
       fputs_unfiltered (mi_console->prefix, mi_console->raw);
       if (mi_console->quote)
 	{
-	  fputs_unfiltered ("\"", mi_console->raw);
+	  fputc_unfiltered (mi_console->quote, mi_console->raw);
 	  fputstrn_unfiltered (buf, length_buf,
 			       mi_console->quote, mi_console->raw);
-	  fputs_unfiltered ("\"\n", mi_console->raw);
+	  fputc_unfiltered (mi_console->quote, mi_console->raw);
+	  fputc_unfiltered ('\n', mi_console->raw);
 	}
       else
 	{
 	  fputstrn_unfiltered (buf, length_buf, 0, mi_console->raw);
-	  fputs_unfiltered ("\n", mi_console->raw);
+	  fputc_unfiltered ('\n', mi_console->raw);
 	}
       gdb_flush (mi_console->raw);
     }