Disable a bunch of debug prints

This commit is contained in:
Jan Schär 2022-06-02 16:58:27 +02:00
parent 99a46acb05
commit f66ee58a5c
13 changed files with 100 additions and 101 deletions

View File

@ -96,7 +96,7 @@ static void handle_init_recv(void *arg)
assert(err_is_ok(err)); assert(err_is_ok(err));
if (msg.words[0] == SYS_ERR_OK) { if (msg.words[0] == SYS_ERR_OK) {
debug_printf("Received child init OK\n"); // debug_printf("Received child init OK\n");
init_chan_initialized = true; init_chan_initialized = true;
} else { } else {
USER_PANIC("Child LMP initialization failed."); USER_PANIC("Child LMP initialization failed.");

View File

@ -112,7 +112,7 @@ errval_t morecore_init(size_t alignment)
{ {
struct morecore_state *state = get_morecore_state(); struct morecore_state *state = get_morecore_state();
debug_printf("initializing dynamic heap\n"); DEBUG_PRINTF("initializing dynamic heap\n");
thread_mutex_init(&state->mutex); thread_mutex_init(&state->mutex);

View File

@ -561,7 +561,7 @@ errval_t paging_init_onthread(struct thread *t)
// - setup exception handler for thread `t'. // - setup exception handler for thread `t'.
errval_t err; errval_t err;
debug_printf("paging_init_onthread thread id: %lx\n", t->id); DEBUG_PRINTF("paging_init_onthread thread id: %lx\n", t->id);
size_t stack_size = PT_STATIC_EXCEPTION_STACK_SIZE; size_t stack_size = PT_STATIC_EXCEPTION_STACK_SIZE;
struct capref frame; struct capref frame;
@ -585,7 +585,7 @@ static errval_t paging_insert_vaddr_reg(
struct paging_state *st, struct pt_vaddr_reg_t *target_region, struct paging_state *st, struct pt_vaddr_reg_t *target_region,
size_t prefix_size, size_t alloc_size, bool heap, size_t guarded_region_size size_t prefix_size, size_t alloc_size, bool heap, size_t guarded_region_size
) { ) {
assert(target_region->free); assert(!!target_region->free);
assert(target_region->size >= prefix_size + alloc_size); assert(target_region->size >= prefix_size + alloc_size);
// calculate the number of bytes that are left over after the region // calculate the number of bytes that are left over after the region

View File

@ -325,7 +325,7 @@ errval_t ump_chan_init(
// get the size of the rings for each direction // get the size of the rings for each direction
size_t ring_size = shared_frame_id.bytes / 2; size_t ring_size = shared_frame_id.bytes / 2;
debug_printf("[ump_chan_init] Each channel is %lu bytes\n", ring_size); // debug_printf("[ump_chan_init] Each channel is %lu bytes\n", ring_size);
// allocate the channel structures // allocate the channel structures
struct ump_send_chan *send_chan = malloc(sizeof(struct ump_send_chan)); struct ump_send_chan *send_chan = malloc(sizeof(struct ump_send_chan));

View File

@ -1000,7 +1000,7 @@ static void fat32_print(struct bpb *bpb){
* The authors of the FAT32 specification are very strict that it MUST be done exactly this way so here we go. * The authors of the FAT32 specification are very strict that it MUST be done exactly this way so here we go.
*/ */
static bool is_fat32(struct bpb *bpb) { static bool is_fat32(struct bpb *bpb) {
debug_printf("[is_fat32] check fat type\n"); // debug_printf("[is_fat32] check fat type\n");
uint32_t root_dir_sectors = ((bpb->root_entry_count * 32) + (bpb->bytes_per_sector - 1)) / bpb->bytes_per_sector; uint32_t root_dir_sectors = ((bpb->root_entry_count * 32) + (bpb->bytes_per_sector - 1)) / bpb->bytes_per_sector;
uint32_t fat_size; uint32_t fat_size;
@ -1046,7 +1046,7 @@ errval_t fat32_init(
) { ) {
errval_t err; errval_t err;
debug_printf("[fat32_init]\n"); // debug_printf("[fat32_init]\n");
struct fat32 *fat32 = malloc(sizeof(struct fat32)); struct fat32 *fat32 = malloc(sizeof(struct fat32));
if (fat32 == NULL) return LIB_ERR_MALLOC_FAIL; if (fat32 == NULL) return LIB_ERR_MALLOC_FAIL;
@ -1070,7 +1070,7 @@ errval_t fat32_init(
} }
// initialize struct contents // initialize struct contents
debug_printf("[fat32_init] initialize state\n"); // debug_printf("[fat32_init] initialize state\n");
fat32->bytes_per_sector = bpb->bytes_per_sector; fat32->bytes_per_sector = bpb->bytes_per_sector;
fat32->sectors_per_cluster = bpb->sectors_per_cluster; fat32->sectors_per_cluster = bpb->sectors_per_cluster;
fat32->reserved_sector_count = bpb->reserved_sector_count; fat32->reserved_sector_count = bpb->reserved_sector_count;
@ -1088,7 +1088,7 @@ errval_t fat32_init(
// fat32_print(bpb); // fat32_print(bpb);
fat32_verify(bpb); fat32_verify(bpb);
debug_printf("[fat32_init] verified FAT32\n"); DEBUG_PRINTF("[fat32_init] verified FAT32\n");
*return_fat32 = fat32; *return_fat32 = fat32;

View File

@ -21,12 +21,12 @@ extern coreid_t my_core_id;
void void
grading_setup_bsp_init(int argc, char **argv) { grading_setup_bsp_init(int argc, char **argv) {
debug_printf("grading_setup_bsp_init(argc=%d)\n", argc); DEBUG_PRINTF("grading_setup_bsp_init(argc=%d)\n", argc);
} }
void void
grading_setup_app_init(struct bootinfo * bi) { grading_setup_app_init(struct bootinfo * bi) {
debug_printf("grading_setup_app_init(bi=%p)\n", bi); DEBUG_PRINTF("grading_setup_app_init(bi=%p)\n", bi);
} }
void void
@ -52,7 +52,7 @@ grading_test_early(void) {
void void
grading_test_late(void) { grading_test_late(void) {
if (my_core_id == 0) { if (my_core_id == 0) {
do_test_spawn(); // do_test_spawn();
do_test_fs(); // do_test_fs();
} }
} }

View File

@ -8,40 +8,40 @@
void grading_rpc_handle_number(uintptr_t val) void grading_rpc_handle_number(uintptr_t val)
{ {
debug_printf("grading_rpc_handle_number(%"PRIuPTR")\n", val); DEBUG_PRINTF("grading_rpc_handle_number(%"PRIuPTR")\n", val);
} }
void grading_rpc_handler_string(const char* string) void grading_rpc_handler_string(const char* string)
{ {
debug_printf("grading_rpc_handler_string(\"%s\")\n", string); DEBUG_PRINTF("grading_rpc_handler_string(\"%s\")\n", string);
} }
void grading_rpc_handler_serial_getchar(void) void grading_rpc_handler_serial_getchar(void)
{ {
debug_printf("grading_rpc_handler_serial_getchar()\n"); DEBUG_PRINTF("grading_rpc_handler_serial_getchar()\n");
} }
void grading_rpc_handler_serial_putchar(char c) void grading_rpc_handler_serial_putchar(char c)
{ {
debug_printf("grading_rpc_handler_serial_putchar(0x%"PRIx8")\n", c); DEBUG_PRINTF("grading_rpc_handler_serial_putchar(0x%"PRIx8")\n", c);
} }
void grading_rpc_handler_ram_cap(size_t bytes, size_t alignment) void grading_rpc_handler_ram_cap(size_t bytes, size_t alignment)
{ {
// debug_printf("grading_rpc_handler_ram_cap(0x%"PRIxPTR", 0x%"PRIxPTR")\n", bytes, alignment); // DEBUG_PRINTF("grading_rpc_handler_ram_cap(0x%"PRIxPTR", 0x%"PRIxPTR")\n", bytes, alignment);
} }
void grading_rpc_handler_process_spawn(char* cmdline, coreid_t core) void grading_rpc_handler_process_spawn(char* cmdline, coreid_t core)
{ {
debug_printf("grading_rpc_handler_process_spawn(\"%s\", %"PRIuCOREID")\n", cmdline, core); DEBUG_PRINTF("grading_rpc_handler_process_spawn(\"%s\", %"PRIuCOREID")\n", cmdline, core);
} }
void grading_rpc_handler_process_get_name(domainid_t pid) void grading_rpc_handler_process_get_name(domainid_t pid)
{ {
debug_printf("grading_rpc_handler_process_get_name(%"PRIuDOMAINID")\n", pid); DEBUG_PRINTF("grading_rpc_handler_process_get_name(%"PRIuDOMAINID")\n", pid);
} }
void grading_rpc_handler_process_get_all_pids(void) void grading_rpc_handler_process_get_all_pids(void)
{ {
debug_printf("grading_rpc_handler_process_get_all_pids()\n"); DEBUG_PRINTF("grading_rpc_handler_process_get_all_pids()\n");
} }

View File

@ -36,7 +36,7 @@ errval_t allocate_pid (const char *process_name, domainid_t *pid) {
if (name_copy == NULL) return LIB_ERR_MALLOC_FAIL; if (name_copy == NULL) return LIB_ERR_MALLOC_FAIL;
process_names[spawn_next_pid] = name_copy; process_names[spawn_next_pid] = name_copy;
debug_printf("Allocated pid %"PRIuDOMAINID" for process \"%s\".\n", spawn_next_pid, process_name); DEBUG_PRINTF("Allocated pid %"PRIuDOMAINID" for process \"%s\".\n", spawn_next_pid, process_name);
*pid = spawn_next_pid; *pid = spawn_next_pid;
spawn_next_pid++; spawn_next_pid++;
@ -98,7 +98,7 @@ static void handle_child_recv(void *arg) {
switch(msg.words[0]){ switch(msg.words[0]){
case RPC_MTYPE_CHILD_ENDPOINT: case RPC_MTYPE_CHILD_ENDPOINT:
debug_printf("SPAWN: Received child init_chan endpoint\n"); // debug_printf("SPAWN: Received child init_chan endpoint\n");
si->init_chan.remote_cap = cap; si->init_chan.remote_cap = cap;
err = lmp_chan_alloc_recv_slot(&si->init_chan); err = lmp_chan_alloc_recv_slot(&si->init_chan);
if (err_is_fail(err)) { if (err_is_fail(err)) {
@ -384,7 +384,7 @@ static errval_t spawn_load_elf_from_fs(char *path, char **elf_base, size_t *elf_
static errval_t spawn_load_elf_from_multiboot(char *name, char **elf_base, size_t *elf_bytes) { static errval_t spawn_load_elf_from_multiboot(char *name, char **elf_base, size_t *elf_bytes) {
errval_t err; errval_t err;
debug_printf("[spawn_load_elf_from_multiboot] %s\n", name); DEBUG_PRINTF("[spawn_load_elf_from_multiboot] %s\n", name);
struct mem_region *module = multiboot_find_module(bi, name); struct mem_region *module = multiboot_find_module(bi, name);
if (module == NULL) return SPAWN_ERR_FIND_MODULE; if (module == NULL) return SPAWN_ERR_FIND_MODULE;
@ -409,7 +409,7 @@ static errval_t spawn_load_elf_from_multiboot(char *name, char **elf_base, size_
); );
if (err_is_fail(err)) return err_push(err, SPAWN_ERR_MAP_MODULE); if (err_is_fail(err)) return err_push(err, SPAWN_ERR_MAP_MODULE);
debug_printf("SPAWN: multiboot mapped %s, size: %"PRIuPTR", magic: %"PRIx8" %c%c%c\n", DEBUG_PRINTF("SPAWN: multiboot mapped %s, size: %"PRIuPTR", magic: %"PRIx8" %c%c%c\n",
name, *elf_bytes, (*elf_base)[0], (*elf_base)[1], (*elf_base)[2], (*elf_base)[3]); name, *elf_bytes, (*elf_base)[0], (*elf_base)[1], (*elf_base)[2], (*elf_base)[3]);
return SYS_ERR_OK; return SYS_ERR_OK;

View File

@ -439,7 +439,7 @@ static void handle_payload(void *arg, size_t payload_size, void *payload) {
static errval_t connect_callback(void *arg, struct capref cap) { static errval_t connect_callback(void *arg, struct capref cap) {
errval_t err; errval_t err;
printf("[block_driver_server] incoming connection\n"); // printf("[block_driver_server] incoming connection\n");
struct ump_send_chan *send_chan; struct ump_send_chan *send_chan;
struct ump_recv_chan *recv_chan; struct ump_recv_chan *recv_chan;
@ -455,7 +455,7 @@ static errval_t connect_callback(void *arg, struct capref cap) {
state->send_chan = send_chan; state->send_chan = send_chan;
ump_recv_header(recv_chan, handle_request, state); ump_recv_header(recv_chan, handle_request, state);
printf("[block_driver_server] connection ready to receive requests\n"); // printf("[block_driver_server] connection ready to receive requests\n");
return SYS_ERR_OK; return SYS_ERR_OK;
} }
@ -481,7 +481,7 @@ int main(int argc, char *argv[]) {
if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to map device registers"); if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to map device registers");
// initialize the sdhc driver // initialize the sdhc driver
printf("[block_driver_server] initializing sdhc driver\n"); DEBUG_PRINTF("[block_driver_server] initializing sdhc driver\n");
err = sdhc_init(&sdhc, device_register_vaddr); err = sdhc_init(&sdhc, device_register_vaddr);
if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to initialize sdhc driver"); if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to initialize sdhc driver");
@ -501,13 +501,12 @@ int main(int argc, char *argv[]) {
err = paging_map_frame_attr(get_current_paging_state(), &dma_buffer, size, dma_buffer_frame, VREGION_FLAGS_READ_WRITE); err = paging_map_frame_attr(get_current_paging_state(), &dma_buffer, size, dma_buffer_frame, VREGION_FLAGS_READ_WRITE);
if (err_is_fail(err)) return err_push(err, LIB_ERR_PMAP_MAP); if (err_is_fail(err)) return err_push(err, LIB_ERR_PMAP_MAP);
printf("[block_driver_server] registering\n");
struct ump_binding_server server; struct ump_binding_server server;
err = ump_binding_register(&server, UMP_SERVER_BLOCK_DRIVER, connect_callback, NULL); err = ump_binding_register(&server, UMP_SERVER_BLOCK_DRIVER, connect_callback, NULL);
if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to register UMP server"); if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to register UMP server");
// wait for connections to the server // wait for connections to the server
printf("[block_driver_server] listening\n"); printf("[block_driver_server] ready\n");
struct waitset *default_ws = get_default_waitset(); struct waitset *default_ws = get_default_waitset();
while (true) { while (true) {
err = event_dispatch(default_ws); err = event_dispatch(default_ws);

View File

@ -576,7 +576,7 @@ struct enet_driver_state *st;
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
errval_t err; errval_t err;
debug_printf("Enet driver started \n"); DEBUG_PRINTF("Enet driver started \n");
st = (struct enet_driver_state*)calloc(1, sizeof(struct enet_driver_state)); st = (struct enet_driver_state*)calloc(1, sizeof(struct enet_driver_state));
assert(st != NULL); assert(st != NULL);
@ -615,9 +615,9 @@ int main(int argc, char *argv[]) {
return err; return err;
} }
debug_printf("Enet driver init done \n"); DEBUG_PRINTF("Enet driver init done \n");
debug_printf("Creating devqs \n"); DEBUG_PRINTF("Creating devqs \n");
err = enet_rx_queue_create(&st->rxq, st->d); err = enet_rx_queue_create(&st->rxq, st->d);
if (err_is_fail(err)) { if (err_is_fail(err)) {

View File

@ -74,7 +74,7 @@ static void udp_listen_callback (void *arg, errval_t err, uint16_t src_port) {
DEBUG_ERR(err, "failed to listen on UDP"); DEBUG_ERR(err, "failed to listen on UDP");
return; return;
} }
printf("Echo server: Listening on UDP port %d.\n", src_port); DEBUG_PRINTF("Listening on UDP port %d.\n", src_port);
} }
static void net_reply_callback (void *arg, errval_t err) { static void net_reply_callback (void *arg, errval_t err) {
@ -133,7 +133,7 @@ static void tcp_listen_callback (void *arg, errval_t err, uint16_t src_port) {
DEBUG_ERR(err, "failed to listen on TCP"); DEBUG_ERR(err, "failed to listen on TCP");
return; return;
} }
printf("Echo server: Listening on TCP port %d.\n", src_port); DEBUG_PRINTF("Listening on TCP port %d.\n", src_port);
} }
static void tcp_receive_available_handler (void *arg) { static void tcp_receive_available_handler (void *arg) {
@ -188,11 +188,11 @@ int main (int argc, char *argv[]) {
errval_t err; errval_t err;
struct waitset *default_ws = get_default_waitset(); struct waitset *default_ws = get_default_waitset();
printf("Echo server: registering\n"); // printf("Echo server: registering\n");
struct ump_binding_server server; struct ump_binding_server server;
err = ump_binding_register(&server, UMP_SERVER_ECHO, connect_server, NULL); err = ump_binding_register(&server, UMP_SERVER_ECHO, connect_server, NULL);
if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to register UMP server"); if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to register UMP server");
printf("Echo server: listening\n"); // printf("Echo server: listening\n");
simpleslab_init(&slabs, sizeof(struct echo_buf), slab_buf, sizeof(slab_buf)); simpleslab_init(&slabs, sizeof(struct echo_buf), slab_buf, sizeof(slab_buf));

View File

@ -296,7 +296,7 @@ bsp_main(int argc, char *argv[]) {
// Grading // Grading
grading_test_late(); grading_test_late();
debug_printf("Message handler loop\n"); DEBUG_PRINTF("Message handler loop\n");
// Hang around // Hang around
struct waitset *default_ws = get_default_waitset(); struct waitset *default_ws = get_default_waitset();
while (true) { while (true) {
@ -439,7 +439,7 @@ app_main(int argc, char *argv[]) {
} }
free(bi_ser); free(bi_ser);
debug_printf("[app_main]: received bootinfo with %d regions\n", bi->regions_length); DEBUG_PRINTF("[app_main]: received bootinfo with %d regions\n", bi->regions_length);
// Grading // Grading
grading_setup_app_init(bi); grading_setup_app_init(bi);
@ -469,7 +469,7 @@ app_main(int argc, char *argv[]) {
// Grading // Grading
grading_test_late(); grading_test_late();
debug_printf("Message handler loop\n"); DEBUG_PRINTF("Message handler loop\n");
// Hang around // Hang around
struct waitset *default_ws = get_default_waitset(); struct waitset *default_ws = get_default_waitset();
while (true) { while (true) {

View File

@ -10,7 +10,7 @@
#ifndef SHELLY_H_ #ifndef SHELLY_H_
#define SHELLY_H_ #define SHELLY_H_
#define SHELLY_DEBUG_ON 1 // #define SHELLY_DEBUG_ON 1
#if defined(SHELLY_DEBUG_ON) #if defined(SHELLY_DEBUG_ON)
#define SHELLY_DEBUG(x...) debug_printf("[SHELLY_DEBUG] " x); #define SHELLY_DEBUG(x...) debug_printf("[SHELLY_DEBUG] " x);