mirror of
https://github.com/RGBCube/serenity
synced 2025-08-13 12:27:48 +00:00
Everywhere: Hook up remaining debug macros to Debug.h.
This commit is contained in:
parent
da69de1f1b
commit
eea72b9b5c
63 changed files with 458 additions and 287 deletions
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "HexEditor.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Clipboard.h>
|
||||
|
@ -222,7 +223,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event)
|
|||
if (offset < 0 || offset >= static_cast<int>(m_buffer.size()))
|
||||
return;
|
||||
|
||||
#ifdef HEX_DEBUG
|
||||
#if HEX_DEBUG
|
||||
outln("HexEditor::mousedown_event(hex): offset={}", offset);
|
||||
#endif
|
||||
|
||||
|
@ -244,7 +245,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event)
|
|||
if (offset < 0 || offset >= static_cast<int>(m_buffer.size()))
|
||||
return;
|
||||
|
||||
#ifdef HEX_DEBUG
|
||||
#if HEX_DEBUG
|
||||
outln("HexEditor::mousedown_event(text): offset={}", offset);
|
||||
#endif
|
||||
|
||||
|
@ -344,7 +345,7 @@ void HexEditor::scroll_position_into_view(int position)
|
|||
|
||||
void HexEditor::keydown_event(GUI::KeyEvent& event)
|
||||
{
|
||||
#ifdef HEX_DEBUG
|
||||
#if HEX_DEBUG
|
||||
outln("HexEditor::keydown_event key={}", static_cast<u8>(event.key()));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "IRCQuery.h"
|
||||
#include "IRCWindow.h"
|
||||
#include "IRCWindowListModel.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
|
@ -39,10 +40,6 @@
|
|||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
|
||||
#ifndef IRC_DEBUG
|
||||
# define IRC_DEBUG
|
||||
#endif
|
||||
|
||||
enum IRCNumeric {
|
||||
RPL_WELCOME = 1,
|
||||
RPL_WHOISUSER = 311,
|
||||
|
@ -255,7 +252,7 @@ void IRCClient::send_whois(const String& nick)
|
|||
|
||||
void IRCClient::handle(const Message& msg)
|
||||
{
|
||||
#ifdef IRC_DEBUG
|
||||
#if IRC_DEBUG
|
||||
outln("IRCClient::execute: prefix='{}', command='{}', arguments={}",
|
||||
msg.prefix,
|
||||
msg.command,
|
||||
|
@ -486,7 +483,7 @@ void IRCClient::handle_privmsg_or_notice(const Message& msg, PrivmsgOrNotice typ
|
|||
|
||||
bool is_ctcp = has_ctcp_payload(msg.arguments[1]);
|
||||
|
||||
#ifdef IRC_DEBUG
|
||||
#if IRC_DEBUG
|
||||
outln("handle_privmsg_or_notice: type='{}'{}, sender_nick='{}', target='{}'",
|
||||
type == PrivmsgOrNotice::Privmsg ? "privmsg" : "notice",
|
||||
is_ctcp ? " (ctcp)" : "",
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "HackStudio.h"
|
||||
#include "Language.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -153,7 +154,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token
|
|||
{
|
||||
auto it = man_paths().find(hovered_token);
|
||||
if (it == man_paths().end()) {
|
||||
#ifdef EDITOR_DEBUG
|
||||
#if EDITOR_DEBUG
|
||||
dbgln("no man path for {}", hovered_token);
|
||||
#endif
|
||||
m_documentation_tooltip_window->hide();
|
||||
|
@ -164,7 +165,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef EDITOR_DEBUG
|
||||
#if EDITOR_DEBUG
|
||||
dbgln("opening {}", it->value);
|
||||
#endif
|
||||
auto file = Core::File::construct(it->value);
|
||||
|
@ -235,7 +236,7 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
|
|||
auto end_line_length = document().line(span.range.end().line()).length();
|
||||
adjusted_range.end().set_column(min(end_line_length, adjusted_range.end().column() + 1));
|
||||
auto hovered_span_text = document().text_in_range(adjusted_range);
|
||||
#ifdef EDITOR_DEBUG
|
||||
#if EDITOR_DEBUG
|
||||
dbgln("Hovering: {} \"{}\"", adjusted_range, hovered_span_text);
|
||||
#endif
|
||||
|
||||
|
@ -301,7 +302,7 @@ void Editor::mousedown_event(GUI::MouseEvent& event)
|
|||
adjusted_range.end().set_column(adjusted_range.end().column() + 1);
|
||||
auto span_text = document().text_in_range(adjusted_range);
|
||||
auto header_path = span_text.substring(1, span_text.length() - 2);
|
||||
#ifdef EDITOR_DEBUG
|
||||
#if EDITOR_DEBUG
|
||||
dbgln("Ctrl+click: {} \"{}\"", adjusted_range, header_path);
|
||||
#endif
|
||||
navigate_to_include_if_available(header_path);
|
||||
|
@ -333,7 +334,7 @@ static HashMap<String, String>& include_paths()
|
|||
auto path = it.next_full_path();
|
||||
if (!Core::File::is_directory(path)) {
|
||||
auto key = path.substring(base.length() + 1, path.length() - base.length() - 1);
|
||||
#ifdef EDITOR_DEBUG
|
||||
#if EDITOR_DEBUG
|
||||
dbgln("Adding header \"{}\" in path \"{}\"", key, path);
|
||||
#endif
|
||||
paths.set(key, path);
|
||||
|
@ -357,7 +358,7 @@ void Editor::navigate_to_include_if_available(String path)
|
|||
{
|
||||
auto it = include_paths().find(path);
|
||||
if (it == include_paths().end()) {
|
||||
#ifdef EDITOR_DEBUG
|
||||
#if EDITOR_DEBUG
|
||||
dbgln("no header {} found.", path);
|
||||
#endif
|
||||
return;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "DiffViewer.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <LibDiff/Hunks.h>
|
||||
#include <LibGUI/AbstractView.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
|
@ -159,7 +160,7 @@ void DiffViewer::set_content(const String& original, const String& diff)
|
|||
m_original_lines = split_to_lines(original);
|
||||
m_hunks = Diff::parse_hunks(diff);
|
||||
|
||||
#ifdef DEBUG_DIFF
|
||||
#if DIFF_DEBUG
|
||||
for (size_t i = 0; i < m_original_lines.size(); ++i)
|
||||
dbgln("{}:{}", i, m_original_lines[i]);
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "AutoComplete.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <LibCpp/Lexer.h>
|
||||
|
||||
|
@ -42,7 +43,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
|
|||
|
||||
auto suggestions = identifier_prefixes(lines, tokens, index_of_target_token.value());
|
||||
|
||||
#ifdef DEBUG_AUTOCOMPLETE
|
||||
#if AUTOCOMPLETE_DEBUG
|
||||
for (auto& suggestion : suggestions) {
|
||||
dbgln("suggestion: {}", suggestion.completion);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag
|
|||
|
||||
void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message)
|
||||
{
|
||||
#ifdef DEBUG_CPP_LANGUAGE_SERVER
|
||||
#if CPP_LANGUAGE_SERVER_DEBUG
|
||||
dbgln("InsertText for file: {}", message.file_name());
|
||||
dbgln("Text: {}", message.text());
|
||||
dbgln("[{}:{}]", message.start_line(), message.start_column());
|
||||
|
@ -111,7 +111,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText
|
|||
|
||||
void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText& message)
|
||||
{
|
||||
#ifdef DEBUG_CPP_LANGUAGE_SERVER
|
||||
#if CPP_LANGUAGE_SERVER_DEBUG
|
||||
dbgln("RemoveText for file: {}", message.file_name());
|
||||
dbgln("[{}:{} - {}:{}]", message.start_line(), message.start_column(), message.end_line(), message.end_column());
|
||||
#endif
|
||||
|
@ -136,7 +136,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText
|
|||
|
||||
void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message)
|
||||
{
|
||||
#ifdef DEBUG_CPP_LANGUAGE_SERVER
|
||||
#if CPP_LANGUAGE_SERVER_DEBUG
|
||||
dbgln("AutoCompleteSuggestions for: {} {}:{}", message.file_name(), message.cursor_line(), message.cursor_column());
|
||||
#endif
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
|
|||
if (!ast)
|
||||
return {};
|
||||
|
||||
#ifdef DEBUG_AUTOCOMPLETE
|
||||
#if AUTOCOMPLETE_DEBUG
|
||||
dbgln("Complete '{}'", code);
|
||||
ast->dump(1);
|
||||
dbgln("At offset {}", offset);
|
||||
|
@ -49,7 +49,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
|
|||
auto result = ast->complete_for_editor(m_shell, offset);
|
||||
Vector<GUI::AutocompleteProvider::Entry> completions;
|
||||
for (auto& entry : result) {
|
||||
#ifdef DEBUG_AUTOCOMPLETE
|
||||
#if AUTOCOMPLETE_DEBUG
|
||||
dbgln("Suggestion: '{}' starting at {}", entry.text_string, entry.input_offset);
|
||||
#endif
|
||||
completions.append({ entry.text_string, entry.input_offset });
|
||||
|
|
|
@ -92,7 +92,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag
|
|||
|
||||
void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message)
|
||||
{
|
||||
#ifdef DEBUG_SH_LANGUAGE_SERVER
|
||||
#if SH_LANGUAGE_SERVER_DEBUG
|
||||
dbgln("InsertText for file: {}", message.file_name());
|
||||
dbgln("Text: {}", message.text());
|
||||
dbgln("[{}:{}]", message.start_line(), message.start_column());
|
||||
|
@ -111,7 +111,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText
|
|||
|
||||
void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText& message)
|
||||
{
|
||||
#ifdef DEBUG_SH_LANGUAGE_SERVER
|
||||
#if SH_LANGUAGE_SERVER_DEBUG
|
||||
dbgln("RemoveText for file: {}", message.file_name());
|
||||
dbgln("[{}:{} - {}:{}]", message.start_line(), message.start_column(), message.end_line(), message.end_column());
|
||||
#endif
|
||||
|
@ -134,7 +134,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText
|
|||
|
||||
void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message)
|
||||
{
|
||||
#ifdef DEBUG_SH_LANGUAGE_SERVER
|
||||
#if SH_LANGUAGE_SERVER_DEBUG
|
||||
dbgln("AutoCompleteSuggestions for: {} {}:{}", message.file_name(), message.cursor_line(), message.cursor_column());
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/HashMap.h>
|
||||
|
@ -443,7 +444,7 @@ public:
|
|||
stream >> message_endpoint_magic;
|
||||
if (stream.handle_any_error()) {
|
||||
)~~~");
|
||||
#ifdef GENERATE_DEBUG_CODE
|
||||
#if GENERATE_DEBUG_CODE
|
||||
endpoint_generator.append(R"~~~(
|
||||
dbgln("Failed to read message endpoint magic");
|
||||
)~~~");
|
||||
|
@ -454,7 +455,7 @@ public:
|
|||
|
||||
if (message_endpoint_magic != @endpoint.magic@) {
|
||||
)~~~");
|
||||
#ifdef GENERATE_DEBUG_CODE
|
||||
#if GENERATE_DEBUG_CODE
|
||||
endpoint_generator.append(R"~~~(
|
||||
dbgln("Endpoint magic number message_endpoint_magic != @endpoint.magic@");
|
||||
)~~~");
|
||||
|
@ -467,7 +468,7 @@ public:
|
|||
stream >> message_id;
|
||||
if (stream.handle_any_error()) {
|
||||
)~~~");
|
||||
#ifdef GENERATE_DEBUG_CODE
|
||||
#if GENERATE_DEBUG_CODE
|
||||
endpoint_generator.append(R"~~~(
|
||||
dbgln("Failed to read message ID");
|
||||
)~~~");
|
||||
|
@ -501,7 +502,7 @@ public:
|
|||
endpoint_generator.append(R"~~~(
|
||||
default:
|
||||
)~~~");
|
||||
#ifdef GENERATE_DEBUG_CODE
|
||||
#if GENERATE_DEBUG_CODE
|
||||
endpoint_generator.append(R"~~~(
|
||||
dbgln("Failed to decode @endpoint.name@.({})", message_id);
|
||||
)~~~");
|
||||
|
@ -512,7 +513,7 @@ public:
|
|||
|
||||
if (stream.handle_any_error()) {
|
||||
)~~~");
|
||||
#ifdef GENERATE_DEBUG_CODE
|
||||
#if GENERATE_DEBUG_CODE
|
||||
endpoint_generator.append(R"~~~(
|
||||
dbgln("Failed to read the message");
|
||||
)~~~");
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "MallocTracer.h"
|
||||
#include "Emulator.h"
|
||||
#include "MmapRegion.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <mallocdefs.h>
|
||||
|
@ -309,7 +310,7 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const
|
|||
for (size_t i = 0; i < pointers_in_mallocation; ++i) {
|
||||
auto value = m_emulator.mmu().read32({ 0x23, other_mallocation.address + i * sizeof(u32) });
|
||||
if (value.value() == mallocation.address && !value.is_uninitialized()) {
|
||||
#ifdef REACHABLE_DEBUG
|
||||
#if REACHABLE_DEBUG
|
||||
reportln("mallocation {:p} is reachable from other mallocation {:p}", mallocation.address, other_mallocation.address);
|
||||
#endif
|
||||
reachable = true;
|
||||
|
@ -339,7 +340,7 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const
|
|||
for (size_t i = 0; i < pointers_in_region; ++i) {
|
||||
auto value = region.read32(i * sizeof(u32));
|
||||
if (value.value() == mallocation.address && !value.is_uninitialized()) {
|
||||
#ifdef REACHABLE_DEBUG
|
||||
#if REACHABLE_DEBUG
|
||||
reportln("mallocation {:p} is reachable from region {:p}-{:p}", mallocation.address, region.base(), region.end() - 1);
|
||||
#endif
|
||||
reachable = true;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "SoftCPU.h"
|
||||
#include "Emulator.h"
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -147,7 +148,7 @@ ValueWithShadow<u8> SoftCPU::read_memory8(X86::LogicalAddress address)
|
|||
{
|
||||
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
auto value = m_emulator.mmu().read8(address);
|
||||
#ifdef MEMORY_DEBUG
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mread_memory8: @{:04x}:{:08x} -> {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
return value;
|
||||
|
@ -157,7 +158,7 @@ ValueWithShadow<u16> SoftCPU::read_memory16(X86::LogicalAddress address)
|
|||
{
|
||||
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
auto value = m_emulator.mmu().read16(address);
|
||||
#ifdef MEMORY_DEBUG
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mread_memory16: @{:04x}:{:08x} -> {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
return value;
|
||||
|
@ -167,7 +168,7 @@ ValueWithShadow<u32> SoftCPU::read_memory32(X86::LogicalAddress address)
|
|||
{
|
||||
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
auto value = m_emulator.mmu().read32(address);
|
||||
#ifdef MEMORY_DEBUG
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mread_memory32: @{:04x}:{:08x} -> {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
return value;
|
||||
|
@ -177,7 +178,7 @@ ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address)
|
|||
{
|
||||
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
auto value = m_emulator.mmu().read64(address);
|
||||
#ifdef MEMORY_DEBUG
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mread_memory64: @{:04x}:{:08x} -> {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
return value;
|
||||
|
@ -186,7 +187,7 @@ ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address)
|
|||
void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> value)
|
||||
{
|
||||
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
#ifdef MEMORY_DEBUG
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mwrite_memory8: @{:04x}:{:08x} <- {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
m_emulator.mmu().write8(address, value);
|
||||
|
@ -195,7 +196,7 @@ void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> val
|
|||
void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> value)
|
||||
{
|
||||
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
#ifdef MEMORY_DEBUG
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mwrite_memory16: @{:04x}:{:08x} <- {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
m_emulator.mmu().write16(address, value);
|
||||
|
@ -204,7 +205,7 @@ void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> v
|
|||
void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> value)
|
||||
{
|
||||
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
#ifdef MEMORY_DEBUG
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mwrite_memory32: @{:04x}:{:08x} <- {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
m_emulator.mmu().write32(address, value);
|
||||
|
@ -213,7 +214,7 @@ void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> v
|
|||
void SoftCPU::write_memory64(X86::LogicalAddress address, ValueWithShadow<u64> value)
|
||||
{
|
||||
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
#ifdef MEMORY_DEBUG
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mwrite_memory64: @{:04x}:{:08x} <- {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
m_emulator.mmu().write64(address, value);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/NumericLimits.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <LibAudio/Buffer.h>
|
||||
|
@ -70,7 +71,7 @@ bool WavLoaderPlugin::sniff()
|
|||
|
||||
RefPtr<Buffer> WavLoaderPlugin::get_more_samples(size_t max_bytes_to_read_from_input)
|
||||
{
|
||||
#ifdef AWAVLOADER_DEBUG
|
||||
#if AWAVLOADER_DEBUG
|
||||
dbgln("Read WAV of format PCM with num_channels {} sample rate {}, bits per sample {}", m_num_channels, m_sample_rate, m_bits_per_sample);
|
||||
#endif
|
||||
size_t samples_to_read = static_cast<int>(max_bytes_to_read_from_input) / (m_num_channels * (m_bits_per_sample / 8));
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -62,7 +63,7 @@ void __cxa_finalize(void* dso_handle)
|
|||
|
||||
int entry_index = __exit_entry_count;
|
||||
|
||||
#ifdef GLOBAL_DTORS_DEBUG
|
||||
#if GLOBAL_DTORS_DEBUG
|
||||
dbgprintf("__cxa_finalize: %d entries in the finalizer list\n", entry_index);
|
||||
#endif
|
||||
|
||||
|
@ -70,7 +71,7 @@ void __cxa_finalize(void* dso_handle)
|
|||
auto& exit_entry = __exit_entries[entry_index];
|
||||
bool needs_calling = !exit_entry.has_been_called && (!dso_handle || dso_handle == exit_entry.dso_handle);
|
||||
if (needs_calling) {
|
||||
#ifdef GLOBAL_DTORS_DEBUG
|
||||
#if GLOBAL_DTORS_DEBUG
|
||||
dbgprintf("__cxa_finalize: calling entry[%d] %p(%p) dso: %p\n", entry_index, exit_entry.method, exit_entry.parameter, exit_entry.dso_handle);
|
||||
#endif
|
||||
exit_entry.method(exit_entry.parameter);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/InlineLinkedList.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/ScopedValueRollback.h>
|
||||
|
@ -257,13 +258,13 @@ static void* malloc_impl(size_t size)
|
|||
block->m_freelist = block->m_freelist->next;
|
||||
if (block->is_full()) {
|
||||
g_malloc_stats.number_of_blocks_full++;
|
||||
#ifdef MALLOC_DEBUG
|
||||
#if MALLOC_DEBUG
|
||||
dbgprintf("Block %p is now full in size class %zu\n", block, good_size);
|
||||
#endif
|
||||
allocator->usable_blocks.remove(block);
|
||||
allocator->full_blocks.append(block);
|
||||
}
|
||||
#ifdef MALLOC_DEBUG
|
||||
#if MALLOC_DEBUG
|
||||
dbgprintf("LibC: allocated %p (chunk in block %p, size %zu)\n", ptr, block, block->bytes_per_chunk());
|
||||
#endif
|
||||
|
||||
|
@ -316,7 +317,7 @@ static void free_impl(void* ptr)
|
|||
assert(magic == MAGIC_PAGE_HEADER);
|
||||
auto* block = (ChunkedBlock*)block_base;
|
||||
|
||||
#ifdef MALLOC_DEBUG
|
||||
#if MALLOC_DEBUG
|
||||
dbgprintf("LibC: freeing %p in allocator %p (size=%zu, used=%zu)\n", ptr, block, block->bytes_per_chunk(), block->used_chunks());
|
||||
#endif
|
||||
|
||||
|
@ -330,7 +331,7 @@ static void free_impl(void* ptr)
|
|||
if (block->is_full()) {
|
||||
size_t good_size;
|
||||
auto* allocator = allocator_for_size(block->m_size, good_size);
|
||||
#ifdef MALLOC_DEBUG
|
||||
#if MALLOC_DEBUG
|
||||
dbgprintf("Block %p no longer full in size class %zu\n", block, good_size);
|
||||
#endif
|
||||
g_malloc_stats.number_of_freed_full_blocks++;
|
||||
|
@ -344,7 +345,7 @@ static void free_impl(void* ptr)
|
|||
size_t good_size;
|
||||
auto* allocator = allocator_for_size(block->m_size, good_size);
|
||||
if (allocator->block_count < number_of_chunked_blocks_to_keep_around_per_size_class) {
|
||||
#ifdef MALLOC_DEBUG
|
||||
#if MALLOC_DEBUG
|
||||
dbgprintf("Keeping block %p around for size class %zu\n", block, good_size);
|
||||
#endif
|
||||
g_malloc_stats.number_of_keeps++;
|
||||
|
@ -354,7 +355,7 @@ static void free_impl(void* ptr)
|
|||
madvise(block, ChunkedBlock::block_size, MADV_SET_VOLATILE);
|
||||
return;
|
||||
}
|
||||
#ifdef MALLOC_DEBUG
|
||||
#if MALLOC_DEBUG
|
||||
dbgprintf("Releasing block %p for size class %zu\n", block, good_size);
|
||||
#endif
|
||||
g_malloc_stats.number_of_frees++;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
|
@ -40,7 +41,7 @@ char* BC;
|
|||
|
||||
int tgetent([[maybe_unused]] char* bp, [[maybe_unused]] const char* name)
|
||||
{
|
||||
#ifdef TERMCAP_DEBUG
|
||||
#if TERMCAP_DEBUG
|
||||
fprintf(stderr, "tgetent: bp=%p, name='%s'\n", bp, name);
|
||||
#endif
|
||||
PC = '\0';
|
||||
|
@ -100,7 +101,7 @@ static void ensure_caps()
|
|||
char* tgetstr(const char* id, char** area)
|
||||
{
|
||||
ensure_caps();
|
||||
#ifdef TERMCAP_DEBUG
|
||||
#if TERMCAP_DEBUG
|
||||
fprintf(stderr, "tgetstr: id='%s'\n", id);
|
||||
#endif
|
||||
auto it = caps->find(id);
|
||||
|
@ -119,7 +120,7 @@ char* tgetstr(const char* id, char** area)
|
|||
|
||||
int tgetflag([[maybe_unused]] const char* id)
|
||||
{
|
||||
#ifdef TERMCAP_DEBUG
|
||||
#if TERMCAP_DEBUG
|
||||
fprintf(stderr, "tgetflag: '%s'\n", id);
|
||||
#endif
|
||||
auto it = caps->find(id);
|
||||
|
@ -130,7 +131,7 @@ int tgetflag([[maybe_unused]] const char* id)
|
|||
|
||||
int tgetnum(const char* id)
|
||||
{
|
||||
#ifdef TERMCAP_DEBUG
|
||||
#if TERMCAP_DEBUG
|
||||
fprintf(stderr, "tgetnum: '%s'\n", id);
|
||||
#endif
|
||||
auto it = caps->find(id);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "UCIEndpoint.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -42,7 +43,7 @@ Endpoint::Endpoint(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevic
|
|||
|
||||
void Endpoint::send_command(const Command& command)
|
||||
{
|
||||
#ifdef UCI_DEBUG
|
||||
#if UCI_DEBUG
|
||||
dbgln("{} Sent UCI Command: {}", class_name(), String(command.to_string().characters(), Chomp));
|
||||
#endif
|
||||
m_out->write(command.to_string());
|
||||
|
@ -93,7 +94,7 @@ NonnullOwnPtr<Command> Endpoint::read_command()
|
|||
{
|
||||
String line(ReadonlyBytes(m_in->read_line(4096).bytes()), Chomp);
|
||||
|
||||
#ifdef UCI_DEBUG
|
||||
#if UCI_DEBUG
|
||||
dbgln("{} Received UCI Command: {}", class_name(), line);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/IDAllocator.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonValue.h>
|
||||
|
@ -306,7 +307,7 @@ EventLoop::EventLoop()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("{} Core::EventLoop constructed :)", getpid());
|
||||
#endif
|
||||
}
|
||||
|
@ -344,7 +345,7 @@ EventLoop& EventLoop::current()
|
|||
|
||||
void EventLoop::quit(int code)
|
||||
{
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop::quit({})", code);
|
||||
#endif
|
||||
m_exit_requested = true;
|
||||
|
@ -353,7 +354,7 @@ void EventLoop::quit(int code)
|
|||
|
||||
void EventLoop::unquit()
|
||||
{
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop::unquit()");
|
||||
#endif
|
||||
m_exit_requested = false;
|
||||
|
@ -407,7 +408,7 @@ void EventLoop::pump(WaitMode mode)
|
|||
auto& queued_event = events.at(i);
|
||||
auto receiver = queued_event.receiver.strong_ref();
|
||||
auto& event = *queued_event.event;
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
if (receiver)
|
||||
dbgln("Core::EventLoop: {} event {}", *receiver, event.type());
|
||||
#endif
|
||||
|
@ -417,13 +418,13 @@ void EventLoop::pump(WaitMode mode)
|
|||
ASSERT_NOT_REACHED();
|
||||
return;
|
||||
default:
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Event type {} with no receiver :(", event.type());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
} else if (event.type() == Event::Type::DeferredInvoke) {
|
||||
#ifdef DEFERRED_INVOKE_DEBUG
|
||||
#if DEFERRED_INVOKE_DEBUG
|
||||
dbgln("DeferredInvoke: receiver = {}", *receiver);
|
||||
#endif
|
||||
static_cast<DeferredInvocationEvent&>(event).m_invokee(*receiver);
|
||||
|
@ -434,7 +435,7 @@ void EventLoop::pump(WaitMode mode)
|
|||
|
||||
if (m_exit_requested) {
|
||||
LOCKER(m_private->lock);
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop: Exit requested. Rejigging {} events.", events.size() - i);
|
||||
#endif
|
||||
decltype(m_queued_events) new_event_queue;
|
||||
|
@ -451,7 +452,7 @@ void EventLoop::pump(WaitMode mode)
|
|||
void EventLoop::post_event(Object& receiver, NonnullOwnPtr<Event>&& event)
|
||||
{
|
||||
LOCKER(m_private->lock);
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop::post_event: ({}) << receivier={}, event={}", m_queued_events.size(), receiver, event);
|
||||
#endif
|
||||
m_queued_events.empend(receiver, move(event));
|
||||
|
@ -461,14 +462,14 @@ SignalHandlers::SignalHandlers(int signo, void (*handle_signal)(int))
|
|||
: m_signo(signo)
|
||||
, m_original_handler(signal(signo, handle_signal))
|
||||
{
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop: Registered handler for signal {}", m_signo);
|
||||
#endif
|
||||
}
|
||||
|
||||
SignalHandlers::~SignalHandlers()
|
||||
{
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop: Unregistering handler for signal {}", m_signo);
|
||||
#endif
|
||||
signal(m_signo, m_original_handler);
|
||||
|
@ -534,7 +535,7 @@ void EventLoop::dispatch_signal(int signo)
|
|||
// This allows a handler to unregister/register while the handlers
|
||||
// are being called!
|
||||
auto handler = handlers->value;
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop: dispatching signal {}", signo);
|
||||
#endif
|
||||
handler->dispatch();
|
||||
|
@ -676,7 +677,7 @@ try_select_again:
|
|||
return;
|
||||
goto try_select_again;
|
||||
}
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop::wait_for_event: {} ({}: {})", marked_fd_count, saved_errno, strerror(saved_errno));
|
||||
#endif
|
||||
// Blow up, similar to Core::safe_syscall.
|
||||
|
@ -719,7 +720,7 @@ try_select_again:
|
|||
&& owner && !owner->is_visible_for_timer_purposes()) {
|
||||
continue;
|
||||
}
|
||||
#ifdef EVENTLOOP_DEBUG
|
||||
#if EVENTLOOP_DEBUG
|
||||
dbgln("Core::EventLoop: Timer {} has expired, sending Core::TimerEvent to {}", timer.timer_id, *owner);
|
||||
#endif
|
||||
if (owner)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibELF/DynamicLoader.h>
|
||||
#include <LibELF/Validation.h>
|
||||
|
@ -36,10 +37,6 @@
|
|||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#ifndef DYNAMIC_LOAD_DEBUG
|
||||
# define DYNAMIC_LOAD_DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef DYNAMIC_LOAD_VERBOSE
|
||||
# define VERBOSE(fmt, ...) dbgprintf(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
|
@ -173,7 +170,7 @@ bool DynamicLoader::load_stage_2(unsigned flags, size_t total_tls_size)
|
|||
{
|
||||
ASSERT(flags & RTLD_GLOBAL);
|
||||
|
||||
#ifdef DYNAMIC_LOAD_DEBUG
|
||||
#if DYNAMIC_LOAD_DEBUG
|
||||
m_dynamic_object->dump();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Demangle.h>
|
||||
#include <AK/Memory.h>
|
||||
#include <AK/QuickSort.h>
|
||||
|
@ -51,7 +52,7 @@ Image::~Image()
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef ELF_IMAGE_DEBUG
|
||||
#if ELF_IMAGE_DEBUG
|
||||
static const char* object_file_type_to_string(Elf32_Half type)
|
||||
{
|
||||
switch (type) {
|
||||
|
@ -91,7 +92,7 @@ unsigned Image::symbol_count() const
|
|||
|
||||
void Image::dump() const
|
||||
{
|
||||
#ifdef ELF_IMAGE_DEBUG
|
||||
#if ELF_IMAGE_DEBUG
|
||||
dbgln("ELF::Image({:p}) {{", this);
|
||||
dbgln(" is_valid: {}", is_valid());
|
||||
|
||||
|
@ -293,7 +294,7 @@ const Image::RelocationSection Image::Section::relocations() const
|
|||
if (relocation_section.type() != SHT_REL)
|
||||
return static_cast<const RelocationSection>(m_image.section(0));
|
||||
|
||||
#ifdef ELF_IMAGE_DEBUG
|
||||
#if ELF_IMAGE_DEBUG
|
||||
dbgln("Found relocations for {} in {}", name(), relocation_section.name());
|
||||
#endif
|
||||
return static_cast<const RelocationSection>(relocation_section);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/ActionGroup.h>
|
||||
|
@ -68,7 +69,7 @@ void Menu::set_icon(const Gfx::Bitmap* icon)
|
|||
void Menu::add_action(NonnullRefPtr<Action> action)
|
||||
{
|
||||
m_items.append(make<MenuItem>(m_menu_id, move(action)));
|
||||
#ifdef GMENU_DEBUG
|
||||
#if GMENU_DEBUG
|
||||
dbgln("GUI::Menu::add_action(): MenuItem Menu ID: {}", m_menu_id);
|
||||
#endif
|
||||
}
|
||||
|
@ -109,7 +110,7 @@ int Menu::realize_menu(RefPtr<Action> default_action)
|
|||
unrealize_menu();
|
||||
m_menu_id = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateMenu>(m_name)->menu_id();
|
||||
|
||||
#ifdef MENU_DEBUG
|
||||
#if MENU_DEBUG
|
||||
dbgln("GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id);
|
||||
#endif
|
||||
ASSERT(m_menu_id > 0);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
|
@ -478,7 +479,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
for_each_visual_line(line_index, [&](const Gfx::IntRect& visual_line_rect, auto& visual_line_text, size_t start_of_visual_line, [[maybe_unused]] bool is_last_visual_line) {
|
||||
if (is_multi_line() && line_index == m_cursor.line())
|
||||
painter.fill_rect(visual_line_rect, widget_background_color.darkened(0.9f));
|
||||
#ifdef DEBUG_TEXTEDITOR
|
||||
#if TEXTEDITOR_DEBUG
|
||||
painter.draw_rect(visual_line_rect, Color::Cyan);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibGUI/HeaderView.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
|
@ -257,7 +258,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
auto rect = a_rect.translated(0, y_offset);
|
||||
auto toggle_rect = a_toggle_rect.translated(0, y_offset);
|
||||
|
||||
#ifdef DEBUG_ITEM_RECTS
|
||||
#if ITEM_RECTS_DEBUG
|
||||
painter.fill_rect(rect, Color::WarmGray);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/NeverDestroyed.h>
|
||||
|
@ -558,7 +559,7 @@ void Window::update(const Gfx::IntRect& a_rect)
|
|||
|
||||
for (auto& pending_rect : m_pending_paint_event_rects) {
|
||||
if (pending_rect.contains(a_rect)) {
|
||||
#ifdef UPDATE_COALESCING_DEBUG
|
||||
#if UPDATE_COALESCING_DEBUG
|
||||
dbgln("Ignoring {} since it's contained by pending rect {}", a_rect, pending_rect);
|
||||
#endif
|
||||
return;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibGemini/GeminiJob.h>
|
||||
#include <LibGemini/GeminiResponse.h>
|
||||
|
@ -39,7 +40,7 @@ void GeminiJob::start()
|
|||
m_socket = TLS::TLSv12::construct(this);
|
||||
m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates());
|
||||
m_socket->on_tls_connected = [this] {
|
||||
#ifdef GEMINIJOB_DEBUG
|
||||
#if GEMINIJOB_DEBUG
|
||||
dbgln("GeminiJob: on_connected callback");
|
||||
#endif
|
||||
on_socket_connected();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
|
@ -188,7 +189,7 @@ static bool load_ico_directory(ICOLoadingContext& context)
|
|||
for (size_t i = 0; i < image_count.value(); ++i) {
|
||||
auto maybe_desc = decode_ico_direntry(stream);
|
||||
if (!maybe_desc.has_value()) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_directory: error loading entry: %lu\n", i);
|
||||
#endif
|
||||
return false;
|
||||
|
@ -197,13 +198,13 @@ static bool load_ico_directory(ICOLoadingContext& context)
|
|||
auto& desc = maybe_desc.value();
|
||||
if (desc.offset + desc.size < desc.offset // detect integer overflow
|
||||
|| (desc.offset + desc.size) > context.data_size) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_directory: offset: %lu size: %lu doesn't fit in ICO size: %lu\n",
|
||||
desc.offset, desc.size, context.data_size);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_directory: index %zu width: %u height: %u offset: %lu size: %lu\n",
|
||||
i, desc.width, desc.height, desc.offset, desc.size);
|
||||
#endif
|
||||
|
@ -222,14 +223,14 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
|
|||
|
||||
memcpy(&info, context.data + desc.offset, sizeof(info));
|
||||
if (info.size != sizeof(info)) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bmp: info size: %u, expected: %lu\n", info.size, sizeof(info));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if (info.width < 0) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bmp: width %d < 0\n", info.width);
|
||||
#endif
|
||||
return false;
|
||||
|
@ -241,26 +242,26 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
|
|||
}
|
||||
|
||||
if (info.planes != 1) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bmp: planes: %d != 1", info.planes);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if (info.bpp != 32) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bmp: unsupported bpp: %u\n", info.bpp);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bmp: width: %d height: %d direction: %s bpp: %d size_image: %u\n",
|
||||
info.width, info.height, topdown ? "TopDown" : "BottomUp", info.bpp, info.size_image);
|
||||
#endif
|
||||
|
||||
if (info.compression != 0 || info.palette_size != 0 || info.important_colors != 0) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bmp: following fields must be 0: compression: %u palette_size: %u important_colors: %u\n",
|
||||
info.compression, info.palette_size, info.important_colors);
|
||||
#endif
|
||||
|
@ -268,7 +269,7 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
|
|||
}
|
||||
|
||||
if (info.width != desc.width || info.height != 2 * desc.height) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bmp: size mismatch: ico %dx%d, bmp %dx%d\n",
|
||||
desc.width, desc.height, info.width, info.height);
|
||||
#endif
|
||||
|
@ -280,7 +281,7 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
|
|||
size_t required_len = desc.height * (desc.width * sizeof(BMP_ARGB) + mask_row_len);
|
||||
size_t available_len = desc.size - sizeof(info);
|
||||
if (required_len > available_len) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bmp: required_len: %lu > available_len: %lu\n",
|
||||
required_len, available_len);
|
||||
#endif
|
||||
|
@ -329,7 +330,7 @@ static bool load_ico_bitmap(ICOLoadingContext& context, Optional<size_t> index)
|
|||
if (png_decoder.sniff()) {
|
||||
desc.bitmap = png_decoder.bitmap();
|
||||
if (!desc.bitmap) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bitmap: failed to load PNG encoded image index: %lu\n", real_index);
|
||||
#endif
|
||||
return false;
|
||||
|
@ -337,7 +338,7 @@ static bool load_ico_bitmap(ICOLoadingContext& context, Optional<size_t> index)
|
|||
return true;
|
||||
} else {
|
||||
if (!load_ico_bmp(context, desc)) {
|
||||
#ifdef ICO_DEBUG
|
||||
#if ICO_DEBUG
|
||||
printf("load_ico_bitmap: failed to load BMP encoded image index: %lu\n", real_index);
|
||||
#endif
|
||||
return false;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibCore/Gzip.h>
|
||||
#include <LibCore/TCPSocket.h>
|
||||
#include <LibHTTP/HttpJob.h>
|
||||
|
@ -37,7 +38,7 @@ void HttpJob::start()
|
|||
ASSERT(!m_socket);
|
||||
m_socket = Core::TCPSocket::construct(this);
|
||||
m_socket->on_connected = [this] {
|
||||
#ifdef CHTTPJOB_DEBUG
|
||||
#if CHTTPJOB_DEBUG
|
||||
dbgln("HttpJob: on_connected callback");
|
||||
#endif
|
||||
on_socket_connected();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/Gzip.h>
|
||||
#include <LibHTTP/HttpResponse.h>
|
||||
|
@ -40,7 +41,7 @@ void HttpsJob::start()
|
|||
m_socket = TLS::TLSv12::construct(this);
|
||||
m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates());
|
||||
m_socket->on_tls_connected = [this] {
|
||||
#ifdef HTTPSJOB_DEBUG
|
||||
#if HTTPSJOB_DEBUG
|
||||
dbgln("HttpsJob: on_connected callback");
|
||||
#endif
|
||||
on_socket_connected();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/StackInfo.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
|
@ -115,7 +116,7 @@ void Heap::gather_roots(HashTable<Cell*>& roots)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln("gather_roots:");
|
||||
for (auto* root : roots)
|
||||
dbgln(" + {}", root);
|
||||
|
@ -126,7 +127,7 @@ __attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(Has
|
|||
{
|
||||
FlatPtr dummy;
|
||||
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln("gather_conservative_roots:");
|
||||
#endif
|
||||
|
||||
|
@ -157,19 +158,19 @@ __attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(Has
|
|||
for (auto possible_pointer : possible_pointers) {
|
||||
if (!possible_pointer)
|
||||
continue;
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln(" ? {}", (const void*)possible_pointer);
|
||||
#endif
|
||||
auto* possible_heap_block = HeapBlock::from_cell(reinterpret_cast<const Cell*>(possible_pointer));
|
||||
if (all_live_heap_blocks.contains(possible_heap_block)) {
|
||||
if (auto* cell = possible_heap_block->cell_from_possible_pointer(possible_pointer)) {
|
||||
if (cell->is_live()) {
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln(" ?-> {}", (const void*)cell);
|
||||
#endif
|
||||
roots.set(cell);
|
||||
} else {
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln(" #-> {}", (const void*)cell);
|
||||
#endif
|
||||
}
|
||||
|
@ -186,7 +187,7 @@ public:
|
|||
{
|
||||
if (cell->is_marked())
|
||||
return;
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln(" ! {}", cell);
|
||||
#endif
|
||||
cell->set_marked(true);
|
||||
|
@ -196,7 +197,7 @@ public:
|
|||
|
||||
void Heap::mark_live_cells(const HashTable<Cell*>& roots)
|
||||
{
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln("mark_live_cells:");
|
||||
#endif
|
||||
MarkingVisitor visitor;
|
||||
|
@ -206,7 +207,7 @@ void Heap::mark_live_cells(const HashTable<Cell*>& roots)
|
|||
|
||||
void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measurement_timer)
|
||||
{
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln("sweep_dead_cells:");
|
||||
#endif
|
||||
Vector<HeapBlock*, 32> empty_blocks;
|
||||
|
@ -223,7 +224,7 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure
|
|||
block.for_each_cell([&](Cell* cell) {
|
||||
if (cell->is_live()) {
|
||||
if (!cell->is_marked()) {
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln(" ~ {}", cell);
|
||||
#endif
|
||||
block.deallocate(cell);
|
||||
|
@ -245,20 +246,20 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure
|
|||
});
|
||||
|
||||
for (auto* block : empty_blocks) {
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln(" - HeapBlock empty @ {}: cell_size={}", block, block->cell_size());
|
||||
#endif
|
||||
allocator_for_size(block->cell_size()).block_did_become_empty({}, *block);
|
||||
}
|
||||
|
||||
for (auto* block : full_blocks_that_became_usable) {
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
dbgln(" - HeapBlock usable again @ {}: cell_size={}", block, block->cell_size());
|
||||
#endif
|
||||
allocator_for_size(block->cell_size()).block_did_become_usable({}, *block);
|
||||
}
|
||||
|
||||
#ifdef HEAP_DEBUG
|
||||
#if HEAP_DEBUG
|
||||
for_each_block([&](auto& block) {
|
||||
dbgln(" > Live HeapBlock @ {}: cell_size={}", &block, block.cell_size());
|
||||
return IterationDecision::Continue;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
#include "Lexer.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <ctype.h>
|
||||
|
@ -169,7 +170,7 @@ void Lexer::consume()
|
|||
return;
|
||||
|
||||
if (is_line_terminator()) {
|
||||
#ifdef LEXER_DEBUG
|
||||
#if LEXER_DEBUG
|
||||
String type;
|
||||
if (m_current_char == '\n')
|
||||
type = "LINE FEED";
|
||||
|
@ -198,7 +199,7 @@ void Lexer::consume()
|
|||
if (!second_char_of_crlf) {
|
||||
m_line_number++;
|
||||
m_line_column = 1;
|
||||
#ifdef LEXER_DEBUG
|
||||
#if LEXER_DEBUG
|
||||
dbgln("Incremented line number, now at: line {}, column 1", m_line_number);
|
||||
} else {
|
||||
dbgln("Previous was CR, this is LF - not incrementing line number again.");
|
||||
|
@ -638,7 +639,7 @@ Token Lexer::next()
|
|||
value_start_line_number,
|
||||
value_start_column_number);
|
||||
|
||||
#ifdef LEXER_DEBUG
|
||||
#if LEXER_DEBUG
|
||||
dbgln("------------------------------");
|
||||
dbgln("Token: {}", m_current_token.name());
|
||||
dbgln("Trivia: _{}_", m_current_token.trivia());
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
|
@ -397,7 +398,7 @@ bool Object::define_property(const StringOrSymbol& property_name, const Object&
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Defining new property {} with accessor descriptor {{ attributes={}, getter={}, setter={} }}", property_name.to_display_string(), attributes, getter, setter);
|
||||
#endif
|
||||
|
||||
|
@ -417,7 +418,7 @@ bool Object::define_property(const StringOrSymbol& property_name, const Object&
|
|||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Defining new property {} with data descriptor {{ attributes={}, value={} }}", property_name.to_display_string(), attributes, value);
|
||||
#endif
|
||||
|
||||
|
@ -497,7 +498,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
|
|||
bool new_property = !metadata.has_value();
|
||||
|
||||
if (!is_extensible() && new_property) {
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Disallow define_property of non-extensible object");
|
||||
#endif
|
||||
if (throw_exceptions && vm().in_strict_mode())
|
||||
|
@ -526,7 +527,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
|
|||
}
|
||||
|
||||
if (!new_property && mode == PutOwnPropertyMode::DefineProperty && !metadata.value().attributes.is_configurable() && attributes != metadata.value().attributes) {
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Disallow reconfig of non-configurable property");
|
||||
#endif
|
||||
if (throw_exceptions)
|
||||
|
@ -542,14 +543,14 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
|
|||
}
|
||||
metadata = shape().lookup(property_name);
|
||||
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Reconfigured property {}, new shape says offset is {} and my storage capacity is {}", property_name.to_display_string(), metadata.value().offset, m_storage.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
auto value_here = m_storage[metadata.value().offset];
|
||||
if (!new_property && mode == PutOwnPropertyMode::Put && !value_here.is_accessor() && !metadata.value().attributes.is_writable()) {
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Disallow write to non-writable property");
|
||||
#endif
|
||||
return false;
|
||||
|
@ -574,7 +575,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index,
|
|||
auto new_property = !existing_property.has_value();
|
||||
|
||||
if (!is_extensible() && new_property) {
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Disallow define_property of non-extensible object");
|
||||
#endif
|
||||
if (throw_exceptions && vm().in_strict_mode())
|
||||
|
@ -593,7 +594,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index,
|
|||
PropertyAttributes existing_attributes = new_property ? 0 : existing_property.value().attributes;
|
||||
|
||||
if (!new_property && mode == PutOwnPropertyMode::DefineProperty && !existing_attributes.is_configurable() && attributes != existing_attributes) {
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Disallow reconfig of non-configurable property");
|
||||
#endif
|
||||
if (throw_exceptions)
|
||||
|
@ -603,7 +604,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index,
|
|||
|
||||
auto value_here = new_property ? Value() : existing_property.value().value;
|
||||
if (!new_property && mode == PutOwnPropertyMode::Put && !value_here.is_accessor() && !existing_attributes.is_writable()) {
|
||||
#ifdef OBJECT_DEBUG
|
||||
#if OBJECT_DEBUG
|
||||
dbgln("Disallow write to non-writable property");
|
||||
#endif
|
||||
return false;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibLine/Editor.h>
|
||||
|
||||
namespace {
|
||||
|
@ -39,7 +40,7 @@ void KeyCallbackMachine::register_key_input_callback(Vector<Key> keys, Function<
|
|||
|
||||
void KeyCallbackMachine::key_pressed(Editor& editor, Key key)
|
||||
{
|
||||
#ifdef CALLBACK_MACHINE_DEBUG
|
||||
#if CALLBACK_MACHINE_DEBUG
|
||||
dbgln("Key<{}, {}> pressed, seq_length={}, {} things in the matching vector", key.key, key.modifiers, m_sequence_length, m_current_matching_keys.size());
|
||||
#endif
|
||||
if (m_sequence_length == 0) {
|
||||
|
@ -80,7 +81,7 @@ void KeyCallbackMachine::key_pressed(Editor& editor, Key key)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CALLBACK_MACHINE_DEBUG
|
||||
#if CALLBACK_MACHINE_DEBUG
|
||||
dbgln("seq_length={}, matching vector:", m_sequence_length);
|
||||
for (auto& key : m_current_matching_keys) {
|
||||
for (auto& k : key)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Atomic.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <Kernel/API/Syscall.h>
|
||||
#include <limits.h>
|
||||
|
@ -130,7 +131,7 @@ int pthread_create(pthread_t* thread, pthread_attr_t* attributes, void* (*start_
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef PTHREAD_DEBUG
|
||||
#if PTHREAD_DEBUG
|
||||
dbgprintf("pthread_create: Creating thread with attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
|
||||
used_attributes,
|
||||
(PTHREAD_CREATE_JOINABLE == used_attributes->m_detach_state) ? "joinable" : "detached",
|
||||
|
@ -254,7 +255,7 @@ int pthread_attr_init(pthread_attr_t* attributes)
|
|||
auto* impl = new PthreadAttrImpl {};
|
||||
*attributes = impl;
|
||||
|
||||
#ifdef PTHREAD_DEBUG
|
||||
#if PTHREAD_DEBUG
|
||||
dbgprintf("pthread_attr_init: New thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
|
||||
impl,
|
||||
(PTHREAD_CREATE_JOINABLE == impl->m_detach_state) ? "joinable" : "detached",
|
||||
|
@ -297,7 +298,7 @@ int pthread_attr_setdetachstate(pthread_attr_t* attributes, int detach_state)
|
|||
|
||||
attributes_impl->m_detach_state = detach_state;
|
||||
|
||||
#ifdef PTHREAD_DEBUG
|
||||
#if PTHREAD_DEBUG
|
||||
dbgprintf("pthread_attr_setdetachstate: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
|
||||
attributes_impl,
|
||||
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
|
||||
|
@ -341,7 +342,7 @@ int pthread_attr_setguardsize(pthread_attr_t* attributes, size_t guard_size)
|
|||
attributes_impl->m_guard_page_size = actual_guard_size;
|
||||
attributes_impl->m_reported_guard_page_size = guard_size; // POSIX, why?
|
||||
|
||||
#ifdef PTHREAD_DEBUG
|
||||
#if PTHREAD_DEBUG
|
||||
dbgprintf("pthread_attr_setguardsize: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
|
||||
attributes_impl,
|
||||
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
|
||||
|
@ -376,7 +377,7 @@ int pthread_attr_setschedparam(pthread_attr_t* attributes, const struct sched_pa
|
|||
|
||||
attributes_impl->m_schedule_priority = p_sched_param->sched_priority;
|
||||
|
||||
#ifdef PTHREAD_DEBUG
|
||||
#if PTHREAD_DEBUG
|
||||
dbgprintf("pthread_attr_setschedparam: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
|
||||
attributes_impl,
|
||||
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
|
||||
|
@ -421,7 +422,7 @@ int pthread_attr_setstack(pthread_attr_t* attributes, void* p_stack, size_t stac
|
|||
attributes_impl->m_stack_size = stack_size;
|
||||
attributes_impl->m_stack_location = p_stack;
|
||||
|
||||
#ifdef PTHREAD_DEBUG
|
||||
#if PTHREAD_DEBUG
|
||||
dbgprintf("pthread_attr_setstack: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
|
||||
attributes_impl,
|
||||
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
|
||||
|
@ -457,7 +458,7 @@ int pthread_attr_setstacksize(pthread_attr_t* attributes, size_t stack_size)
|
|||
|
||||
attributes_impl->m_stack_size = stack_size;
|
||||
|
||||
#ifdef PTHREAD_DEBUG
|
||||
#if PTHREAD_DEBUG
|
||||
dbgprintf("pthread_attr_setstacksize: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
|
||||
attributes_impl,
|
||||
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibVT/Terminal.h>
|
||||
|
@ -822,7 +823,7 @@ void Terminal::ICH(const ParamVector& params)
|
|||
|
||||
void Terminal::on_input(u8 ch)
|
||||
{
|
||||
#ifdef TERMINAL_DEBUG
|
||||
#if TERMINAL_DEBUG
|
||||
dbgln("Terminal::on_input: {:#02x} ({:c}), fg={}, bg={}\n", ch, ch, m_current_attribute.foreground_color, m_current_attribute.background_color);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/ScrollBar.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
@ -81,7 +82,7 @@ void FrameBox::paint(PaintContext& context, PaintPhase phase)
|
|||
context.set_viewport_rect(old_viewport_rect);
|
||||
context.painter().restore();
|
||||
|
||||
#ifdef DEBUG_HIGHLIGHT_FOCUSED_FRAME
|
||||
#if HIGHLIGHT_FOCUSED_FRAME_DEBUG
|
||||
if (dom_node().content_frame()->is_focused_frame()) {
|
||||
context.painter().draw_rect(absolute_rect().to<int>(), Color::Cyan);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ static bool build_gemini_document(DOM::Document& document, const ByteBuffer& dat
|
|||
auto gemini_document = Gemini::Document::parse(gemini_data, document.url());
|
||||
String html_data = gemini_document->render_to_html();
|
||||
|
||||
#ifdef GEMINI_DEBUG
|
||||
#if GEMINI_DEBUG
|
||||
dbgln("Gemini data:\n\"\"\"{}\"\"\"", gemini_data);
|
||||
dbgln("Converted to HTML:\n\"\"\"{}\"\"\"", html_data);
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "DNSResponse.h"
|
||||
#include "DNSPacket.h"
|
||||
#include "DNSRequest.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
||||
|
@ -61,7 +62,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
|
|||
}
|
||||
|
||||
auto& response_header = *(const DNSPacket*)(raw_data);
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Got response (ID: {})", response_header.id());
|
||||
dbgln(" Question count: {}", response_header.question_count());
|
||||
dbgln(" Answer count: {}", response_header.answer_count());
|
||||
|
@ -87,7 +88,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
|
|||
auto& record_and_class = *(const RawDNSAnswerQuestion*)&raw_data[offset];
|
||||
response.m_questions.empend(name, record_and_class.record_type, record_and_class.class_code);
|
||||
offset += 4;
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
auto& question = response.m_questions.last();
|
||||
dbgln("Question #{}: name=_{}_, type={}, class={}", i, question.name(), question.record_type(), question.class_code());
|
||||
#endif
|
||||
|
@ -111,7 +112,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
|
|||
// FIXME: Parse some other record types perhaps?
|
||||
dbgln("data=(unimplemented record type {})", record.type());
|
||||
}
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Answer #{}: name=_{}_, type={}, ttl={}, length={}, data=_{}_", i, name, record.type(), record.ttl(), record.data_length(), data);
|
||||
#endif
|
||||
response.m_answers.empend(name, record.type(), record.record_class(), record.ttl(), data);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "DNSRequest.h"
|
||||
#include "DNSResponse.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
@ -113,7 +114,7 @@ void LookupServer::service_client(RefPtr<Core::LocalSocket> socket)
|
|||
return;
|
||||
}
|
||||
auto hostname = String((const char*)client_buffer + 1, nrecv - 1, Chomp);
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Got request for '{}'", hostname);
|
||||
#endif
|
||||
|
||||
|
@ -123,7 +124,7 @@ void LookupServer::service_client(RefPtr<Core::LocalSocket> socket)
|
|||
responses.append(known_host.value());
|
||||
} else if (!hostname.is_empty()) {
|
||||
for (auto& nameserver : m_nameservers) {
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Doing lookup using nameserver '{}'", nameserver);
|
||||
#endif
|
||||
bool did_get_response = false;
|
||||
|
@ -174,7 +175,7 @@ Vector<String> LookupServer::lookup(const String& hostname, const String& namese
|
|||
if (cached_lookup.question.record_type() == record_type) {
|
||||
Vector<String> responses;
|
||||
for (auto& cached_answer : cached_lookup.answers) {
|
||||
#ifdef LOOKUPSERVER_DEBUG
|
||||
#if LOOKUPSERVER_DEBUG
|
||||
dbgln("Cache hit: {} -> {}, expired: {}", hostname, cached_answer.record_data(), cached_answer.has_expired());
|
||||
#endif
|
||||
if (!cached_answer.has_expired())
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "TaskbarWindow.h"
|
||||
#include "TaskbarButton.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibDesktop/AppFile.h>
|
||||
|
@ -228,7 +229,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
|
|||
WindowIdentifier identifier { event.client_id(), event.window_id() };
|
||||
switch (event.type()) {
|
||||
case GUI::Event::WM_WindowRemoved: {
|
||||
#ifdef EVENT_DEBUG
|
||||
#if EVENT_DEBUG
|
||||
auto& removed_event = static_cast<GUI::WMWindowRemovedEvent&>(event);
|
||||
dbgln("WM_WindowRemoved: client_id={}, window_id={}",
|
||||
removed_event.client_id(),
|
||||
|
@ -241,7 +242,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
|
|||
break;
|
||||
}
|
||||
case GUI::Event::WM_WindowRectChanged: {
|
||||
#ifdef EVENT_DEBUG
|
||||
#if EVENT_DEBUG
|
||||
auto& changed_event = static_cast<GUI::WMWindowRectChangedEvent&>(event);
|
||||
dbgln("WM_WindowRectChanged: client_id={}, window_id={}, rect={}",
|
||||
changed_event.client_id(),
|
||||
|
@ -262,7 +263,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
|
|||
|
||||
case GUI::Event::WM_WindowStateChanged: {
|
||||
auto& changed_event = static_cast<GUI::WMWindowStateChangedEvent&>(event);
|
||||
#ifdef EVENT_DEBUG
|
||||
#if EVENT_DEBUG
|
||||
dbgln("WM_WindowStateChanged: client_id={}, window_id={}, title={}, rect={}, is_active={}, is_minimized={}",
|
||||
changed_event.client_id(),
|
||||
changed_event.window_id(),
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/API/MousePacket.h>
|
||||
#include <LibCore/LocalSocket.h>
|
||||
#include <LibCore/Object.h>
|
||||
|
@ -101,7 +102,7 @@ void EventLoop::drain_mouse()
|
|||
return;
|
||||
for (size_t i = 0; i < npackets; ++i) {
|
||||
auto& packet = packets[i];
|
||||
#ifdef WSMESSAGELOOP_DEBUG
|
||||
#if WSMESSAGELOOP_DEBUG
|
||||
dbgln("EventLoop: Mouse X {}, Y {}, Z {}, relative={}", packet.x, packet.y, packet.z, packet.is_relative);
|
||||
#endif
|
||||
buttons = packet.buttons;
|
||||
|
@ -119,7 +120,7 @@ void EventLoop::drain_mouse()
|
|||
|
||||
if (buttons != state.buttons) {
|
||||
state.buttons = buttons;
|
||||
#ifdef WSMESSAGELOOP_DEBUG
|
||||
#if WSMESSAGELOOP_DEBUG
|
||||
dbgln("EventLoop: Mouse Button Event");
|
||||
#endif
|
||||
screen.on_receive_mouse_data(state);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "Shell.h"
|
||||
#include "Execution.h"
|
||||
#include "Formatter.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
|
@ -68,7 +69,7 @@ void Shell::setup_signals()
|
|||
{
|
||||
if (m_should_reinstall_signal_handlers) {
|
||||
Core::EventLoop::register_signal(SIGCHLD, [this](int) {
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("SIGCHLD!");
|
||||
#endif
|
||||
notify_child_event();
|
||||
|
@ -506,7 +507,7 @@ String Shell::format(const StringView& source, ssize_t& cursor) const
|
|||
Shell::Frame Shell::push_frame(String name)
|
||||
{
|
||||
m_local_frames.append(make<LocalFrame>(name, decltype(LocalFrame::local_variables) {}));
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("New frame '{}' at {:p}", name, &m_local_frames.last());
|
||||
#endif
|
||||
return { m_local_frames, m_local_frames.last() };
|
||||
|
@ -572,7 +573,7 @@ int Shell::run_command(const StringView& cmd, Optional<SourcePosition> source_po
|
|||
if (!command)
|
||||
return 0;
|
||||
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Command follows");
|
||||
command->dump(0);
|
||||
#endif
|
||||
|
@ -669,7 +670,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
|||
auto apply_rewirings = [&] {
|
||||
for (auto& rewiring : rewirings) {
|
||||
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("in {}<{}>, dup2({}, {})", command.argv.is_empty() ? "(<Empty>)" : command.argv[0].characters(), getpid(), rewiring.old_fd, rewiring.new_fd);
|
||||
#endif
|
||||
int rc = dup2(rewiring.old_fd, rewiring.new_fd);
|
||||
|
@ -784,7 +785,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Synced up with parent, we're good to exec()");
|
||||
#endif
|
||||
|
||||
|
@ -982,7 +983,7 @@ NonnullRefPtrVector<Job> Shell::run_commands(Vector<AST::Command>& commands)
|
|||
NonnullRefPtrVector<Job> spawned_jobs;
|
||||
|
||||
for (auto& command : commands) {
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Command");
|
||||
for (auto& arg : command.argv)
|
||||
dbgln("argv: {}", arg);
|
||||
|
@ -1626,11 +1627,11 @@ void Shell::notify_child_event()
|
|||
#endif
|
||||
|
||||
int wstatus = 0;
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("waitpid({}) = ...", job.pid());
|
||||
#endif
|
||||
auto child_pid = waitpid(job.pid(), &wstatus, WNOHANG | WUNTRACED);
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("... = {} - {}", child_pid, wstatus);
|
||||
#endif
|
||||
|
||||
|
@ -1786,7 +1787,7 @@ void Shell::stop_all_jobs()
|
|||
printf("Killing active jobs\n");
|
||||
for (auto& entry : jobs) {
|
||||
if (entry.value->is_suspended()) {
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Job {} is suspended", entry.value->pid());
|
||||
#endif
|
||||
kill_job(entry.value, SIGCONT);
|
||||
|
@ -1798,7 +1799,7 @@ void Shell::stop_all_jobs()
|
|||
usleep(10000); // Wait for a bit before killing the job
|
||||
|
||||
for (auto& entry : jobs) {
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Actively killing {} ({})", entry.value->pid(), entry.value->cmd());
|
||||
#endif
|
||||
kill_job(entry.value, SIGKILL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue