aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/mi/mi-interp.c57
-rw-r--r--gdb/remote.c2
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp2
-rw-r--r--gdb/utils.c10
6 files changed, 58 insertions, 30 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1fd19f6..e671ff5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2014-06-05 Simon Marchi <simon.marchi@ericsson.com>
+
+ PR mi/15806
+ * utils.c (printchar): Don't escape at all if quoter is NUL.
+ Update function documentation to clarify effect of parameter
+ QUOTER.
+ * remote.c (escape_buffer): Pass '\\' as the quoter to
+ fputstrn_unfiltered.
+ * mi/mi-interp.c (mi_solib_loaded): Use ui_out_field_* functions to
+ generate the output.
+ (mi_solib_unloaded): Same.
+
2014-06-05 Joel Brobecker <brobecker@adacore.com>
* development.sh: Delete.
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 52a3a62..1b994e7 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -981,22 +981,24 @@ static void
mi_solib_loaded (struct so_list *solib)
{
struct mi_interp *mi = top_level_interpreter_data ();
+ struct ui_out *uiout = interp_ui_out (top_level_interpreter ());
target_terminal_ours ();
- if (gdbarch_has_global_solist (target_gdbarch ()))
- fprintf_unfiltered (mi->event_channel,
- "library-loaded,id=\"%s\",target-name=\"%s\","
- "host-name=\"%s\",symbols-loaded=\"%d\"",
- solib->so_original_name, solib->so_original_name,
- solib->so_name, solib->symbols_loaded);
- else
- fprintf_unfiltered (mi->event_channel,
- "library-loaded,id=\"%s\",target-name=\"%s\","
- "host-name=\"%s\",symbols-loaded=\"%d\","
- "thread-group=\"i%d\"",
- solib->so_original_name, solib->so_original_name,
- solib->so_name, solib->symbols_loaded,
- current_inferior ()->num);
+
+ fprintf_unfiltered (mi->event_channel, "library-loaded");
+
+ ui_out_redirect (uiout, mi->event_channel);
+
+ ui_out_field_string (uiout, "id", solib->so_original_name);
+ ui_out_field_string (uiout, "target-name", solib->so_original_name);
+ ui_out_field_string (uiout, "host-name", solib->so_name);
+ ui_out_field_int (uiout, "symbols-loaded", solib->symbols_loaded);
+ if (!gdbarch_has_global_solist (target_gdbarch ()))
+ {
+ ui_out_field_fmt (uiout, "thread-group", "i%d", current_inferior ()->num);
+ }
+
+ ui_out_redirect (uiout, NULL);
gdb_flush (mi->event_channel);
}
@@ -1005,20 +1007,23 @@ static void
mi_solib_unloaded (struct so_list *solib)
{
struct mi_interp *mi = top_level_interpreter_data ();
+ struct ui_out *uiout = interp_ui_out (top_level_interpreter ());
target_terminal_ours ();
- if (gdbarch_has_global_solist (target_gdbarch ()))
- fprintf_unfiltered (mi->event_channel,
- "library-unloaded,id=\"%s\",target-name=\"%s\","
- "host-name=\"%s\"",
- solib->so_original_name, solib->so_original_name,
- solib->so_name);
- else
- fprintf_unfiltered (mi->event_channel,
- "library-unloaded,id=\"%s\",target-name=\"%s\","
- "host-name=\"%s\",thread-group=\"i%d\"",
- solib->so_original_name, solib->so_original_name,
- solib->so_name, current_inferior ()->num);
+
+ fprintf_unfiltered (mi->event_channel, "library-unloaded");
+
+ ui_out_redirect (uiout, mi->event_channel);
+
+ ui_out_field_string (uiout, "id", solib->so_original_name);
+ ui_out_field_string (uiout, "target-name", solib->so_original_name);
+ ui_out_field_string (uiout, "host-name", solib->so_name);
+ if (!gdbarch_has_global_solist (target_gdbarch ()))
+ {
+ ui_out_field_fmt (uiout, "thread-group", "i%d", current_inferior ()->num);
+ }
+
+ ui_out_redirect (uiout, NULL);
gdb_flush (mi->event_channel);
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 8f9478c..d5e5272 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7082,7 +7082,7 @@ escape_buffer (const char *buf, int n)
stb = mem_fileopen ();
old_chain = make_cleanup_ui_file_delete (stb);
- fputstrn_unfiltered (buf, n, 0, stb);
+ fputstrn_unfiltered (buf, n, '\\', stb);
str = ui_file_xstrdup (stb, NULL);
do_cleanups (old_chain);
return str;
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 45f3512..3526388 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-05 Simon Marchi <simon.marchi@ericsson.com>
+
+ * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Fix
+ erroneous dprintf expected input.
+
2014-06-04 Doug Evans <xdje42@gmail.com>
* gdb.guile/scm-generics.exp: Delete.
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
index aa991cf..70a7876 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
@@ -96,7 +96,7 @@ proc test_insert_delete_modify { } {
$test
set test "dprintf marker, \"arg\" \""
mi_gdb_test $test \
- {.*=breakpoint-created,bkpt=\{number="6",type="dprintf".*,script=\{\"printf \\\\\"arg\\\\\" \\\\\"\"\}.*\}\r\n\^done} \
+ {.*=breakpoint-created,bkpt=\{number="6",type="dprintf".*,script=\{\"printf \\\"arg\\\" \\\"\"\}.*\}\r\n\^done} \
$test
# 2. when modifying condition
diff --git a/gdb/utils.c b/gdb/utils.c
index 6e8f384..f61974d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1502,7 +1502,13 @@ parse_escape (struct gdbarch *gdbarch, const char **string_ptr)
/* Print the character C on STREAM as part of the contents of a literal
string whose delimiter is QUOTER. Note that this routine should only
be call for printing things which are independent of the language
- of the program being debugged. */
+ of the program being debugged.
+
+ printchar will normally escape backslashes and instances of QUOTER. If
+ QUOTER is 0, printchar won't escape backslashes or any quoting character.
+ As a side effect, if you pass the backslash character as the QUOTER,
+ printchar will escape backslashes as usual, but not any other quoting
+ character. */
static void
printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
@@ -1545,7 +1551,7 @@ printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
}
else
{
- if (c == '\\' || c == quoter)
+ if (quoter != 0 && (c == '\\' || c == quoter))
do_fputs ("\\", stream);
do_fprintf (stream, "%c", c);
}