mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:22:45 +00:00 
			
		
		
		
	Put miscellaneous debug spam behind #ifdefs.
This commit is contained in:
		
							parent
							
								
									1b16a29044
								
							
						
					
					
						commit
						6c2089c59d
					
				
					 4 changed files with 27 additions and 3 deletions
				
			
		|  | @ -4,6 +4,8 @@ | ||||||
| #include <Kernel/VirtualFileSystem.h> | #include <Kernel/VirtualFileSystem.h> | ||||||
| #include <LibC/errno_numbers.h> | #include <LibC/errno_numbers.h> | ||||||
| 
 | 
 | ||||||
|  | //#define DEBUG_LOCAL_SOCKET
 | ||||||
|  | 
 | ||||||
| Retained<LocalSocket> LocalSocket::create(int type) | Retained<LocalSocket> LocalSocket::create(int type) | ||||||
| { | { | ||||||
|     return adopt(*new LocalSocket(type)); |     return adopt(*new LocalSocket(type)); | ||||||
|  | @ -12,7 +14,9 @@ Retained<LocalSocket> LocalSocket::create(int type) | ||||||
| LocalSocket::LocalSocket(int type) | LocalSocket::LocalSocket(int type) | ||||||
|     : Socket(AF_LOCAL, type, 0) |     : Socket(AF_LOCAL, type, 0) | ||||||
| { | { | ||||||
|  | #ifdef DEBUG_LOCAL_SOCKET | ||||||
|     kprintf("%s(%u) LocalSocket{%p} created with type=%u\n", current->name().characters(), current->pid(), this, type); |     kprintf("%s(%u) LocalSocket{%p} created with type=%u\n", current->name().characters(), current->pid(), this, type); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| LocalSocket::~LocalSocket() | LocalSocket::~LocalSocket() | ||||||
|  | @ -45,7 +49,9 @@ bool LocalSocket::bind(const sockaddr* address, socklen_t address_size, int& err | ||||||
|     char safe_address[sizeof(local_address.sun_path) + 1]; |     char safe_address[sizeof(local_address.sun_path) + 1]; | ||||||
|     memcpy(safe_address, local_address.sun_path, sizeof(local_address.sun_path)); |     memcpy(safe_address, local_address.sun_path, sizeof(local_address.sun_path)); | ||||||
| 
 | 
 | ||||||
|  | #ifdef DEBUG_LOCAL_SOCKET | ||||||
|     kprintf("%s(%u) LocalSocket{%p} bind(%s)\n", current->name().characters(), current->pid(), this, safe_address); |     kprintf("%s(%u) LocalSocket{%p} bind(%s)\n", current->name().characters(), current->pid(), this, safe_address); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
|     m_file = VFS::the().open(safe_address, error, O_CREAT | O_EXCL, S_IFSOCK | 0666, current->cwd_inode()); |     m_file = VFS::the().open(safe_address, error, O_CREAT | O_EXCL, S_IFSOCK | 0666, current->cwd_inode()); | ||||||
|     if (!m_file) { |     if (!m_file) { | ||||||
|  | @ -78,7 +84,9 @@ bool LocalSocket::connect(const sockaddr* address, socklen_t address_size, int& | ||||||
|     char safe_address[sizeof(local_address.sun_path) + 1]; |     char safe_address[sizeof(local_address.sun_path) + 1]; | ||||||
|     memcpy(safe_address, local_address.sun_path, sizeof(local_address.sun_path)); |     memcpy(safe_address, local_address.sun_path, sizeof(local_address.sun_path)); | ||||||
| 
 | 
 | ||||||
|  | #ifdef DEBUG_LOCAL_SOCKET | ||||||
|     kprintf("%s(%u) LocalSocket{%p} connect(%s)\n", current->name().characters(), current->pid(), this, safe_address); |     kprintf("%s(%u) LocalSocket{%p} connect(%s)\n", current->name().characters(), current->pid(), this, safe_address); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
|     m_file = VFS::the().open(safe_address, error, 0, 0, current->cwd_inode()); |     m_file = VFS::the().open(safe_address, error, 0, 0, current->cwd_inode()); | ||||||
|     if (!m_file) { |     if (!m_file) { | ||||||
|  | @ -94,15 +102,21 @@ bool LocalSocket::connect(const sockaddr* address, socklen_t address_size, int& | ||||||
|     m_address = local_address; |     m_address = local_address; | ||||||
| 
 | 
 | ||||||
|     auto peer = m_file->inode()->socket(); |     auto peer = m_file->inode()->socket(); | ||||||
|  | #ifdef DEBUG_LOCAL_SOCKET | ||||||
|     kprintf("Queueing up connection\n"); |     kprintf("Queueing up connection\n"); | ||||||
|  | #endif | ||||||
|     if (!peer->queue_connection_from(*this, error)) |     if (!peer->queue_connection_from(*this, error)) | ||||||
|         return false; |         return false; | ||||||
| 
 | 
 | ||||||
|  | #ifdef DEBUG_LOCAL_SOCKET | ||||||
|     kprintf("Waiting for connect...\n"); |     kprintf("Waiting for connect...\n"); | ||||||
|  | #endif | ||||||
|     if (!current->wait_for_connect(*this, error)) |     if (!current->wait_for_connect(*this, error)) | ||||||
|         return false; |         return false; | ||||||
| 
 | 
 | ||||||
|  | #ifdef DEBUG_LOCAL_SOCKET | ||||||
|     kprintf("CONNECTED!\n"); |     kprintf("CONNECTED!\n"); | ||||||
|  | #endif | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -46,14 +46,18 @@ GEventLoop::GEventLoop() | ||||||
|         rc = connect(m_event_fd, (const sockaddr*)&address, sizeof(address)); |         rc = connect(m_event_fd, (const sockaddr*)&address, sizeof(address)); | ||||||
|         if (rc == 0) |         if (rc == 0) | ||||||
|             break; |             break; | ||||||
|  | #ifdef GEVENTLOOP_DEBUG | ||||||
|         dbgprintf("connect failed: %d, %s\n", errno, strerror(errno)); |         dbgprintf("connect failed: %d, %s\n", errno, strerror(errno)); | ||||||
|  | #endif | ||||||
|         sleep(1); |         sleep(1); | ||||||
|         --retries; |         --retries; | ||||||
|     } |     } | ||||||
|     if (rc < 0) { |     if (rc < 0) { | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|  | #ifdef GEVENTLOOP_DEBUG | ||||||
|     dbgprintf("(%u) GEventLoop constructed :)\n", getpid()); |     dbgprintf("(%u) GEventLoop constructed :)\n", getpid()); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| GEventLoop::~GEventLoop() | GEventLoop::~GEventLoop() | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ | ||||||
| #include <LibC/stdio.h> | #include <LibC/stdio.h> | ||||||
| #include <LibC/errno.h> | #include <LibC/errno.h> | ||||||
| 
 | 
 | ||||||
| //#define WSEVENTLOOP_DEBUG
 | //#define WSMESSAGELOOP_DEBUG
 | ||||||
| 
 | 
 | ||||||
| static WSMessageLoop* s_the; | static WSMessageLoop* s_the; | ||||||
| 
 | 
 | ||||||
|  | @ -62,7 +62,7 @@ int WSMessageLoop::exec() | ||||||
|         for (auto& queued_message : messages) { |         for (auto& queued_message : messages) { | ||||||
|             auto* receiver = queued_message.receiver.ptr(); |             auto* receiver = queued_message.receiver.ptr(); | ||||||
|             auto& message = *queued_message.message; |             auto& message = *queued_message.message; | ||||||
| #ifdef WSEVENTLOOP_DEBUG | #ifdef WSMESSAGELOOP_DEBUG | ||||||
|             dbgprintf("WSMessageLoop: receiver{%p} message %u\n", receiver, (unsigned)message.type()); |             dbgprintf("WSMessageLoop: receiver{%p} message %u\n", receiver, (unsigned)message.type()); | ||||||
| #endif | #endif | ||||||
|             if (receiver) |             if (receiver) | ||||||
|  | @ -73,7 +73,7 @@ int WSMessageLoop::exec() | ||||||
| 
 | 
 | ||||||
| void WSMessageLoop::post_message(WSMessageReceiver& receiver, OwnPtr<WSMessage>&& message) | void WSMessageLoop::post_message(WSMessageReceiver& receiver, OwnPtr<WSMessage>&& message) | ||||||
| { | { | ||||||
| #ifdef WSEVENTLOOP_DEBUG | #ifdef WSMESSAGELOOP_DEBUG | ||||||
|     dbgprintf("WSMessageLoop::post_message: {%u} << receiver=%p, message=%p (type=%u)\n", m_queued_messages.size(), receiver, message.ptr(), message->type()); |     dbgprintf("WSMessageLoop::post_message: {%u} << receiver=%p, message=%p (type=%u)\n", m_queued_messages.size(), receiver, message.ptr(), message->type()); | ||||||
| #endif | #endif | ||||||
|     m_queued_messages.append({ receiver.make_weak_ptr(), move(message) }); |     m_queued_messages.append({ receiver.make_weak_ptr(), move(message) }); | ||||||
|  | @ -166,7 +166,9 @@ void WSMessageLoop::wait_for_message() | ||||||
|         sockaddr_un address; |         sockaddr_un address; | ||||||
|         socklen_t address_size = sizeof(address); |         socklen_t address_size = sizeof(address); | ||||||
|         int client_fd = accept(m_server_fd, (sockaddr*)&address, &address_size); |         int client_fd = accept(m_server_fd, (sockaddr*)&address, &address_size); | ||||||
|  | #ifdef WSMESSAGELOOP_DEBUG | ||||||
|         dbgprintf("accept() returned fd=%d, address=%s\n", client_fd, address.sun_path); |         dbgprintf("accept() returned fd=%d, address=%s\n", client_fd, address.sun_path); | ||||||
|  | #endif | ||||||
|         ASSERT(client_fd >= 0); |         ASSERT(client_fd >= 0); | ||||||
|         new WSClientConnection(client_fd); |         new WSClientConnection(client_fd); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -231,7 +231,9 @@ WSWindowManager::WSWindowManager() | ||||||
|                 } |                 } | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|  | #ifdef DEBUG_MENUS | ||||||
|             dbgprintf("WSMenu 1 item activated: '%s'\n", item.text().characters()); |             dbgprintf("WSMenu 1 item activated: '%s'\n", item.text().characters()); | ||||||
|  | #endif | ||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -340,7 +342,9 @@ void WSWindowManager::set_current_menubar(WSMenuBar* menubar) | ||||||
|         m_current_menubar = menubar->make_weak_ptr(); |         m_current_menubar = menubar->make_weak_ptr(); | ||||||
|     else |     else | ||||||
|         m_current_menubar = nullptr; |         m_current_menubar = nullptr; | ||||||
|  | #ifdef DEBUG_MENUS | ||||||
|     dbgprintf("[WM] Current menubar is now %p\n", menubar); |     dbgprintf("[WM] Current menubar is now %p\n", menubar); | ||||||
|  | #endif | ||||||
|     Point next_menu_location { menubar_menu_margin() / 2, 0 }; |     Point next_menu_location { menubar_menu_margin() / 2, 0 }; | ||||||
|     for_each_active_menubar_menu([&] (WSMenu& menu) { |     for_each_active_menubar_menu([&] (WSMenu& menu) { | ||||||
|         int text_width = font().width(menu.name()); |         int text_width = font().width(menu.name()); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling