https://github.com/kyrylo-sovailo/dumb-way-to-debug
When there is no debugger and printf's ain't cutting it
https://github.com/kyrylo-sovailo/dumb-way-to-debug
cpp debugging macros
Last synced: 11 months ago
JSON representation
When there is no debugger and printf's ain't cutting it
- Host: GitHub
- URL: https://github.com/kyrylo-sovailo/dumb-way-to-debug
- Owner: kyrylo-sovailo
- License: mit
- Created: 2024-06-10T08:19:40.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-03T19:27:27.000Z (over 1 year ago)
- Last Synced: 2025-02-14T18:01:45.979Z (over 1 year ago)
- Topics: cpp, debugging, macros
- Language: C++
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Welcome to Dumb-Ways-to-Debug!
You already tried all smart ways to debug? Your platform has no debugger? Or is a serial port the only way to communicate with the software? Anyway, you found the right repo.
# Usage
```
//Non-debugged version
int add(int a, int b) { return a + b; }
//Debugged version
DWD_PRINT_TRACE(int, add, int, a, int, b) { return a + b; }
```
The functions need to be declared with `DWD_PRINT_*` or `DWD_CATCH_*` macros. Both will print the function call log (name and arguments) when your program calls `DWD::EXIT()`. The difference is that `DWD_CATCH_*` prints only when the function fails, `DWD_PRINT_*` will print in any case, including normal return command. Also the program will print only if the function's log level is higher or equal to `DWD::LOGLEVEL`.
# Compilation
Paste `.cpp` files into your project. Implement `dwd_desktop.h` for your platform (for example, serial port of your favorite microcontroller). You are on your own here.