summaryrefslogtreecommitdiff
path: root/Kernel/TTY/VirtualConsole.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-05-14 16:39:28 +0300
committerAndreas Kling <kling@serenityos.org>2021-05-16 19:58:33 +0200
commitdbccfc3281231e0109b275028cfe93791383ef36 (patch)
treeeabaa3cd3f0069a615a79f5c5c22edebca8ad1b4 /Kernel/TTY/VirtualConsole.cpp
parent2e565f1b8a048b3f5770b67cebec21c229e3e237 (diff)
downloadserenity-dbccfc3281231e0109b275028cfe93791383ef36.zip
Kernel: Print all logbuffer from ConsoleDevice to debug Virtual Console
Diffstat (limited to 'Kernel/TTY/VirtualConsole.cpp')
-rw-r--r--Kernel/TTY/VirtualConsole.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp
index f08284a339..00dd68067e 100644
--- a/Kernel/TTY/VirtualConsole.cpp
+++ b/Kernel/TTY/VirtualConsole.cpp
@@ -116,10 +116,12 @@ UNMAP_AFTER_INIT NonnullRefPtr<VirtualConsole> VirtualConsole::create(size_t ind
return adopt_ref(*new VirtualConsole(index));
}
-UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index)
- : TTY(4, index)
- , m_index(index)
- , m_console_impl(*this)
+UNMAP_AFTER_INIT NonnullRefPtr<VirtualConsole> VirtualConsole::create_with_preset_log(size_t index, const CircularQueue<char, 16384>& log)
+{
+ return adopt_ref(*new VirtualConsole(index, log));
+}
+
+UNMAP_AFTER_INIT void VirtualConsole::initialize()
{
m_tty_name = String::formatted("/dev/tty{}", m_index);
VERIFY(GraphicsManagement::the().console());
@@ -138,6 +140,25 @@ UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index)
VERIFY(m_cells);
}
+UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index)
+ : TTY(4, index)
+ , m_index(index)
+ , m_console_impl(*this)
+{
+ initialize();
+}
+
+UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index, const CircularQueue<char, 16384>& log)
+ : TTY(4, index)
+ , m_index(index)
+ , m_console_impl(*this)
+{
+ initialize();
+ for (auto& ch : log) {
+ echo(ch);
+ }
+}
+
UNMAP_AFTER_INIT VirtualConsole::~VirtualConsole()
{
VERIFY_NOT_REACHED();