1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:37:44 +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 <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);