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

View file

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

View file

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