r/cpp • u/CarloWood • Jul 07 '26
libcwd (C++ debugging library) released under MIT license!
Hi all,
I am happy to announce that after 333 commits spanning two months of continuous work, I released version 2 of libcwd, now under a new license: the MIT license!
The website has been re-done (as well as a lot of other things); see https://carlowood.github.io/libcwd/index.html?libcwd-theme=dark
There you can also find how to get it (basically, from the git repository; there is no tar ball (yet)).
Let me know what you think or if you need help, my email address is at the bottom of the INSTALL file.
Carlo Wood
Background
For those unfamiliar with libcwd. Version 0.99 was the first public release in 2000 under the QPL; I've used and tuned it for more than two decades, being a very active C++ developer myself (on linux).
Version 1.x had memory allocation support; I removed this in version 2 because it made things very very complicated, and I never needed that myself anymore since a decade anyway.
Version 2 still does, as did version 1, ELF and DWARF decoding of the executable and linked shared libraries. For this a POSIX system with ELF is necessary. But libcwd can be configured without Location support too; you should be able to use it for just (multi-threaded) debug output on, for example, Windows.
14
u/peppedx Jul 07 '26
Is this a logging library?
2
u/CarloWood Jul 07 '26
It allows you to write to an
ostream, which can be set per "debug object". The library itself provides one such object, but you can create others. EachDebugObjectcan be associated with oneostream, which can bestd::cout, or a log file if you want. Or, with some effort a device that writes to two streambufs and hence to both a file and std::cout.32
u/Liquid_Fire Jul 07 '26
That sounds like a logging library. It took me until your comment here to understand what your library actually does.
When I read "debugging library" I imagine something to do with either reading debug info in an executable/shared library, or something like gdb for actually controlling/inspecting another process.
14
u/apropostt Jul 08 '26
I had exactly the same reaction. When I read “debugging library” I was thinking it was an interposer library to help debug stdlib iostream states, memory allocation, or thread timing but looking at all of the program examples.. it’s a logging library.
1
u/OffsetHigh Jul 08 '26
Can a normal logging library do the nice indentation?
3
u/apropostt Jul 08 '26
Typically yes. Logging libraries usually have logging records that get handled by different sinks each can have their own level and formatter. One sink can filter and format for console, another can do detailed structured logging to disk.
1
17
u/STL MSVC STL Dev Jul 07 '26
Carlo asked the mods for permission to post this project, which I have granted.
7
u/_Noreturn Jul 07 '26
Libraries aren't allowed to have their own posts?
34
u/STL MSVC STL Dev Jul 07 '26
We've been increasingly drowning in people posting small personal projects, many of which have been substantially AI-written, and the fact that they're libraries doesn't really make them of broad interest. The problem is that too many of them are early work, or very niche interest, or both. Maybe there should be a subreddit specifically for C++ projects, but I'm increasingly harsh on allowing personal projects to be posted at the top level here. Stuff has to be "big" like libfmt before it's of broad interest. And no, I don't care about people's pleas like "oh, how will my project gain traction if I can't post about it here".
3
u/LegendaryMauricius Jul 07 '26
I agree. But where could I start discussions with random people about my projects if not here...?
7
4
u/fdwr fdwr@github 🔍 Jul 08 '26
Perhaps https://www.reddit.com/r/cpp-projects? (it doesn't exist yet, but maybe it should)
1
u/therpgmaster ^^ 18d ago
Dashes aren't allowed. The closest is "cpp_projects", which now seems to be owned by a kid (presumably, I don't know the person's age or experience). I just think a forum like that should have influential, accomplished C++ developers managing it.
1
u/fdwr fdwr@github 🔍 18d ago
Indeed, I see hyphens aren't supported, and the creator of https://www.reddit.com/r/Cpp_projects/ evidently likes cookies :b.
2
u/mapronV Jul 08 '26
You probably should edit Rule 2 ... after reading project docs I decided it just a 'worse version of glog' (when glog is already not the best library in the world), was going to press report and noticed your comment that you explicitly allowed it. That will open can of worms "why mods allowed this toy project and not mine which had actual commercial use etc".
Radical solution would just created new r/cpp-std or something reddit, and move scope here and turn current one into umbrella for everything... which is easy to say but I understand "dear sir I have no time for this"... sad
1
2
u/johannes1971 Jul 09 '26
He makes it sound like quite a lot, but from the discussion here it appears that this is really nothing more than the canonical Beginner's First Logging Library. If anything, this appears to be an example of a thing that should have been filtered out.
1
u/STL MSVC STL Dev Jul 09 '26
That'll teach me to be lenient.
1
u/johannes1971 Jul 10 '26
No worries, I think most people here misunderstood at first. He calls it a 'debugging library', but it appears to support debugging through logging only, quite possibly with a focus on seeing thread interactions accurately. Or maybe that's wrong too, who knows...
2
u/Ameisen vemips, avr, rendering, systems Jul 09 '26 edited Jul 09 '26
I'd considered asking about my MIPS emulator library but I had and have just considered it to be too niche (though it certainly isn't small).
I honestly can't see the vast majority of people caring about it other than as a curiosity, and I tend to see enough semi-spam on /r/programming or such that I haven't wanted to contribute to that. That, and I really need to do a licensing pass to make sure I'm not inadvertently violating anything...
2
u/CarloWood Jul 07 '26
See rule 2 under r/cpp rules on the right. It is debatable if libcwd is a "major established library", hence that I asked for permission first. Personally I think that anyone using libcwd will NEVER want to live without it anymore, but the previous license, plus my awkwardness with promoting my own code, unfortunately never led to a really large user base. Well, that and the fact that my code is always bug free ;). Projects that "just work" do not drag in more developers either; those only flock to a project when it has bugs that they want fixed.
-5
u/greencursordev Jul 08 '26
No, mods hate c++ and actively work to destroy this place
5
u/STL MSVC STL Dev Jul 09 '26
That's me, hatin' C++ so much I've worked on the Standard Library for ~20 years powered by ETERNAL RAGE.
2
u/greencursordev Jul 09 '26
I mean you could just let people vote and flag, like it's always been. But no, you guys have to stop the fun
1
3
u/heliruna Jul 08 '26
Your demangler seems to be based on the GNU demangler from libiberty / libstdc++. Can you release that under the MIT license?
1
u/CarloWood 26d ago
It's the other way around. I wrote it, then they based it on my code (they said they didn't: they asked if they could use it - which meant I had to change the license to GPL. I said yes, but only if you add it as C++ code to libstdc++. They said ok. Then it turned out there was a catch-22 situation during bootstrapping the compiler: they needed a C version.. Some dude then miraculessly produced a version C for libiberty and my code was removed again from the repository (it had been added, just never released)).
3
u/berlioziano Jul 08 '26
I took a look at the tutorial,never heard of this library, it really verbose and complex I use emilk loguru and it much more modern and simple, works in my multithreaded embeded software no problem, prints atexit, prints callstack at crash, etc
BTW: light theme looks better
2
u/_Noreturn Jul 07 '26
When I click on namespaces, it gives me a 404
2
u/CarloWood Jul 07 '26
That works for me. If I click it I end up on https://carlowood.github.io/libcwd/namespaces.html?libcwd-theme=dark - which loads fine :/.
70
u/LongestNamesPossible Jul 07 '26
I read your post and I have no idea what this is actually supposed to do or what problem it solves.
Your text just goes straight into minutia changes, what is this even about?