summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2019-02-21 13:17:32 +0000
committerAlan Hayward <alan.hayward@arm.com>2019-02-21 13:18:26 +0000
commitee2bcb0c356d86d7bd2ff525b84a7602bb2bc816 (patch)
tree78a0a7bc69d4884cca4124a4b699c966a696092e
parent5cacf1c88f8afa5a3a1fb6d88c297e19d99f21e0 (diff)
downloadbinutils-gdb-ee2bcb0c356d86d7bd2ff525b84a7602bb2bc816.tar.gz
Disable styling when running in batch mode
The GCC Guality testsuite within GCC compiles C/C++ files in GCC at various optimization levels then debugs them in GDB, checking that program values can be read. This is done within the dejagnu framework. The new style options in GDB have broken many of the tests due to the testsuite being unable to process the new control characters. The fix in Guality is to either to improve the string matching or to disable styling on the cli or init file (after checking gdb is recent enough to support styling). This fix will also need making an any other testsuites in the wild that use GDB. An alternative would be to automatically disable styling when using GDB in batch mode. The reasoning here is that batch mode is only used when automating GDB and any output will be processed later either with text processing tools or viewed in text editors, many of these will not correctly handle the control characters by default. This ensures GDB continues to work as expected. Anyone who explicitly wants styling in batch mode can enable it either in the init file or adding to the batch file - but that would not be the standard use case. Patch simply disables style after reading the batch command flag, before reading in the init file or batch file. gdb/ChangeLog: * main.c (captured_main_1): Disable styling in batch mode.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/main.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1a946b75662..fd704daf7b9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2019-02-21 Alan Hayward <alan.hayward@arm.com>
+
+ * main.c (captured_main_1): Disable styling in batch mode.
+
2019-02-20 Tom Tromey <tom@tromey.com>
* symtab.c (symtab_symbol_info): Fix typos.
diff --git a/gdb/main.c b/gdb/main.c
index a7283902fe2..e14dd06fa8c 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -47,6 +47,7 @@
#include "common/signals-state-save-restore.h"
#include <vector>
#include "common/pathstuff.h"
+#include "cli/cli-style.h"
/* The selected interpreter. This will be used as a set command
variable, so it should always be malloc'ed - since
@@ -850,7 +851,12 @@ captured_main_1 (struct captured_main_args *context)
}
if (batch_flag)
- quiet = 1;
+ {
+ quiet = 1;
+
+ /* Disable all output styling when running in batch mode. */
+ cli_styling = 0;
+ }
}
save_original_signals_state (quiet);