aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/gdb.base/timestamp.exp24
-rw-r--r--gdb/top.c2
2 files changed, 25 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/timestamp.exp b/gdb/testsuite/gdb.base/timestamp.exp
new file mode 100644
index 0000000..3d124b4
--- /dev/null
+++ b/gdb/testsuite/gdb.base/timestamp.exp
@@ -0,0 +1,24 @@
+# Copyright 2022 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that timestamps are printed when logging.
+
+clean_restart
+
+# This is a simple way to get logging output.
+gdb_test_no_output "set debug expression 1"
+gdb_test_no_output "set debug timestamp 1"
+
+gdb_test "print 23" "\[0-9\]+\\.\[0-9\]+ Operation: OP_LONG.* = 23"
diff --git a/gdb/top.c b/gdb/top.c
index 565b455..91b4e6a 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -305,7 +305,7 @@ ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)
m_gdb_stdout (new pager_file (new stdio_file (outstream))),
m_gdb_stdin (new stdio_file (instream)),
m_gdb_stderr (new stderr_file (errstream)),
- m_gdb_stdlog (m_gdb_stderr)
+ m_gdb_stdlog (new timestamped_file (m_gdb_stderr))
{
unbuffer_stream (instream_);