{"id":28531408,"url":"https://github.com/openwrt/udebug","last_synced_at":"2025-07-04T00:05:12.942Z","repository":{"id":208322241,"uuid":"721050291","full_name":"openwrt/udebug","owner":"openwrt","description":"[MIRROR] OpenWrt debugging helper library/service","archived":false,"fork":false,"pushed_at":"2025-01-14T13:40:45.000Z","size":54,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-06-09T15:12:11.048Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://git.openwrt.org/?p=project/udebug.git;","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openwrt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-20T09:00:13.000Z","updated_at":"2025-01-14T13:40:48.000Z","dependencies_parsed_at":"2025-01-14T14:36:45.400Z","dependency_job_id":"0c70c3e4-9ea7-46c6-a2e3-bb53de8a1189","html_url":"https://github.com/openwrt/udebug","commit_stats":null,"previous_names":["openwrt/udebug"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/openwrt/udebug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwrt%2Fudebug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwrt%2Fudebug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwrt%2Fudebug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwrt%2Fudebug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openwrt","download_url":"https://codeload.github.com/openwrt/udebug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openwrt%2Fudebug/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260224499,"owners_count":22977408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-09T15:10:29.191Z","updated_at":"2025-07-04T00:05:12.882Z","avatar_url":"https://github.com/openwrt.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# udebug - OpenWrt debugging infrastructure\n\nudebug assists whole-system debugging by making it easy to provide ring buffers\nwith debug data and make them accessible through a unified API.\nThrough the CLI, you can either create snapshots of data with a specific duration,\nor stream data in real time. The data itself is stored in .pcapng files, which can\ncontain a mix of packets and log messages.\n\n## Notes on using Wireshark\n\nIn order to parse log messages in .pcapng files, you need to change the Wireshark\nconfiguration.\nUnder `Preferences` -\u003e `Protocols` -\u003e `DLT_USER` -\u003e `Encapsulations Table`,\nadd an entry for `User 0 (DLT=147)` with Payload protocol `syslog`.\n\n## libudebug C API\n\n#### `void udebug_init(struct udebug *ctx)`\n\nInitializes the udebug context. Must be called before adding buffers.\n\n#### `int udebug_connect(struct udebug *ctx, const char *path)`\n\nConnect to udebugd and submit any buffers that were added using `udebug_buf_add`.\n\n#### `void udebug_auto_connect(struct udebug *ctx, const char *path)`\n\nConnects and automatically reconnects to udebugd. Uses uloop and calls `udebug_add_uloop`.\n\n#### `void udebug_free(struct udebug *ctx)`\n\nFrees the udebug context and all added created buffers.\n\n#### `int udebug_buf_init(struct udebug_buf *buf, size_t entries, size_t size)`\n\nAllocates a buffer with a given size. Entries and size are rounded up internally to the\nnearest power-of-2.\n\n#### `int udebug_buf_add(struct udebug *ctx, struct udebug_buf *buf, const struct udebug_buf_meta *meta);`\n\nSubmits the buffer to udebugd and makes it visible.\n\n#### `void udebug_buf_free(struct udebug_buf *buf)`\n\nRemoves the buffer from udebugd and frees it.\n\n#### `void udebug_entry_init(struct udebug_buf *buf)`\n\nInitializes a new entry on the ring buffer.\n\n#### `void *udebug_entry_append(struct udebug_buf *buf, const void *data, uint32_t len)`\n\nAppends data to the ring buffer. When called with data == NULL, space is only\nreserved, and the return value provides a pointer with len bytes that can be\nwritten to.\n\n#### `int udebug_entry_printf(struct udebug_buf *buf, const char *fmt, ...)`\n\nAppends a string to the buffer, based on format string + arguments (like printf)\n\n#### `int udebug_entry_vprintf(struct udebug_buf *buf, const char *fmt, va_list ap)`\n\nLike `udebug_entry_printf()`\n\n#### `void udebug_entry_add(struct udebug_buf *buf)`\n\nFinalizes and publishes the entry on the ring buffer.\n\n### Simple example\n\n```\nstatic struct udebug ud;\nstatic struct udebug_buf udb;\n\n/* ... */\n\nuloop_init();\nudebug_init(\u0026ud);\nudebug_auto_connect(\u0026ud, NULL);\n\nstatic const struct udebug_buf_meta buf_meta = {\n\t.name = \"counter\",\n\t.format = UDEBUG_FORMAT_STRING,\n};\n\nint entries = 128;\nint data_size = 1024;\n\nudebug_buf_init(\u0026udb, entries, data_size);\nudebug_buf_add(\u0026ud, \u0026udb, \u0026buf_meta);\n\n/* ... */\n\nudebug_entry_init(\u0026udb); // initialize entry\nudebug_entry_printf(\u0026udb, \"count=%d\", count++);\nudebug_entry_add(\u0026udb); // finalize the entry\n\n```\n\n## udebug CLI\n\n```\nUsage: udebug-cli [\u003coptions\u003e] \u003ccommand\u003e [\u003cargs\u003e]\n\n  Options:\n    -f                          Ignore errors on opening rings\n    -d \u003cduration\u003e:              Only fetch data up to \u003cduration\u003e seconds old\n    -o \u003cfile\u003e|-                 Set output file for snapshot/stream (or '-' for stdout)\n    -i \u003cprocess\u003e[:\u003cname\u003e]       Select debug buffer for snapshot/stream\n    -s \u003cpath\u003e                   Use udebug socket \u003cpath\u003e\n    -q                          Suppress warnings/error messages\n\n  Commands:\n    list:                       List available debug buffers\n    snapshot:                   Create a pcapng snapshot of debug buffers\n    set_flag [\u003cname\u003e=0|1 ...]   Set ring buffer flags\n    get_flags                   Get ring buffer flags\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenwrt%2Fudebug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenwrt%2Fudebug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenwrt%2Fudebug/lists"}