mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
Everywhere: Use CMake to generate AK/Debug.h.
This was done with the help of several scripts, I dump them here to easily find them later: awk '/#ifdef/ { print "#cmakedefine01 "$2 }' AK/Debug.h.in for debug_macro in $(awk '/#ifdef/ { print $2 }' AK/Debug.h.in) do find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/#ifdef '$debug_macro'/#if '$debug_macro'/' {} \; done # Remember to remove WRAPPER_GERNERATOR_DEBUG from the list. awk '/#cmake/ { print "set("$2" ON)" }' AK/Debug.h.in
This commit is contained in:
parent
76f2918416
commit
1a3a0836c0
59 changed files with 475 additions and 459 deletions
|
@ -423,7 +423,7 @@ void E1000NetworkAdapter::send_raw(ReadonlyBytes payload)
|
|||
{
|
||||
disable_irq();
|
||||
size_t tx_current = in32(REG_TXDESCTAIL) % number_of_tx_descriptors;
|
||||
#ifdef E1000_DEBUG
|
||||
#if E1000_DEBUG
|
||||
klog() << "E1000: Sending packet (" << payload.size() << " bytes)";
|
||||
#endif
|
||||
auto* tx_descriptors = (e1000_tx_desc*)m_tx_descriptors_region->vaddr().as_ptr();
|
||||
|
@ -434,7 +434,7 @@ void E1000NetworkAdapter::send_raw(ReadonlyBytes payload)
|
|||
descriptor.length = payload.size();
|
||||
descriptor.status = 0;
|
||||
descriptor.cmd = CMD_EOP | CMD_IFCS | CMD_RS;
|
||||
#ifdef E1000_DEBUG
|
||||
#if E1000_DEBUG
|
||||
klog() << "E1000: Using tx descriptor " << tx_current << " (head is at " << in32(REG_TXDESCHEAD) << ")";
|
||||
#endif
|
||||
tx_current = (tx_current + 1) % number_of_tx_descriptors;
|
||||
|
@ -448,7 +448,7 @@ void E1000NetworkAdapter::send_raw(ReadonlyBytes payload)
|
|||
}
|
||||
m_wait_queue.wait_on({}, "E1000NetworkAdapter");
|
||||
}
|
||||
#ifdef E1000_DEBUG
|
||||
#if E1000_DEBUG
|
||||
dbgln("E1000: Sent packet, status is now {:#02x}!", (u8)descriptor.status);
|
||||
#endif
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ void E1000NetworkAdapter::receive()
|
|||
auto* buffer = m_rx_buffers_regions[rx_current].vaddr().as_ptr();
|
||||
u16 length = rx_descriptors[rx_current].length;
|
||||
ASSERT(length <= 8192);
|
||||
#ifdef E1000_DEBUG
|
||||
#if E1000_DEBUG
|
||||
klog() << "E1000: Received 1 packet @ " << buffer << " (" << length << ") bytes!";
|
||||
#endif
|
||||
did_receive({ buffer, length });
|
||||
|
|
|
@ -222,7 +222,7 @@ KResultOr<size_t> IPv4Socket::sendto(FileDescription&, const UserOrKernelBuffer&
|
|||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
#ifdef IPV4_SOCKET_DEBUG
|
||||
#if IPV4_SOCKET_DEBUG
|
||||
klog() << "sendto: destination=" << m_peer_address.to_string().characters() << ":" << m_peer_port;
|
||||
#endif
|
||||
|
||||
|
@ -364,7 +364,7 @@ KResultOr<size_t> IPv4Socket::recvfrom(FileDescription& description, UserOrKerne
|
|||
return EINVAL;
|
||||
}
|
||||
|
||||
#ifdef IPV4_SOCKET_DEBUG
|
||||
#if IPV4_SOCKET_DEBUG
|
||||
klog() << "recvfrom: type=" << type() << ", local_port=" << local_port();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ KResultOr<size_t> TCPSocket::protocol_receive(ReadonlyBytes raw_ipv4_packet, Use
|
|||
auto& ipv4_packet = *reinterpret_cast<const IPv4Packet*>(raw_ipv4_packet.data());
|
||||
auto& tcp_packet = *static_cast<const TCPPacket*>(ipv4_packet.payload());
|
||||
size_t payload_size = raw_ipv4_packet.size() - sizeof(IPv4Packet) - tcp_packet.header_size();
|
||||
#ifdef TCP_SOCKET_DEBUG
|
||||
#if TCP_SOCKET_DEBUG
|
||||
klog() << "payload_size " << payload_size << ", will it fit in " << buffer_size << "?";
|
||||
#endif
|
||||
ASSERT(buffer_size >= payload_size);
|
||||
|
@ -252,7 +252,7 @@ void TCPSocket::send_outgoing_packets()
|
|||
packet.tx_time = now;
|
||||
packet.tx_counter++;
|
||||
|
||||
#ifdef TCP_SOCKET_DEBUG
|
||||
#if TCP_SOCKET_DEBUG
|
||||
auto& tcp_packet = *(TCPPacket*)(packet.buffer.data());
|
||||
klog() << "sending tcp packet from " << local_address().to_string().characters() << ":" << local_port() << " to " << peer_address().to_string().characters() << ":" << peer_port() << " with (" << (tcp_packet.has_syn() ? "SYN " : "") << (tcp_packet.has_ack() ? "ACK " : "") << (tcp_packet.has_fin() ? "FIN " : "") << (tcp_packet.has_rst() ? "RST " : "") << ") seq_no=" << tcp_packet.sequence_number() << ", ack_no=" << tcp_packet.ack_number() << ", tx_counter=" << packet.tx_counter;
|
||||
#endif
|
||||
|
@ -450,7 +450,7 @@ bool TCPSocket::protocol_is_disconnected() const
|
|||
void TCPSocket::shut_down_for_writing()
|
||||
{
|
||||
if (state() == State::Established) {
|
||||
#ifdef TCP_SOCKET_DEBUG
|
||||
#if TCP_SOCKET_DEBUG
|
||||
dbgln(" Sending FIN/ACK from Established and moving into FinWait1");
|
||||
#endif
|
||||
[[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK);
|
||||
|
@ -465,7 +465,7 @@ KResult TCPSocket::close()
|
|||
Locker socket_locker(lock());
|
||||
auto result = IPv4Socket::close();
|
||||
if (state() == State::CloseWait) {
|
||||
#ifdef TCP_SOCKET_DEBUG
|
||||
#if TCP_SOCKET_DEBUG
|
||||
dbgln(" Sending FIN from CloseWait and moving into LastAck");
|
||||
#endif
|
||||
[[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue