debug messages: implement dynamic debug

Heavily inspired off linux kernel's dynamic debug:
 * add a /sys/kernel/debug/dynamic_debug/control file
 (accessible from linux side in /sys/class/mcos/mcos0/sys/kernel/debug/dynamic_debug/control)
 * read from file to list debug statements (currently limited to 4k in size)
 * write to file with '[file foo ][func bar ][line [x][-[y]]] [+-]p' to change values

Side effects:
 * reindented all linker scripts, there is a new __verbose section
 * added string function strpbrk

Change-Id: I36d7707274dcc3ecaf200075a31a2f0f76021059
This commit is contained in:
Dominique Martinet
2018-05-24 18:17:45 +09:00
parent bc887aab44
commit 3185334c1c
48 changed files with 407 additions and 232 deletions

View File

@@ -23,10 +23,8 @@
#include <shm.h>
#include <string.h>
#include <rusage_private.h>
#include <debug.h>
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
#define ekprintf(...) kprintf(__VA_ARGS__)
#define fkprintf(...) kprintf(__VA_ARGS__)
static LIST_HEAD(shmobj_list_head);
static ihk_spinlock_t shmobj_list_lock_body = SPIN_LOCK_UNLOCKED;
@@ -273,7 +271,7 @@ void shmobj_destroy(struct shmobj *obj)
page->mode, page->count);
count = ihk_atomic_sub_return(1, &page->count);
if (!((page->mode == PM_MAPPED) && (count == 0))) {
fkprintf("shmobj_destroy(%p): "
ekprintf("shmobj_destroy(%p): "
"page %p phys %#lx mode %#x"
" count %d off %#lx\n",
obj, page,
@@ -335,7 +333,7 @@ static void shmobj_release(struct memobj *memobj)
newref = --obj->ds.shm_nattch;
if (newref <= 0) {
if (newref < 0) {
fkprintf("shmobj_release(%p):ref %ld\n",
ekprintf("shmobj_release(%p):ref %ld\n",
memobj, newref);
panic("shmobj_release:freeing free shmobj");
}
@@ -430,7 +428,7 @@ static int shmobj_get_page(struct memobj *memobj, off_t off, int p2align,
Add when setting the PTE for a page with count of one in ihk_mc_pt_set_range(). */
if (page->mode != PM_NONE) {
fkprintf("shmobj_get_page(%p,%#lx,%d,%p):"
ekprintf("shmobj_get_page(%p,%#lx,%d,%p):"
"page %p %#lx %d %d %#lx\n",
memobj, off, p2align, physp,
page, page_to_phys(page), page->mode,