This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I needed some quick and dirty println
and dbg
debugging in a program where I didn't have access to stdout/stderr, so I wrote these crates that allow you to do the equivalent over a TCP socket to a remote viewer. The remote viewer is a simple CLI program but it is based on a simple to use iterator crate making the creation of alternate versions pretty simple.
The main crate has no dependencies and uses a short crate name making it very quick and easy to add/remove on the fly. If you do wish to keep it in your source after debugging just turn off default options and it will compile into a no-op. By default, it works on localhost but you can add remote debugging via a remote-insecure
feature (there is no auth).
There are three crates currently: * rdbg - Used by the debugged program * rdbg-view - A very basic command line viewer * rdbg-client - A crate that makes it very easy to write your own viewer
Example
let world = "world!";
// More or less equivalent to `println`
rdbg::msg!("Hello {}", world);
// More or less equivalent to `dbg`
rdbg::vals!(world, 1 5);
Example output (from rdbg-view)
*** Trying to connect to 127.0.0.1:13579... ***
*** Connected to 127.0.0.1:13579 ***
T:1670688040648 THR:1 rdbg/examples/hello_world.rs:4 hello world
T:1670688040648 THR:1 rdbg/examples/hello_world.rs:5 |world->"world"| |1 5->6|
*** Disconnected from 127.0.0.1:13579 ***
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/rust/commen...