mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:17:34 +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
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue