All Projects → eerimoq → dbg-macro

eerimoq / dbg-macro

Licence: MIT license
A set of dbg(…) macros for C

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to dbg-macro

pydbg
Python implementation of the Rust `dbg` macro
Stars: ✭ 85 (+60.38%)
Mutual labels:  debug, dbg
sdebug
Xdebug — Step Debugger and Debugging Aid for PHP
Stars: ✭ 263 (+396.23%)
Mutual labels:  debug
android-sdk
AppSpector is a debugging service for mobile apps
Stars: ✭ 39 (-26.42%)
Mutual labels:  debug
sendmessage
SendMessage is a little tool to send Windows messages to any window.
Stars: ✭ 93 (+75.47%)
Mutual labels:  debug
dd
This package will add the dd and dump helpers to your Phalcon application.
Stars: ✭ 17 (-67.92%)
Mutual labels:  debug
flutter debug drawer
Adds a side menu in all screens with debug information. You can decide which information to show and create new modules to include more information.
Stars: ✭ 26 (-50.94%)
Mutual labels:  debug
debug
A small debugging library for C++
Stars: ✭ 30 (-43.4%)
Mutual labels:  debug
SmartDump
SmartDump - an exception and memory dump capture utility
Stars: ✭ 17 (-67.92%)
Mutual labels:  debug
pufferfish
An efficient index for the colored, compacted, de Bruijn graph
Stars: ✭ 94 (+77.36%)
Mutual labels:  dbg
react-native-debug-server-host
React Native Debug server host for iOS
Stars: ✭ 45 (-15.09%)
Mutual labels:  debug
ts-transform-react-jsx-source
TypeScript AST Transformer that adds source file and line number to JSX elements
Stars: ✭ 12 (-77.36%)
Mutual labels:  debug
CodeBaseManager
Multi-langage CLI tool to manage your code base
Stars: ✭ 11 (-79.25%)
Mutual labels:  debug
object-gui
Object GUI - Javascript Object GUI Editor
Stars: ✭ 51 (-3.77%)
Mutual labels:  debug
laravel-ray
Debug with Ray to fix problems faster in Laravel apps
Stars: ✭ 225 (+324.53%)
Mutual labels:  debug
jsdom-devtools-formatter
Make jsdom elements look like real DOM elements in Chrome Devtools console
Stars: ✭ 40 (-24.53%)
Mutual labels:  debug
robotframework-debuglibrary
A debug library for RobotFramework, which can be used as an interactive shell(REPL) also.
Stars: ✭ 96 (+81.13%)
Mutual labels:  debug
dora
🌟Dora is an open-source framework focused on usability and flexibility.It is widely used to collect crash information and print variable values.It is very powerful and useful to debug android program. It is customizable and extensible in the simpleton-like ways. Dora是一个专注于易用性和灵活性的开源框架,它被广泛用于收集崩溃信息和打印变量值,对调试Android程序非常强大和有用,傻瓜式的自定义和扩展。
Stars: ✭ 15 (-71.7%)
Mutual labels:  debug
consono
The most correct, informative, appealing and configurable variable inspector for JavaScript
Stars: ✭ 17 (-67.92%)
Mutual labels:  debug
knex-tiny-logger
Zero config queries logger for knex
Stars: ✭ 24 (-54.72%)
Mutual labels:  debug
PBD
🖨️🐞 Printf Based Debugger, a user-friendly C debugger
Stars: ✭ 52 (-1.89%)
Mutual labels:  debug

buildstatus codecov nala

About

A few macros that prints and returns the value of a given expression for quick and dirty debugging, inspired by Rusts dbg!(…) macro and its C++ variant.

dbg(expr) for primitive data types (int, float, etc.), strings and pointers.

dbgb(expr) to force boolean true/false output.

dbga(expr, length) for array of primitive data types.

dbgh(expr, size) for hexdump output.

dbge(expr) for negative error codes.

dbgbt() for a backtrace.

Just include dbg.h in your project to use it.

Example

tryit

See examples for the files used in this example.

#include "dbg.h"

static int factorial(int n)
{
    if (dbgb(n <= 1)) {
        return dbg(1);
    } else {
        return dbg(n * factorial(n - 1));
    }
}

int main()
{
    char message[] = "hello";
    dbg(message);  // main.c:15: message = "hello"
    dbgh(message, sizeof(message));

    const int a = 2;
    const int b = dbg(3 * a) + 1;  // main.c:19: 3 * a = 6 (0x6)

    int numbers[2] = { b, 13 };
    dbga(numbers, 2);  // main.c:22: numbers = [7, 13] (length: 2)

    dbg(factorial(4));
    dbge(-EINVAL);
    dbgbt();

    return (0);
}

Build and run:

https://github.com/eerimoq/dbg-macro/raw/master/docs/example-build-and-run.png

Compile time configuration

Define NDBG to make the macros a no-op.

Define DBG_NCOLOR for colorless output.

Define DBG_OSTREAM=<my-ostream> for custom output stream (stderr by default).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].