Arduino-Debug
On-target sketch debugger for Arduino
|
#include <Debug.h>
Classes | |
class | Variable |
Public Member Functions | |
Debug () | |
bool | begin (Stream *dev, const char *file, int line, const char *func) |
void | assert (const char *file, int line, const char *func, str_P cond) |
void | break_at (const char *file, int line, const char *func, str_P cond) |
bool | check_stack (int room=128) |
void | observe_at (const char *file, int line, const char *func, str_P expr) |
bool | end () |
Protected Member Functions | |
virtual size_t | write (uint8_t c) |
virtual int | available (void) |
virtual int | peek (void) |
virtual int | read (void) |
virtual void | flush (void) |
void | dump (uint16_t src, const void *ptr, size_t size) |
void | run (const char *file=NULL, int line=0, const char *func=NULL, str_P expr=NULL) |
void | do_backtrace (const char *func) |
bool | do_lookup_variables (const char *name, bool is_pointer=false) |
void | do_memory_usage (int marker) |
void | do_print_commands () |
void | do_print_data () |
void | do_print_heap () |
void | do_print_stack (int marker) |
void | do_print_variables () |
void | do_quit () |
Protected Attributes | |
Stream * | m_dev |
Debug stream. More... | |
Variable * | m_var |
Last registered variable. More... | |
int | DATAEND |
End of data segment. More... | |
int | DATASIZE |
Size of data segment. More... | |
Friends | |
class | Variable |
Arduino Debug class with basic breakpoint, data observation and display, and memory usage.
Define to remove corresponding command: DEBUG_NO_BACKTRACE DEBUG_NO_LOOKUP_VARIABLES DEBUG_NO_MEMORY_USAGE DEBUG_NO_PRINT_COMMANDS DEBUG_NO_PRINT_DATA DEBUG_NO_PRINT_HEAP DEBUG_NO_PRINT_STACK DEBUG_NO_PRINT_VARIABLES DEBUG_NO_QUIT DEBUG_NO_WHERE May be used to reduce memory footprint and allow debugging with limited resources.
|
inline |
void Debug::assert | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
str_P | cond | ||
) |
Assertion failure of given condition in source code (file, line and function). The debug command handler is called. The macro ASSERT(cond) should be used instead.
[in] | file | name. |
[in] | line | number. |
[in] | func | function name. |
[in] | cond | condition string. |
|
inlineprotectedvirtual |
bool Debug::begin | ( | Stream * | dev, |
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Start debug handler with given stream, file name, line number and function name. The macro DEBUG_STREAM(dev) should be used instead. Returns true(1) if successful otherwise false(0).
[in] | dev | stream for debug handler. |
[in] | file | name. |
[in] | line | number. |
[in] | func | function name. |
void Debug::break_at | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
str_P | cond | ||
) |
Break point in given file, on line, and in function. The debug command handler is run. The macro BREAKPOINT() or BREAK_IF(cond) should be used instead.
[in] | file | name. |
[in] | line | number. |
[in] | func | function name. |
[in] | cond | condition string. |
bool Debug::check_stack | ( | int | room = 128 | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Print registered variables in format:
where REG is the stack address of register item for the variable VAR. FUNC is the name of the function where registered. REF is the address of the variables value and VAL is the value. If the value is larger than int the value is printed in HEX format.
|
protected |
Stop the sketch.
|
protected |
bool Debug::end | ( | ) |
void Debug::observe_at | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
str_P | expr | ||
) |
Print variable obervation prefix with given file name, line number and function name to debug stream. The macro OBSERVE(expr) or OBSERVE_IF(cond,expr) should be used instead.
[in] | file | name. |
[in] | line | number. |
[in] | func | function name. |
[in] | expr | expression string. |
|
protected |
|
inlineprotectedvirtual |