mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:57:47 +00:00
Everywhere: Debug macros instead of constexpr.
This was done with the following script: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
This commit is contained in:
parent
bb483f7ef4
commit
8465683dcf
98 changed files with 414 additions and 972 deletions
|
@ -362,7 +362,7 @@ void E1000NetworkAdapter::initialize_tx_descriptors()
|
|||
|
||||
void E1000NetworkAdapter::out8(u16 address, u8 data)
|
||||
{
|
||||
dbgln<debug_e1000>("E1000: OUT8 {:#02x} @ {:#04x}", data, address);
|
||||
dbgln<E1000_DEBUG>("E1000: OUT8 {:#02x} @ {:#04x}", data, address);
|
||||
if (m_use_mmio) {
|
||||
auto* ptr = (volatile u8*)(m_mmio_base.get() + address);
|
||||
*ptr = data;
|
||||
|
@ -373,7 +373,7 @@ void E1000NetworkAdapter::out8(u16 address, u8 data)
|
|||
|
||||
void E1000NetworkAdapter::out16(u16 address, u16 data)
|
||||
{
|
||||
dbgln<debug_e1000>("E1000: OUT16 {:#04x} @ {:#04x}", data, address);
|
||||
dbgln<E1000_DEBUG>("E1000: OUT16 {:#04x} @ {:#04x}", data, address);
|
||||
if (m_use_mmio) {
|
||||
auto* ptr = (volatile u16*)(m_mmio_base.get() + address);
|
||||
*ptr = data;
|
||||
|
@ -384,7 +384,7 @@ void E1000NetworkAdapter::out16(u16 address, u16 data)
|
|||
|
||||
void E1000NetworkAdapter::out32(u16 address, u32 data)
|
||||
{
|
||||
dbgln<debug_e1000>("E1000: OUT32 {:#08x} @ {:#04x}", data, address);
|
||||
dbgln<E1000_DEBUG>("E1000: OUT32 {:#08x} @ {:#04x}", data, address);
|
||||
if (m_use_mmio) {
|
||||
auto* ptr = (volatile u32*)(m_mmio_base.get() + address);
|
||||
*ptr = data;
|
||||
|
@ -395,7 +395,7 @@ void E1000NetworkAdapter::out32(u16 address, u32 data)
|
|||
|
||||
u8 E1000NetworkAdapter::in8(u16 address)
|
||||
{
|
||||
dbgln<debug_e1000>("E1000: IN8 @ {:#04x}", address);
|
||||
dbgln<E1000_DEBUG>("E1000: IN8 @ {:#04x}", address);
|
||||
if (m_use_mmio)
|
||||
return *(volatile u8*)(m_mmio_base.get() + address);
|
||||
return m_io_base.offset(address).in<u8>();
|
||||
|
@ -403,7 +403,7 @@ u8 E1000NetworkAdapter::in8(u16 address)
|
|||
|
||||
u16 E1000NetworkAdapter::in16(u16 address)
|
||||
{
|
||||
dbgln<debug_e1000>("E1000: IN16 @ {:#04x}", address);
|
||||
dbgln<E1000_DEBUG>("E1000: IN16 @ {:#04x}", address);
|
||||
if (m_use_mmio)
|
||||
return *(volatile u16*)(m_mmio_base.get() + address);
|
||||
return m_io_base.offset(address).in<u16>();
|
||||
|
@ -411,7 +411,7 @@ u16 E1000NetworkAdapter::in16(u16 address)
|
|||
|
||||
u32 E1000NetworkAdapter::in32(u16 address)
|
||||
{
|
||||
dbgln<debug_e1000>("E1000: IN32 @ {:#04x}", address);
|
||||
dbgln<E1000_DEBUG>("E1000: IN32 @ {:#04x}", address);
|
||||
if (m_use_mmio)
|
||||
return *(volatile u32*)(m_mmio_base.get() + address);
|
||||
return m_io_base.offset(address).in<u32>();
|
||||
|
|
|
@ -66,7 +66,7 @@ KResultOr<NonnullRefPtr<Socket>> IPv4Socket::create(int type, int protocol)
|
|||
IPv4Socket::IPv4Socket(int type, int protocol)
|
||||
: Socket(AF_INET, type, protocol)
|
||||
{
|
||||
dbgln<debug_ipv4_socket>("IPv4Socket({}) created with type={}, protocol={}", this, type, protocol);
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}) created with type={}, protocol={}", this, type, protocol);
|
||||
m_buffer_mode = type == SOCK_STREAM ? BufferMode::Bytes : BufferMode::Packets;
|
||||
if (m_buffer_mode == BufferMode::Bytes) {
|
||||
m_scratch_buffer = KBuffer::create_with_size(65536);
|
||||
|
@ -119,7 +119,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr
|
|||
m_local_address = IPv4Address((const u8*)&address.sin_addr.s_addr);
|
||||
m_local_port = requested_local_port;
|
||||
|
||||
dbgln<debug_ipv4_socket>("IPv4Socket::bind {}({}) to {}:{}", class_name(), this, m_local_address, m_local_port);
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket::bind {}({}) to {}:{}", class_name(), this, m_local_address, m_local_port);
|
||||
|
||||
return protocol_bind();
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ KResult IPv4Socket::listen(size_t backlog)
|
|||
m_role = Role::Listener;
|
||||
evaluate_block_conditions();
|
||||
|
||||
dbgln<debug_ipv4_socket>("IPv4Socket({}) listening with backlog={}", this, backlog);
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}) listening with backlog={}", this, backlog);
|
||||
|
||||
return protocol_listen();
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
|
|||
packet = m_receive_queue.take_first();
|
||||
set_can_read(!m_receive_queue.is_empty());
|
||||
|
||||
dbgln<debug_ipv4_socket>("IPv4Socket({}): recvfrom without blocking {} bytes, packets in queue: {}",
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}): recvfrom without blocking {} bytes, packets in queue: {}",
|
||||
this,
|
||||
packet.data.value().size(),
|
||||
m_receive_queue.size());
|
||||
|
@ -316,7 +316,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
|
|||
packet = m_receive_queue.take_first();
|
||||
set_can_read(!m_receive_queue.is_empty());
|
||||
|
||||
dbgln<debug_ipv4_socket>("IPv4Socket({}): recvfrom with blocking {} bytes, packets in queue: {}",
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}): recvfrom with blocking {} bytes, packets in queue: {}",
|
||||
this,
|
||||
packet.data.value().size(),
|
||||
m_receive_queue.size());
|
||||
|
@ -326,7 +326,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
|
|||
packet_timestamp = packet.timestamp;
|
||||
|
||||
if (addr) {
|
||||
dbgln<debug_ipv4_socket>("Incoming packet is from: {}:{}", packet.peer_address, packet.peer_port);
|
||||
dbgln<IPV4_SOCKET_DEBUG>("Incoming packet is from: {}:{}", packet.peer_address, packet.peer_port);
|
||||
|
||||
sockaddr_in out_addr {};
|
||||
memcpy(&out_addr.sin_addr, &packet.peer_address, sizeof(IPv4Address));
|
||||
|
@ -411,7 +411,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port,
|
|||
}
|
||||
m_bytes_received += packet_size;
|
||||
|
||||
if constexpr (debug_ipv4_socket) {
|
||||
if constexpr (IPV4_SOCKET_DEBUG) {
|
||||
if (buffer_mode() == BufferMode::Bytes)
|
||||
dbgln("IPv4Socket({}): did_receive {} bytes, total_received={}", this, packet_size, m_bytes_received);
|
||||
else
|
||||
|
|
|
@ -74,7 +74,7 @@ LocalSocket::LocalSocket(int type)
|
|||
evaluate_block_conditions();
|
||||
});
|
||||
|
||||
dbgln<debug_local_socket>("LocalSocket({}) created with type={}", this, type);
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) created with type={}", this, type);
|
||||
}
|
||||
|
||||
LocalSocket::~LocalSocket()
|
||||
|
@ -110,7 +110,7 @@ KResult LocalSocket::bind(Userspace<const sockaddr*> user_address, socklen_t add
|
|||
|
||||
auto path = String(address.sun_path, strnlen(address.sun_path, sizeof(address.sun_path)));
|
||||
|
||||
dbgln<debug_local_socket>("LocalSocket({}) bind({})", this, path);
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) bind({})", this, path);
|
||||
|
||||
mode_t mode = S_IFSOCK | (m_prebind_mode & 0777);
|
||||
UidAndGid owner { m_prebind_uid, m_prebind_gid };
|
||||
|
@ -154,7 +154,7 @@ KResult LocalSocket::connect(FileDescription& description, Userspace<const socka
|
|||
return EFAULT;
|
||||
safe_address[sizeof(safe_address) - 1] = '\0';
|
||||
|
||||
dbgln<debug_local_socket>("LocalSocket({}) connect({})", this, safe_address);
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) connect({})", this, safe_address);
|
||||
|
||||
auto description_or_error = VFS::the().open(safe_address, O_RDWR, 0, Process::current()->current_directory());
|
||||
if (description_or_error.is_error())
|
||||
|
@ -190,7 +190,7 @@ KResult LocalSocket::connect(FileDescription& description, Userspace<const socka
|
|||
return EINTR;
|
||||
}
|
||||
|
||||
dbgln<debug_local_socket>("LocalSocket({}) connect({}) status is {}", this, safe_address, to_string(setup_state()));
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) connect({}) status is {}", this, safe_address, to_string(setup_state()));
|
||||
|
||||
if (!((u32)unblock_flags & (u32)Thread::FileDescriptionBlocker::BlockFlags::Connect)) {
|
||||
set_connect_side_role(Role::None);
|
||||
|
@ -210,7 +210,7 @@ KResult LocalSocket::listen(size_t backlog)
|
|||
m_role = Role::Listener;
|
||||
set_connect_side_role(Role::Listener, previous_role != m_role);
|
||||
|
||||
dbgln<debug_local_socket>("LocalSocket({}) listening with backlog={}", this, backlog);
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) listening with backlog={}", this, backlog);
|
||||
|
||||
return KSuccess;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ Socket::~Socket()
|
|||
|
||||
void Socket::set_setup_state(SetupState new_setup_state)
|
||||
{
|
||||
dbgln<debug_socket>("Socket({}) setup state moving from {} to {}", this, to_string(m_setup_state), to_string(new_setup_state));
|
||||
dbgln<SOCKET_DEBUG>("Socket({}) setup state moving from {} to {}", this, to_string(m_setup_state), to_string(new_setup_state));
|
||||
m_setup_state = new_setup_state;
|
||||
evaluate_block_conditions();
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ RefPtr<Socket> Socket::accept()
|
|||
LOCKER(m_lock);
|
||||
if (m_pending.is_empty())
|
||||
return nullptr;
|
||||
dbgln<debug_socket>("Socket({}) de-queueing connection", this);
|
||||
dbgln<SOCKET_DEBUG>("Socket({}) de-queueing connection", this);
|
||||
auto client = m_pending.take_first();
|
||||
ASSERT(!client->is_connected());
|
||||
auto& process = *Process::current();
|
||||
|
@ -88,7 +88,7 @@ RefPtr<Socket> Socket::accept()
|
|||
|
||||
KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer)
|
||||
{
|
||||
dbgln<debug_socket>("Socket({}) queueing connection", this);
|
||||
dbgln<SOCKET_DEBUG>("Socket({}) queueing connection", this);
|
||||
LOCKER(m_lock);
|
||||
if (m_pending.size() >= m_backlog)
|
||||
return ECONNREFUSED;
|
||||
|
|
|
@ -47,7 +47,7 @@ void TCPSocket::for_each(Function<void(const TCPSocket&)> callback)
|
|||
|
||||
void TCPSocket::set_state(State new_state)
|
||||
{
|
||||
dbgln<debug_tcp_socket>("TCPSocket({}) state moving from {} to {}", this, to_string(m_state), to_string(new_state));
|
||||
dbgln<TCP_SOCKET_DEBUG>("TCPSocket({}) state moving from {} to {}", this, to_string(m_state), to_string(new_state));
|
||||
|
||||
auto was_disconnected = protocol_is_disconnected();
|
||||
auto previous_role = m_role;
|
||||
|
@ -154,7 +154,7 @@ TCPSocket::~TCPSocket()
|
|||
LOCKER(sockets_by_tuple().lock());
|
||||
sockets_by_tuple().resource().remove(tuple());
|
||||
|
||||
dbgln<debug_tcp_socket>("~TCPSocket in state {}", to_string(state()));
|
||||
dbgln<TCP_SOCKET_DEBUG>("~TCPSocket in state {}", to_string(state()));
|
||||
}
|
||||
|
||||
NonnullRefPtr<TCPSocket> TCPSocket::create(int protocol)
|
||||
|
@ -273,14 +273,14 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size)
|
|||
if (packet.has_ack()) {
|
||||
u32 ack_number = packet.ack_number();
|
||||
|
||||
dbgln<debug_tcp_socket>("TCPSocket: receive_tcp_packet: {}", ack_number);
|
||||
dbgln<TCP_SOCKET_DEBUG>("TCPSocket: receive_tcp_packet: {}", ack_number);
|
||||
|
||||
int removed = 0;
|
||||
LOCKER(m_not_acked_lock);
|
||||
while (!m_not_acked.is_empty()) {
|
||||
auto& packet = m_not_acked.first();
|
||||
|
||||
dbgln<debug_tcp_socket>("TCPSocket: iterate: {}", packet.ack_number);
|
||||
dbgln<TCP_SOCKET_DEBUG>("TCPSocket: iterate: {}", packet.ack_number);
|
||||
|
||||
if (packet.ack_number <= ack_number) {
|
||||
m_not_acked.take_first();
|
||||
|
@ -290,7 +290,7 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size)
|
|||
}
|
||||
}
|
||||
|
||||
dbgln<debug_tcp_socket>("TCPSocket: receive_tcp_packet acknowledged {} packets", removed);
|
||||
dbgln<TCP_SOCKET_DEBUG>("TCPSocket: receive_tcp_packet acknowledged {} packets", removed);
|
||||
}
|
||||
|
||||
m_packets_in++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue