Post Scarcity 0.0.6
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
debug.c File Reference
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <wctype.h>
#include "memory/consspaceobject.h"
#include "debug.h"
#include "memory/dump.h"
#include "io/io.h"
#include "io/print.h"
Include dependency graph for debug.c:

Go to the source code of this file.

Functions

void debug_dump_object (struct cons_pointer pointer, int level)
 Like dump_object, q.v., but protected by the verbosity mechanism.
 
void debug_print (wchar_t *message, int level)
 print this debug message to stderr, if verbosity matches level.
 
void debug_print_128bit (__int128_t n, int level)
 print a 128 bit integer value to stderr, if verbosity matches level.
 
void debug_print_binding (struct cons_pointer key, struct cons_pointer val, bool deep, int level)
 Standardise printing of binding trace messages.
 
void debug_print_exception (struct cons_pointer ex_ptr)
 When debugging, we want to see exceptions as they happen, because they may not make their way back down the stack to whatever is expected to handle them.
 
void debug_print_object (struct cons_pointer pointer, int level)
 print the object indicated by this pointer to stderr, if verbosity matches level.
 
void debug_printf (int level, wchar_t *format,...)
 wprintf adapted for the debug logging system.
 
void debug_println (int level)
 print a line feed to stderr, if verbosity matches level.
 

Variables

int verbosity = 0
 the controlling flags for debug_print; set in init.c, q.v.
 

Function Documentation

◆ debug_dump_object()

void debug_dump_object ( struct cons_pointer  pointer,
int  level 
)

Like dump_object, q.v., but protected by the verbosity mechanism.

verbosity is a set of flags, see debug_print.h; so you can turn debugging on for only one part of the system.

Definition at line 155 of file debug.c.

References dump_object(), file_to_url_file(), and verbosity.

Referenced by add_2(), compose_body(), free_cell(), hashmap_put(), in_make_empty_frame(), lisp_apply(), lisp_eval(), lisp_inspect(), lisp_mapcar(), lisp_metadata(), lisp_print(), lisp_read(), lisp_slurp(), main(), make_integer(), make_real(), make_special_frame(), make_stack_frame(), make_string_like_thing(), make_vec_pointer(), make_vso(), read_continuation(), read_number(), read_symbol_or_key(), and zerop().

◆ debug_print()

◆ debug_print_128bit()

void debug_print_128bit ( __int128_t  n,
int  level 
)

print a 128 bit integer value to stderr, if verbosity matches level.

verbosity is a set of flags, see debug_print.h; so you can turn debugging on for only one part of the system.

stolen from https://stackoverflow.com/questions/11656241/how-to-print-uint128-t-number-using-gcc

Definition at line 77 of file debug.c.

References verbosity.

Referenced by add_integers(), cell_value(), and integer_to_string().

◆ debug_print_binding()

void debug_print_binding ( struct cons_pointer  key,
struct cons_pointer  val,
bool  deep,
int  level 
)

Standardise printing of binding trace messages.

Definition at line 169 of file debug.c.

References debug_print(), and debug_print_object().

Referenced by eval_lambda(), lisp_let(), and set().

◆ debug_print_exception()

void debug_print_exception ( struct cons_pointer  ex_ptr)

When debugging, we want to see exceptions as they happen, because they may not make their way back down the stack to whatever is expected to handle them.

Definition at line 40 of file debug.c.

References exceptionp, file_to_url_file(), print(), and verbosity.

◆ debug_print_object()

◆ debug_printf()

◆ debug_println()

void debug_println ( int  level)

print a line feed to stderr, if verbosity matches level.

verbosity is a set of flags, see debug_print.h; so you can turn debugging on for only one part of the system.

Definition at line 104 of file debug.c.

References verbosity.

Referenced by add_integers(), c_apply(), cell_value(), dec_ref(), deep_bind(), eval_cond_clause(), eval_form(), eval_lambda(), inc_ref(), integer_to_string(), integer_to_string_add_digit(), lisp_cond(), lisp_mapcar(), lisp_multiply(), lisp_repl(), lisp_slurp(), make_ratio(), make_string_like_thing(), multiply_integers(), and set_reg().

Variable Documentation

◆ verbosity

int verbosity = 0

the controlling flags for debug_print; set in init.c, q.v.

Interpreted as a set o binary flags. The values are controlled by macros with names 'DEBUG_[A_Z]*' in debug.h, q.v.

Definition at line 33 of file debug.c.

Referenced by debug_dump_object(), debug_print(), debug_print_128bit(), debug_print_exception(), debug_print_object(), debug_printf(), debug_println(), and main().