mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:27:45 +00:00
Kernel+LibC: Make page fault crashes a bit more readable.
We'll now try to detect crashes that were due to dereferencing nullptr, uninitialized malloc() memory, or recently free()'d memory. It's not perfect but I think it's pretty good. :^) Also added some color to the most important parts of the crash log, and added some more modes to /bin/crash for exercising this code. Fixes #243.
This commit is contained in:
parent
15bea7153a
commit
8c0ae711d8
5 changed files with 76 additions and 11 deletions
|
@ -2,6 +2,7 @@
|
|||
#include <AK/InlineLinkedList.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <assert.h>
|
||||
#include <mallocdefs.h>
|
||||
#include <serenity.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -12,8 +13,6 @@
|
|||
//#define MALLOC_DEBUG
|
||||
#define RECYCLE_BIG_ALLOCATIONS
|
||||
|
||||
#define MALLOC_SCRUB_BYTE 0x85
|
||||
#define FREE_SCRUB_BYTE 0x82
|
||||
#define MAGIC_PAGE_HEADER 0x42657274
|
||||
#define MAGIC_BIGALLOC_HEADER 0x42697267
|
||||
#define PAGE_ROUND_UP(x) ((((size_t)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
|
||||
|
|
5
LibC/mallocdefs.h
Normal file
5
LibC/mallocdefs.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#define MALLOC_SCRUB_BYTE 0xdc
|
||||
#define FREE_SCRUB_BYTE 0xed
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue