5 ms·
> The available Linux debuggers are gdb and lldb. They both suck. They crash all the time, don't understand the data types I care about, and they don't make the
by feelamee 2y ago
> The available Linux debuggers are gdb and lldb. They both suck. They crash all the time, don't understand the data types I care about, and they don't make the data I need available at my fingertips as quickly as possible.
quote from https://calabro.io/uscope https://calabro.io/uscope
Of course gdb, lldb have their problems (e.g. smashing tui with app output, what can be easily fixed, or very very very very long tab-tab completion, and crashing of course), but I dont know anything better. I am forced to use visual studio at work and its debugger really sucks - it can't even compare strings in conditional breakpoint, it cant even skip all std::function / std::bind garbage to let me step in callback, it can't watch evaluated expressions.
Probably it can evaluate exprs (immediate window?), but there are very little guides about this.
So, gdb is winner for me now.
rr (record-repeat)[0] also looks very nice, but it require hardware support(((
[0] https://rr-project.org/ https://rr-project.org/
- AlotOfReading 2y agoIf you're willing to deal with enterprise pricing, Undo [0] implements something reasonably comparable to rr without the hardware timer requirements. [0] https://undo.io/ https://undo.io/
- feelamee 2y agoeh, thanks > How can I persuade my boss to pay for Undo? fun quote.. but my boss will never pay for it because I am the only one who use gdb in our company, unfortunately)
- mark_undoio 2y agoFor what it's worth we do offer a more printf-y interface for people who don't like a debugger - https://docs.undo.io/PostFailureLogging.html https://docs.undo.io/PostFailureLogging.html And CLion / VS Code for people who prefer an IDE interface. But a lot of people do really want to stick with their printf debugging. If your boss won't buy you an Undo you can still use https://rr-project.org/ https://rr-project.org/ - or on Windows the built in time travel debug of WinDbg.
- matu3ba 2y agoAre you aware of solutions for multi-threaded and relative time-accurate recordings, for example by using user-selected synchronization points? Afaiu, rr and undo do simulation of threads on one CPU core, which rules out detecting timing issues.
- dzaima 2y agoWhile the single-threaded execution means that issues from thread interleaving on the scale of nanoseconds will effectively not happen, multiple threads are still allowed and will be context-switched between. rr also has a chaos mode to intentionally make the context switching unfair.
- gregthelaw 2y agoExactly right. Undo has "thread fuzzing" which is similar concept to chaos mode, but more targeted.
- matu3ba 2y agoWhat kind/class of issues are caused by "thread interleaving on the scale of nanoseconds"? Faulty CPU bit flips due to radiation/quantum effects or what are you referring to? Just curious.
- dzaima 2y agoNot doing things atomically when they should be (incl. missing locks around tiny ops) would be a pretty large class. With native multithreading data can pass from thread to thread millions of times per second, and you're much less likely to hit obscure interactions when limited instead to maybe a couple hundred context switches per second.
- AlotOfReading 2y agoAntithesis is the only general purpose system I've seen for that. It takes the same single threaded approach, but can scale to N separate systems and fault injecting possible orderings.
- 2y ago
- khuey 2y agorr should work on any remotely modern Intel system, and generally on AMD's Zen CPUs too. Unless you're in a virtualized environment (some of which are supported) or a more esoteric architecture rr probably works on your silicon.
- feelamee 2y agoI have AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx (8) @ 2.100GHz. As I remember - it is should work according to documentation, but I couldn't launch it. Probably I'm not spend enough time to solve errors
- bean-weevil 2y agoYou probably need the fix from this page: https://github.com/rr-debugger/rr/wiki/Zen https://github.com/rr-debugger/rr/wiki/Zen
- imron 2y agoWhich visual studio are you using? It’s been a number of years since I’ve used it but Visual Studio PRO could do all these things - at least as long as I was using it (since visual c++ 5). VS Code on the other hand is no where near as featured or powerful.
- feelamee 2y agoI use VS2022 Enterprise If you know solutions, I will be very thankful for any info. P.S. Note, though I meet all of this problems, probably I don't spent enough time to find a solution (maybe tried first links at google and so on). E.g. tried `strcmp` for breakpoints, tried to write .natstepfilter. So, if VS really can do all of this, I'm sorry for my hurry.
- Kuinox 2y agoI don't know for c but for C# you can write a custom expression that get evaluated for the condition.
- alcover 2y ago> gdb(..) smashing tui with app output this got me losing my mind. How/why propose this tempting TUI mode when the result looks like a broken arcade game ?? How do you people comfortably debug C in Linux ? I know VSCode looks nice but by principle I can't accept to use such a beast to basically edit code..
- feelamee 2y agoas I said - this easy to fix once and for ever Also not all apps write to stdout/stderr by default. > How do you people comfortably debug C in Linux ? It depends on what comfortable is for you. Most of my pc experience is terminal and browser and this is comfortable for me. I just use gdb for debugging. Sometimes trying lldb
- marssaxman 2y ago> How do you people comfortably debug C in Linux? same way I debug everything, everywhere: logging.
- debeloo 2y agoThat not very environmentally friendly.
- dima55 2y agoemacs. Worked great for decades and works great today. Learn it.
- imron 2y ago> How do you people comfortably debug C in Linux ? I just got comfortable using gdb/lldb from the terminal. Once you get used to it, it's fine (albeit not pretty).
- dan00 2y agoI‘m using cgdb, which is a minimal ncurses wrapper around gdb. It‘s a lot better than the TUI of gdb.
- billfruit 2y ago
- n4r9 2y agoOut of interest what are your main use cases for needing conditional breakpoints?
- feelamee 2y agoFor example for debugging gui apps. Let's say we have function `on_event(event_type)` and you want to examine execution if `event_type == mouse_up`. In reality conditional breakpoint is the same as simple, but simple require support from code: ``` void on_event(event_type type) { if (type == mouse_up) { // set breakpoint here } } ``` Also useful to break depending on call stack[0] [0] https://sourceware.org/gdb/current/onlinedocs/gdb.html/Convenience-Funs.html#index-_0024_005fcaller_005fis_002c-convenience-function https://sourceware.org/gdb/current/onlinedocs/gdb.html/Conve...
- n4r9 2y agoYeah, I was specifically wondering about cases where you can't or don't want to change the source code. Sometimes that happens when I need to explore the state after a long process e.g. loading a large file. Generally though I avoid them like the plague as they make the code so slow. Curious to know what other people use it for.
- caspper69 2y agoMan, if you read my comments lately you would think I'm a Microsoft fanboy, sheesh. But honestly, in all my years, Visual Studio has been (by far) the best non-commercial (or should I say built-in?) debugger that I've used, and that includes gdb. I am not a huge c++ on Windows guy though, so YMMV. Here are a few guides that you may find helpful (and I am also going to include the beginner one, but please do not take that as an indictment of your skill level, I am including only for completeness). These are all for VS2022: C++ Debugging Tutorial: https://learn.microsoft.com/en-us/visualstudio/debugger/getting-started-with-the-debugger-cpp?view=vs-2022 https://learn.microsoft.com/en-us/visualstudio/debugger/gett... C++ Breakpoint Debugging: https://learn.microsoft.com/en-us/visualstudio/debugger/using-breakpoints?view=vs-2022&pivots=programming-language-cpp https://learn.microsoft.com/en-us/visualstudio/debugger/usin... Breakpoint/Watch Expressions (pay attention to the debugger intrinsics): https://learn.microsoft.com/en-us/visualstudio/debugger/expressions-in-the-debugger?view=vs-2022 https://learn.microsoft.com/en-us/visualstudio/debugger/expr... High Level Debugger Tour: https://learn.microsoft.com/en-us/visualstudio/debugger/debugger-feature-tour?view=vs-2022 https://learn.microsoft.com/en-us/visualstudio/debugger/debu... VS2022 Debugging TOC: https://learn.microsoft.com/en-us/visualstudio/debugger/?view=vs-2022 https://learn.microsoft.com/en-us/visualstudio/debugger/?vie... My apologies if you've already found these references and they don't do you any good, but your issues just don't sound like the types of issues I've ever experienced with the debugger, and sometimes MS' documentation is just disorganized and incomplete.
- feelamee 2y agovery thanks, this will be useful to simplify my debugging! > and I am also going to include the beginner one, but please do not take that as an indictment of your skill level Don't worry, I am really feel myself as newbie in windows
- mort96 2y agoI'm a UNIX guy through and through, literally everything I ever do is writing code on Linux or macOS which targets Linux and/or macOS. I loathe almost everything about the whole Windows ecosystem, from Microsoft as a company to the way they build their UIs to the technical foundations of Windows. However I have to give them one thing: their developer tooling with Visual Studio and other first-party tools seem vastly superior than anything on macOS/Linux when it comes to debugging. I would never use it as a code editor, but it's clear that a lot of effort has been invested into the debugging experience.