1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

Everywhere: Replace a bundle of dbg with dbgln.

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
This commit is contained in:
asynts 2021-01-13 23:59:42 +01:00 committed by Andreas Kling
parent 9d588cc9cc
commit 78b2be5a2a
4 changed files with 60 additions and 33 deletions

View file

@ -111,3 +111,21 @@ constexpr bool debug_smp = true;
#else #else
constexpr bool debug_smp = false; constexpr bool debug_smp = false;
#endif #endif
#ifdef BXVGA_DEBUG
constexpr bool debug_bxvga = true;
#else
constexpr bool debug_bxvga = false;
#endif
#ifdef PS2MOUSE_DEBUG
constexpr bool debug_ps2mouse = true;
#else
constexpr bool debug_ps2mouse = false;
#endif
#ifdef VMWAREBACKDOOR_DEBUG
constexpr bool debug_vmware_backdoor = true;
#else
constexpr bool debug_vmware_backdoor = false;
#endif

View file

@ -25,6 +25,7 @@
*/ */
#include <AK/Checked.h> #include <AK/Checked.h>
#include <AK/Debug.h>
#include <AK/Singleton.h> #include <AK/Singleton.h>
#include <Kernel/Devices/BXVGADevice.h> #include <Kernel/Devices/BXVGADevice.h>
#include <Kernel/IO.h> #include <Kernel/IO.h>
@ -105,9 +106,7 @@ void BXVGADevice::revert_resolution()
void BXVGADevice::set_resolution_registers(size_t width, size_t height) void BXVGADevice::set_resolution_registers(size_t width, size_t height)
{ {
#ifdef BXVGA_DEBUG dbgln<debug_bxvga>("BXVGADevice resolution registers set to - {}x{}", width, height);
dbg() << "BXVGADevice resolution registers set to - " << width << "x" << height;
#endif
set_register(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED); set_register(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED);
set_register(VBE_DISPI_INDEX_XRES, (u16)width); set_register(VBE_DISPI_INDEX_XRES, (u16)width);
set_register(VBE_DISPI_INDEX_YRES, (u16)height); set_register(VBE_DISPI_INDEX_YRES, (u16)height);
@ -120,9 +119,7 @@ void BXVGADevice::set_resolution_registers(size_t width, size_t height)
bool BXVGADevice::test_resolution(size_t width, size_t height) bool BXVGADevice::test_resolution(size_t width, size_t height)
{ {
#ifdef BXVGA_DEBUG dbgln<debug_bxvga>("BXVGADevice resolution test - {}x{}", width, height);
dbg() << "BXVGADevice resolution test - " << width << "x" << height;
#endif
set_resolution_registers(width, height); set_resolution_registers(width, height);
bool resolution_changed = validate_setup_resolution(width, height); bool resolution_changed = validate_setup_resolution(width, height);
revert_resolution(); revert_resolution();
@ -237,9 +234,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
if (resolution.width > MAX_RESOLUTION_WIDTH || resolution.height > MAX_RESOLUTION_HEIGHT) if (resolution.width > MAX_RESOLUTION_WIDTH || resolution.height > MAX_RESOLUTION_HEIGHT)
return -EINVAL; return -EINVAL;
if (!set_resolution(resolution.width, resolution.height)) { if (!set_resolution(resolution.width, resolution.height)) {
#ifdef BXVGA_DEBUG dbgln<debug_bxvga>("Reverting resolution: [{}x{}]", m_framebuffer_width, m_framebuffer_height);
dbg() << "Reverting Resolution: [" << m_framebuffer_width << "x" << m_framebuffer_height << "]";
#endif
resolution.pitch = m_framebuffer_pitch; resolution.pitch = m_framebuffer_pitch;
resolution.width = m_framebuffer_width; resolution.width = m_framebuffer_width;
resolution.height = m_framebuffer_height; resolution.height = m_framebuffer_height;
@ -247,9 +242,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
return -EFAULT; return -EFAULT;
return -EINVAL; return -EINVAL;
} }
#ifdef BXVGA_DEBUG dbgln<debug_bxvga>("New resolution: [{}x{}]", m_framebuffer_width, m_framebuffer_height);
dbg() << "New resolution: [" << m_framebuffer_width << "x" << m_framebuffer_height << "]";
#endif
resolution.pitch = m_framebuffer_pitch; resolution.pitch = m_framebuffer_pitch;
resolution.width = m_framebuffer_width; resolution.width = m_framebuffer_width;
resolution.height = m_framebuffer_height; resolution.height = m_framebuffer_height;

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <AK/Debug.h>
#include <AK/Memory.h> #include <AK/Memory.h>
#include <AK/Singleton.h> #include <AK/Singleton.h>
#include <Kernel/Devices/PS2MouseDevice.h> #include <Kernel/Devices/PS2MouseDevice.h>
@ -100,9 +101,12 @@ void PS2MouseDevice::irq_handle_byte_read(u8 byte)
auto commit_packet = [&] { auto commit_packet = [&] {
m_data_state = 0; m_data_state = 0;
#ifdef PS2MOUSE_DEBUG dbgln<debug_ps2mouse>("PS2Mouse: {}, {} {} {}",
dbg() << "PS2Mouse: " << m_data.bytes[1] << ", " << m_data.bytes[2] << " " << ((m_data.bytes[0] & 1) ? "Left" : "") << " " << ((m_data.bytes[0] & 2) ? "Right" : ""); m_data.bytes[1],
#endif m_data.bytes[2],
(m_data.bytes[0] & 1) ? "Left" : "",
(m_data.bytes[0] & 2) ? "Right" : "");
m_entropy_source.add_random_event(m_data.dword); m_entropy_source.add_random_event(m_data.dword);
{ {
@ -281,11 +285,12 @@ KResultOr<size_t> PS2MouseDevice::read(FileDescription&, size_t, UserOrKernelBuf
auto packet = m_queue.dequeue(); auto packet = m_queue.dequeue();
lock.unlock(); lock.unlock();
#ifdef PS2MOUSE_DEBUG if constexpr (debug_ps2mouse) {
dbgln("PS2 Mouse Read: Buttons {:x}", packet.buttons); dbgln("PS2 Mouse Read: Buttons {:x}", packet.buttons);
dbgln("PS2 Mouse: X {}, Y {}, Z {}, Relative {}", packet.x, packet.y, packet.z, packet.buttons); dbgln("PS2 Mouse: X {}, Y {}, Z {}, Relative {}", packet.x, packet.y, packet.z, packet.buttons);
dbgln("PS2 Mouse Read: Filter packets"); dbgln("PS2 Mouse Read: Filter packets");
#endif }
size_t bytes_read_from_packet = min(remaining_space_in_buffer, sizeof(MousePacket)); size_t bytes_read_from_packet = min(remaining_space_in_buffer, sizeof(MousePacket));
if (!buffer.write(&packet, nread, bytes_read_from_packet)) if (!buffer.write(&packet, nread, bytes_read_from_packet))
return EFAULT; return EFAULT;

View file

@ -25,6 +25,7 @@
*/ */
#include <AK/Assertions.h> #include <AK/Assertions.h>
#include <AK/Debug.h>
#include <AK/OwnPtr.h> #include <AK/OwnPtr.h>
#include <AK/Singleton.h> #include <AK/Singleton.h>
#include <AK/String.h> #include <AK/String.h>
@ -177,25 +178,34 @@ void VMWareBackdoor::disable_absolute_vmmouse()
void VMWareBackdoor::send_high_bandwidth(VMWareCommand& command) void VMWareBackdoor::send_high_bandwidth(VMWareCommand& command)
{ {
vmware_high_bandwidth_send(command); vmware_high_bandwidth_send(command);
#ifdef VMWAREBACKDOOR_DEBUG
dbg() << "VMWareBackdoor Command High bandwidth Send Results: EAX " << String::format("%x", command.ax) << " EBX " << String::format("%x", command.bx) << " ECX " << String::format("%x", command.cx) << " EDX " << String::format("%x", command.dx); dbgln<debug_vmware_backdoor>("VMWareBackdoor Command High bandwidth Send Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}",
#endif command.ax,
command.bx,
command.cx,
command.dx);
} }
void VMWareBackdoor::get_high_bandwidth(VMWareCommand& command) void VMWareBackdoor::get_high_bandwidth(VMWareCommand& command)
{ {
vmware_high_bandwidth_get(command); vmware_high_bandwidth_get(command);
#ifdef VMWAREBACKDOOR_DEBUG
dbg() << "VMWareBackdoor Command High bandwidth Get Results: EAX " << String::format("%x", command.ax) << " EBX " << String::format("%x", command.bx) << " ECX " << String::format("%x", command.cx) << " EDX " << String::format("%x", command.dx); dbgln<debug_vmware_backdoor>("VMWareBackdoor Command High bandwidth Get Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}",
#endif command.ax,
command.bx,
command.cx,
command.dx);
} }
void VMWareBackdoor::send(VMWareCommand& command) void VMWareBackdoor::send(VMWareCommand& command)
{ {
vmware_out(command); vmware_out(command);
#ifdef VMWAREBACKDOOR_DEBUG
dbg() << "VMWareBackdoor Command Send Results: EAX " << String::format("%x", command.ax) << " EBX " << String::format("%x", command.bx) << " ECX " << String::format("%x", command.cx) << " EDX " << String::format("%x", command.dx); dbgln<debug_vmware_backdoor>("VMWareBackdoor Command Send Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}",
#endif command.ax,
command.bx,
command.cx,
command.dx);
} }
Optional<MousePacket> VMWareBackdoor::receive_mouse_packet() Optional<MousePacket> VMWareBackdoor::receive_mouse_packet()
@ -225,10 +235,11 @@ Optional<MousePacket> VMWareBackdoor::receive_mouse_packet()
int y = (command.cx); int y = (command.cx);
int z = (command.dx); int z = (command.dx);
#ifdef PS2MOUSE_DEBUG if constexpr (debug_ps2mouse) {
dbg() << "Absolute Mouse: Buttons " << String::format("%x", buttons); dbgln("Absolute Mouse: Buttons {:x}", buttons);
dbg() << "Mouse: X " << x << ", Y " << y << ", Z " << z; dbgln("Mouse: x={}, y={}, z={}", x, y, z);
#endif }
MousePacket packet; MousePacket packet;
packet.x = x; packet.x = x;
packet.y = y; packet.y = y;