1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:47:45 +00:00

Everywhere: Hook up remaining debug macros to Debug.h.

This commit is contained in:
asynts 2021-01-24 15:28:26 +01:00 committed by Andreas Kling
parent da69de1f1b
commit eea72b9b5c
63 changed files with 458 additions and 287 deletions

View file

@ -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));

View file

@ -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);

View file

@ -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++;

View file

@ -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);

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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();

View file

@ -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();

View file

@ -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;

View file

@ -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());

View file

@ -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;

View file

@ -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)

View file

@ -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",

View file

@ -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

View file

@ -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);
}

View file

@ -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