Most active commenters
  • mark_undoio(7)
  • VyseofArcadia(5)
  • malkia(4)
  • (4)
  • cassepipe(4)
  • hexomancer(4)
  • TeMPOraL(4)
  • sourcepluck(4)
  • PontifexMinimus(4)
  • schmidtleonard(3)

376 points turrini | 193 comments | | HN request time: 2.7s | source | bottom
1. pvg ◴[] No.42146417[source]
A mediumish discussion 2 years ago https://news.ycombinator.com/item?id=33044885
2. mech422 ◴[] No.42146468[source]
oh nice - reminds me of DDD(1) DDD was like magic first time I saw it. Oh wow - DDD is still maintained ?? :-D

1 https://en.wikipedia.org/wiki/Data_Display_Debugger

2 https://www.gnu.org/software/ddd/

replies(9): >>42146504 #>>42146873 #>>42147437 #>>42147656 #>>42147730 #>>42147888 #>>42149120 #>>42149837 #>>42157075 #
3. tekknolagi ◴[] No.42146486[source]
See also https://github.com/nakst/gf
4. j1elo ◴[] No.42146504[source]
DDD was taught to me when in University, 20 years ago, and it already felt clunky, my views are now much more moderate but Motif still feels like an eyesore.

Conversations over the years have shown me that DDD was a great inverse marketing tool, ironically pushing developers towards the embedded debugger UI in their favorite IDEs... despite DDD itself being indeed very powerful. But even "usefulness over aesthetics" has its limits!

replies(4): >>42146664 #>>42146891 #>>42147301 #>>42147421 #
5. hexomancer ◴[] No.42146531[source]
Slightly off topic but I think it is a good place to ask: One of the few things from windows that I miss when using linux is the debugging experience with visual studio (not code). When debugging a medium-sized C++ project on windows, the launch of the debug build is pretty fast and stepping over lines is almost instantaneous. On linux launching the executable using gdb takes like 10 seconds loading modules and stepping over each line takes like half a second which I think is intolerable (lldb is even worse). Yet I don't see people complaining about this online very much. Am I missing something? E.g. is there a compiler flag that speeds up debug launch time and step speed that I am not using?
replies(7): >>42146574 #>>42146643 #>>42146716 #>>42146817 #>>42146847 #>>42147042 #>>42148108 #
6. PhilipRoman ◴[] No.42146574[source]
Haven't observed anything like that. Even with remote gdbserver on a low power embeddeded device, stepping has always been instant for me. Could be a C++ vs C thing.

The only thing which takes time is debuginfod downloads.

replies(1): >>42146585 #
7. hexomancer ◴[] No.42146585{3}[source]
How large is your code base? I am talking about 100K+ LOC with many complex dependencies (mainly Qt modules).
replies(1): >>42146826 #
8. ◴[] No.42146643[source]
9. donaldihunter ◴[] No.42146664{3}[source]
Yeah, I remember DDD being an incredible tool back in the day, but it was clunky even when it was new (1995).

https://www.gnu.org/software/ddd/manual/pdf/ddd-paper.pdf

10. j1elo ◴[] No.42146668[source]
This is a Qt UI for GDB.

There's also gdbgui that I know of, a web-based UI for GDB:

https://www.gdbgui.com/

Always good to see more movement in the debug tooling

replies(5): >>42146748 #>>42146831 #>>42146890 #>>42149697 #>>42150045 #
11. 3836293648 ◴[] No.42146716[source]
This is opposite the typical experience so you have some wedrd setup. Gdb is instant and VS' debugger takes forever. It's why companies like epic games have their own debuggers
replies(1): >>42146824 #
12. lacedeconstruct ◴[] No.42146748[source]
Vscode also has an ok gdb frontend, very nice when you are debugging embedded microcontrollers
13. wizzledonker ◴[] No.42146817[source]
Yea, our software stack pulls many dependencies (our software probably totals over 200k loc). We depend on Qt, OpenCASCADE, and a few other heavy C++ Libraries. Stepping over a single line of code in GDB using the TUI can take 3-5 seconds in the worst case. I’ve been meaning to investigate or profile it further when I get the time, but it functionally means I avoid using the debugger except as a “last resort”, or only using it to catch segfaults or unhandled exceptions.

It’s very odd. It’s like it doesn’t cache something and ends up doing some strange expensive symbol search every time it hits a breakpoint or something.

Curious if anyone has a good solution to this also

14. hexomancer ◴[] No.42146824{3}[source]
Have you actually compared the debug performance of a large cross-platform application on windows vs linux?

I am not saying that you haven't just trying to make sure that your argument is backed by data rather than heresay.

15. f1shy ◴[] No.42146826{4}[source]
2 Mio LOC, no problem here.

Sounds like maybe you have reverse-debugging enabled? I mean target record or target record-full?

Anyway, I seldom do step-by-step. I typically work with dprintf.

replies(2): >>42146854 #>>42146888 #
16. dzaima ◴[] No.42146831[source]
To add on to the pile of more GDB GUIs, here's one I've made: https://github.com/dzaima/grr. Though it's still got a fair bit of missing features that may be essential for some uses (due to my usage being largely assembly-level, which doesn't need too many fancy features).
17. alexhutcheson ◴[] No.42146843[source]
GDB also has a built-in text user interface (TUI) that is surprisingly easy to use[1]. It even supports mouse interaction.

[1] https://sourceware.org/gdb/current/onlinedocs/gdb.html/TUI.h...

replies(4): >>42146899 #>>42149505 #>>42150401 #>>42151565 #
18. dzaima ◴[] No.42146847[source]
A long time ago, "set use-deprecated-index-sections on" improved some things; don't know if any modern compilers need that anymore. I also have a "disable pretty-printer global builtin" in my ~/.gdbinit, though I don't recall what that was for, or if I even determined that to improve speed. Currently it seems "set style sources off" reduces some startup time. Don't think I've debugged anything your scale though, and I doubt any of my suggestions will actually help.
19. hexomancer ◴[] No.42146854{5}[source]
Nope, with reverse-debugging enabled it will be insanely slow, not something that you can miss.

I am curious does your project have large external dependencies or is it self-contained.

20. rkharsan64 ◴[] No.42146864[source]
On a general note, I would recommend any new (and experienced!) programmers to master the debugging tools of their ecosystem. I've seen countless experienced developers use printf-based debugging and waste hourse debugging something which could've been easily figured out by setting a breakpoint and stepping through your code. This is also a good way to understand code you're unfamiliar with.

This is one area where I believe a GUI tool is so much better: I can hover over variable names to view their values, expand and collapse parts of a nested structure, edit values easily, and follow execution in the same environment I write my code in.

Sure, it doesn't help much for some scenarios (one I've heard people mention is multithreaded code, where logs are better?), but for most people it's not that far from a superpower.

replies(13): >>42147055 #>>42147066 #>>42147101 #>>42147176 #>>42147333 #>>42147405 #>>42147537 #>>42147789 #>>42147794 #>>42148121 #>>42148413 #>>42149115 #>>42152454 #
21. bitwize ◴[] No.42146873[source]
And it still uses Motif! Awesome!
22. wizzledonker ◴[] No.42146888{5}[source]
Are you talking heavily templated C++ code as well? I’ve got my suspicions about how much this affects things…
23. halb ◴[] No.42146890[source]
Speaking of web-based debuggers, I recenty created a similar project but focused on x86-64 assembly debugging: https://github.com/robalb/x86-64-playground
24. synergy20 ◴[] No.42146891{3}[source]
motif does not work well with high resolution display, sadly
replies(2): >>42147293 #>>42149716 #
25. genpfault ◴[] No.42146899[source]
Only works if GDB has been built with TUI support, sadly :(
replies(2): >>42147067 #>>42147820 #
26. w4rh4wk5 ◴[] No.42146929[source]
Anyone has experience with this and can compare it to kdbg?
27. badsectoracula ◴[] No.42146939[source]
I built it and tried it out a bit with Godot on Linux. It seems OK (the UI is a bit on the "- how many widgets do you want? - yes" side), but also a bit janky. Trying to change the font for the editor didn't work, hovering over a variable to see its value either does nothing (but there is a sub-second cursor change that indicates something is supposed to happen) or it shows an error from GDB about trying to use an expression with a type or keyword (so there was an intent to show a value on a tooltip, it is just broken) - doubleclicking on a variable does add it in some panel with its current value and a timestamp, so the functionality for reading values/expressions from the UI is there too, just not done in the same way as the tooltips.

If polished a bit it could be useful, though from all the frontends i've tried the one i disliked the least (none are great) is Gede[0] (which i just noticed had a new release a few hours ago) as it has a very simple and straightforward UI and while it doesn't expose much functionality, what exposes seem to work fine without bugs.

[0] https://gede.dexar.se/

replies(2): >>42147638 #>>42157031 #
28. nurettin ◴[] No.42147012[source]
Qt GUI itself can use gdb/ldb and display a fair amount of data structures from the standard library.

Note that gdb is also scriptable with python, so you can easily register your own printers.

29. glitchc ◴[] No.42147031[source]
eclipse-cdt includes a GDB integrated debugger UI for C and C++ since forever. What's new here?
replies(2): >>42147717 #>>42155852 #
30. GuB-42 ◴[] No.42147042[source]
> I don't see people complaining about this online very much

I complain about gdb all the time, speed is just one aspect. Step-by-step debugging is just terrible on Linux. Maybe that's actually the reason few people complain about it, they just don't use gdb, instead relying on other tools, especially printf(). I am not in the video game industry, but they seem to be way, way ahead of everyone else, especially Linux (non-game) developers. Maybe some collaboration is in order.

As for your specific problem, I don't know. Do you have optimization turned on when debugging? gcc/gdb and the LLVM equivalents let you debug optimized builds, but it is not ideal as knowing which instruction corresponds to which line is complicated, and maybe gdb is working extra hard for it. The "-Og" flag is supposed to only do "debugger friendly" optimizations, also "-ggdb" or "-ggdb3" is supposed to be better than plain "-g" for use with gdb.

replies(1): >>42152657 #
31. VyseofArcadia ◴[] No.42147055[source]
But also, experienced programmers should never forget their printf debugging roots.

I was debugging something earlier this week that was hit like a hundred times in a tight loop. After the first dozen or so times I told gdb to continue, I realized, wait, this will be faster if I just fprintf some relevant information to a file. Sure enough the file pointed me in the right direction, and I was able to go back and get fancy with "disp" and "cond" and hit that breakpoint only when I needed to.

replies(3): >>42147372 #>>42147615 #>>42149899 #
32. underdeserver ◴[] No.42147066[source]
I would add to that that in most scenarios where people think debugging doesn't help or won't work - it can.

Running inside Docker, multithreaded, multiprocessed, all can be debugged with a little effort. Most often much less effort that repeatedly printf debugging.

replies(2): >>42147154 #>>42148173 #
33. cyberpunk ◴[] No.42147067{3}[source]
… If you are debugging c code surely you’re able to compile a debugger with whatever options you want?
replies(1): >>42150865 #
34. VyseofArcadia ◴[] No.42147073[source]
For the Emacs users in the crowd, GUD is a pretty great GDB integration.
replies(4): >>42147285 #>>42147467 #>>42148175 #>>42156144 #
35. kombine ◴[] No.42147076[source]
When I used to program in C++ on Linux 10+ years ago, I used Qt Creator which has a built-in debugger (GDB frontend). It worked great and I don't see a reason to use anything else for C++ [and Qt].
36. mpweiher ◴[] No.42147101[source]
Interesting.

My experience is the opposite: I see developers waste hours stepping through their code a line at a time when a few judiciously placed logs (printfs() are fine, but we can do better) would have told them exactly what they needed in a jiffy.

If you have a fairly shallow bug, that is a single point in your code that always behaves incorrectly, then I find debuggers reasonably effective.

But most of the bugs that I see aren't that shallow, with code misbehaving when the context is just so and perfectly fine otherwise. In those cases, I need to see lots of different invocations and their context. The debugger is like trying to drink the information ocean I need through a straw. A mostly plugged straw.

I wonder what makes our experiences so different? Do you unit test a lot? Particularly with TDD? I am guessing that this practice means I just don't get to see a lot of the bugs that a debugger would help me with.

(And it doesn't mean I never fire up the debugger. But it is fairly rare).

replies(22): >>42147211 #>>42147237 #>>42147245 #>>42147283 #>>42147315 #>>42147373 #>>42147478 #>>42147783 #>>42147884 #>>42147930 #>>42148469 #>>42148634 #>>42148838 #>>42148842 #>>42148881 #>>42148922 #>>42149104 #>>42149226 #>>42151135 #>>42155917 #>>42156264 #>>42179165 #
37. cassepipe ◴[] No.42147118[source]
After trying many frontends for gdb I find that the TUI is the best. You just need to know about Ctrl + L to redraw if your program is printing stuff because the interface then become garbled.

I just put :

   layout src
   set confirm off
in my $XDG_CONFIG_HOME/gdb/gdbinit
replies(5): >>42147210 #>>42147594 #>>42150049 #>>42150533 #>>42153573 #
38. reacweb ◴[] No.42147150[source]
I sometimes need to use gdb to investigate bugs in C or Ada, but it is not my main activity. As a result I will not invest days to setup a debugging environment that I will not remember how to use 6 month later. My solution: I use emacs and have a short note with instructions: M-x gdb -i=mi exe_full_name -p 29123 M-x gdb-many-windows set follow-fork-mode child
39. cassepipe ◴[] No.42147154{3}[source]
I am not sure I understand your point. Can you be more explicit ?
replies(2): >>42147798 #>>42147805 #
40. cmrdporcupine ◴[] No.42147176[source]
Even in multithreaded code, it's absolutely amazing to be able to pause a running program and look at the list of running threads and the values in scope and see where deadlocks might be sitting.

It's immediately obvious you're deadlocked, which is actually kind of tricking to suss out with log-style debugging.

Modern debuggers can do so much, being able to lay down conditions to only break when certain values are set, etc. etc. Some can even "rewind" programs. I'd say most people (including myself) are using only 25% of their debugger's capabilities.

Aside: One the reasons I despise working with async Rust code is the mess it makes of working with a debugger.

41. CarpaDorada ◴[] No.42147210[source]
I like a colored prompt with

  set prompt \001\033[01;36m\002(gdb)\001\033[0m\002
and I save history with

  set history save on
  set history size 500000
  set history filename ~/.cache/gdb/history
replies(1): >>42147621 #
42. setopt ◴[] No.42147211{3}[source]
I have more or less the same experience like you. Logging is a very resilient and adaptable technique – I can use it on my laptop or on remote HPC clusters, almost regardless of programming language (except maybe Haskell), it works fine on parallelized code, and so on, with very little configuration needed. It’s also important to me that it can be done “async”, since some of my larger codes can only be run on HPC clusters by putting a job in a process queue and waiting.

I’ve tried debuggers and see the appeal but I find it less useful than print debugging / logging.

I also rely heavily on unit tests when writing new code, so that also reduces the surface that I need to look for bugs based on the log. Moreover, most of my projects have 1-3 programmers and can largely “fit in my head” (<10,000 lines of code), so it’s probably different if you work at a FAANG company or something.

replies(1): >>42147680 #
43. jacobyoder ◴[] No.42147237{3}[source]
Not the OP but...

> programmers to master the debugging tools of their ecosystem. I've seen countless experienced developers use printf-based debugging and waste hourse debugging something which could've been easily figured out by setting a breakpoint and stepping through your code.

If you're wasting hours with printf-based debugging, I don't think you've 'mastered the debugging tools of the ecosystem'.

There are multiple ways to debug - step debugger tools, printf, logging to a file, etc. Each have their place.

If you're spending hours on any one approach, and perhaps that's the only approach you know, that's a red flag.

If you've spent hours going through printf, logging and step debugging and STILL don't have a good answer... bring in external eyes.

I've found/fixed bugs in a few minutes because of adding some log stuff first, because in those cases, it's the easiest approach. In other cases, running a debugger and setting a couple breakpoints is indeed the easier approach to start with, and I've done that.

Sometimes you find it with the first approach, sometimes you need to try the next approach.

44. schmidtleonard ◴[] No.42147245{3}[source]
> If you have a fairly shallow bug ... But most of the bugs that I see aren't that shallow

Oh come off it, debuggers shine the brightest when there are lots of unknown unknowns. With printf debugging you can peel back exactly one layer at a time (oops, need to log one more thing) whereas with a debugger you can slice through the Gordian knot.

replies(2): >>42147390 #>>42148498 #
45. cjbgkagh ◴[] No.42147283{3}[source]
I would guess longer compile would encourage breakpoints over printf and this would be programming language specific.

Being able to change breakpoints at runtime helps a lot when tracking down something more complex. Visual Studio breakpoints are great, and they’ve added conditional breakpoints which are even better. Previously I would approximate this by having code specifically branch to hit a breakpoint, ‘if (X) { breakHere();}’

I write a fair amount of native C++ code but only call it from either Python or dotnet so when I make a mistake here it’s usually a segfault / memory access issue which kills the process. There might be a way to debug the C++ from dotnet or Python but logging to std out helps me isolate the location of the issue which is sufficient. It’s not a big enough problem and I worry that either writing tests in C++ or learning a native debugger will pay off in time saved.

46. cherryteastain ◴[] No.42147285[source]
lsp-mode+dap-mode also work well but requires some manual fiddling with launch.json files
47. anthk ◴[] No.42147293{4}[source]
Motif today supportṡ TTF and for the HD issues, you can the DPI option for X11 at ~/.Xdefaults
48. anthk ◴[] No.42147301{3}[source]
Current DDD under the updated OpenMotif with TTF fonts can look much better than it did in the 90's and 00's, miles ahead than LessTif/former propietary Motif. It blends perfectly with EMWM where I have Liberation Sans/Mono for almost everything.
49. miningape ◴[] No.42147315{3}[source]
Another thing to consider and is important to me - logging objects and state isn't always so simple. It can often be easier for me to open the debugger to look at the state of an object which cannot easily be printed.
replies(1): >>42147419 #
50. tomjen3 ◴[] No.42147333[source]
Rider shows the value of assignments in your code, on the line they are assigned when you are debugging. This has saved me time when I notice that a value I didn't even think about looking into was wrong.
51. agumonkey ◴[] No.42147373{3}[source]
I agree with both of you. Printf is not enough, breakpoints are not enough. The solution lies between. Ability to gather rapidly relevant information to converge on wrong states.

ps: I wish I could work on a porcelain layer to manage the breakpoints in a more logical manner. Considering a problem you'd like to create different sets of breakpoints, run various tests and gather results to reviews. With the ability to add or remove layers rapidly. It's probably not too hard to do.

replies(2): >>42147396 #>>42147738 #
52. mark_undoio ◴[] No.42147372{3}[source]
You could also use GDB's Dynamic Printf (https://sourceware.org/gdb/current/onlinedocs/gdb.html/Dynam...) to do the logging directly from GDB.

Essentially you set it like a breakpoint (attaching a printf style string to a code location) and then just "continue" until you've gathered what you want.

replies(1): >>42147801 #
53. dingnuts ◴[] No.42147390{4}[source]
Try using a debugger to debug a globally distributed system that humans aren't given access to for security reasons in a post mortem and then "come off it" yourself
replies(1): >>42148103 #
54. conradev ◴[] No.42147396{4}[source]
I have found combining these things to be useful: breakpoints that print stuff and auto-resume the program. Allows you to attach trace points at-will without requiring a recompile or losing state.
replies(1): >>42147548 #
55. mark_undoio ◴[] No.42147405[source]
> Sure, it doesn't help much for some scenarios (one I've heard people mention is multithreaded code, where logs are better?), but for most people it's not that far from a superpower.

Debuggers can be great for understanding multithreaded code - and you can potentially freeze threads and continue others in order to provoke a particular race condition.

However they're potentially quite weak at stepping through a concurrency bug - stopping after each line to understand the sequence of events has a good chance of making your bug go away.

I'd say you want Time Travel Debugging if you need to capture and step through a rare event: you get to record the bug happening (without interrupting it) and then step through the recording.

On Linux, Undo.io (disclaimer: where I work) and rr (open source) are good at this.

On Windows, you have Microsoft's own Time Travel Debug solution: https://learn.microsoft.com/en-us/windows-hardware/drivers/d...

(nb. there's also GDB's built-in process record technology but I'd recommend against that for any non-trivial software as the overheads are very high)

replies(1): >>42148321 #
56. mark_undoio ◴[] No.42147419{4}[source]
Out of interest - what sort of objects are hard to print in this way but easy to view in a debugger?
replies(2): >>42147525 #>>42148155 #
57. dirkf ◴[] No.42147421{3}[source]
There's one DDD feature that I haven't found elsewhere: its graphical representation of a struct and its contents. You can double-click on a pointer field and then it draws whatever that field pointed to, with a nice arrow connecting the two.

I've found it a very powerful yet compact way to visualize the state of a program when debugging.

replies(2): >>42147735 #>>42151006 #
58. mark_undoio ◴[] No.42147437[source]
I love that DDD has a variety of graphical visualisations built in. I always thought the ability to data structures was particularly cool.

A while ago there was a project to port it to GTK3 but I think that went away. I'm glad the mainline project is still going.

replies(1): >>42147613 #
59. alexhutcheson ◴[] No.42147467[source]
I prefer the GDB Graphical Interface in Emacs[1] (M-x gdb), rather than the more basic integration via GUD[2] (M-x gud-gdb). I’ve had to switch to GUD to run lldb recently, and I miss having dedicated windows that show breakpoints, threads, the current stack, etc.

The one nice thing about GUD is that the interface is consistent across debuggers, so I don’t need to refresh myself on the keyboard shortcuts when switching between debugging Python with pdb and C++ with lldb.

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/GD...

[2] https://www.gnu.org/software/emacs/manual/html_node/emacs/St...

60. gosub100 ◴[] No.42147478{3}[source]
My grief with debuggers is due to C++ and template code (usually STL) and optimizations zeroing out values. I wish it had better training wheels to say "nope that's STL library code, you probably don't want to step any deeper". That's largely a criticism of C++ itself, though. But yes for this reason I prefer printfs despite 20 years in the game.
replies(2): >>42147813 #>>42147896 #
61. miningape ◴[] No.42147525{5}[source]
In my case it's basically everything since I work in java, jackson's object mapper can easily get stuck or deserialise something incorrectly if the class hasn't been annotated correctly. So it's simpler for me to pull up the debugger and I can see the "actual" data thats making up my object, it also lets me run "queries" against anything of interest (i.e. computed fields).

The default toString method I've found to be useless almost every time I wanted to inspect an object in our codebase since it just prints the type + "id" for the object

62. bobmcnamara ◴[] No.42147537[source]
At least in embedded, often the tools suck.

Some ancient version of NetBeans leaking ram like a sieve until it brings down the machine, or a decade old version of Eclipse that can't pull in a newer CDT, running on a fork of OpenOCD with nothing customized for the CPU architecture running dog slow.

Sadly, it can be faster to reserve a GPIO, bitbang a TX-only UART, and get on with it.

63. agumonkey ◴[] No.42147548{5}[source]
Yes losing state is a killer
64. DSMan195276 ◴[] No.42147594[source]
I've used "gdb-dashboard" a lot, would recommend it. It's similar to the TUI (though I haven't used the TUI much), but you can pick and choose to display a large variety of information and the colors make the output much easier to read.

You can also make the dashboard display on another or across multiple terminals, letting you create a much nicer window layout. I've scripted this up with tmux before to have it automatically create the terminal layout and connect them to gdb, you can create really nice layouts that way (though it can be a lot of effort).

65. mech422 ◴[] No.42147613{3}[source]
yeah - the 'data display' part was the real killer feature :-)
66. cevn ◴[] No.42147615{3}[source]
In Jetbrains you can also do a Conditional breakpoint to active only if i=100 or something.
replies(1): >>42147811 #
67. cassepipe ◴[] No.42147621{3}[source]
I like to do that as well. Just want to keep it short :) Also I use vim mode for bash and since it's in .inputrc I also have a vim mode in gdb which I like a lot even though it's as good as zsh's
68. jwrallie ◴[] No.42147638[source]
> it has a very simple and straightforward UI and while it doesn't expose much functionality, what exposes seem to work fine without bugs.

Nice one, I will add it to my notes to use it next time I need debugging. The least thing I want when looking for a bug in my own code is to have to deal with bugs in the debugging tools.

69. jandrese ◴[] No.42147656[source]
I always liked the concept with DDD, but I could never keep it from crashing more than the program I was trying to fix.
replies(1): >>42147834 #
70. coliveira ◴[] No.42147680{4}[source]
I think you have a great point here. Debugging tools make you dependent on a particular environment. Printing based debugging can work pretty much everywhere. If you master printf programming you can solve any debugging task.
replies(1): >>42148387 #
71. einpoklum ◴[] No.42147717[source]
Eclipse CDT is a whole IDE; is rather complex, and one might even say convoluted; and is Java based. Seer is none of these things.

Of course - it's not like a GDB GUI is a novelty in itself, there are quite a few. But a GDB-GUI-only utility is a meaningful and important niche to consider.

72. begriffs ◴[] No.42147730[source]
> DDD is still maintained?

Absolutely. I wrote about its features here https://begriffs.com/posts/2022-07-17-debugging-gdb-ddd.html

Since the article was written, the maintainers fixed the issues I pointed out. No need for many of those workarounds now. Versions 3.4.0 and 3.4.1 are substantial.

replies(1): >>42149607 #
73. jlintz ◴[] No.42147735{4}[source]
yes! this was so great in college to learn pointers and visualize linked lists
74. null_deref ◴[] No.42147738{4}[source]
Yes exactly, and I'll probably say very generally that I usually use breakpoints when I am in the exploration stage of a significant state bug, and I'll usually use logging when I generally know where the bug should be but I need to pin point the exact place
75. samatman ◴[] No.42147783{3}[source]
It depends on the code as much as anything. I wrote a regex engine in Zig, and the instant I get a bug report I set breakpoints on a failing test and step through.

On the other hand, I'm working on an interactive application, and when I see a problem with it, I add more logging statements until I figure out what the problem is. Any time the logs have excessive detail as a consequence, I gate them behind an 'extra' flag on a per-unit basis, only removing the ones which amount to "got here".

If I had to pick one technique, it would be logs. I naturally think in terms of a trace through the execution pathway, rather than a step-by-step examination of the state of a small window into the code. It clearly works the other way around for some people.

One thing that makes this approach better for me is that debug logging is literally free, Zig uses a lazy compilation model so logging code which doesn't apply to a release compilation isn't even analyzed, let alone compiled, let alone included. In a language which doesn't work that way, there's motive to use printf-only debugging, and clean up after yourself afterwards, and that's extra work compared to firing up a debugger. So it shifts the balance.

76. shortrounddev2 ◴[] No.42147789[source]
I honestly believe it's a cultural thing. I don't think there's any rational reason to not want to use a debugger, but I've met many people who swear it's useless. I think people in web tend not to use debugger, and a lot of Linux people as well. Everybgame developer I've met and most windows programmers use them
replies(1): >>42148520 #
77. crossroadsguy ◴[] No.42147794[source]
Sometimes I have had much better results with adding logs especially if an issue doesn't occur always and I am not so sure about the steps either because breakpoints take a lot of time as well. Also, in some cases (esp. mobile UI) breakpoints might actually break the flow and you might not get a proper flow. But yeah mastering the debugger is indeed a must and a GUI debugger is better than a CLI debugger. It's just that at least for me personally logging is first line of debugging :|
78. shortrounddev2 ◴[] No.42147798{4}[source]
Many people believe that a debugger won't work in their specific scenario, but often they are wrong; debugger can connect across network boundaries or into other processes that weren't launched by the IDE
79. VyseofArcadia ◴[] No.42147801{4}[source]
Oh sweet. I didn't know about that. I will be adding that to my toolbox.
80. fisf ◴[] No.42147805{4}[source]
People who think that case X cannot be debugged without printf often don't know the features of their debugger. I.e. look at several of the comments which seem to miss that you can:

- Remote debug.

- Use conditional breakpoints.

- Use breakpoints to trigger commands, e.g. log values, enable other breakpoints, etc. instead of stopping. execution.

- Debug multi-threaded code.

- Disassemble a fragment.

replies(3): >>42147908 #>>42147921 #>>42149234 #
81. VyseofArcadia ◴[] No.42147811{4}[source]
Well yeah, but I didn't know I wanted i = 100 until I had examined the fprintf output.
replies(1): >>42147889 #
82. ta988 ◴[] No.42147813{4}[source]
gdb has a skip function and you can exclude STL headers and functions named in special ways so that reduces the noise quite a bit.
83. shortrounddev2 ◴[] No.42147820{3}[source]
Is it not usually? I've never had to compile gdb myself to get TUI
replies(2): >>42149059 #>>42149957 #
84. ta988 ◴[] No.42147834{3}[source]
It is much better now.
85. adl ◴[] No.42147884{3}[source]
A good debugger can provide more than just stepping thru code.

In IntelliJ with Java, you can set conditonal breakpoints with complex evaluations, you can set filters (only hit a breakpoint depending from where it is being called), use exception methods that only hit on certain exceptions instead of a specific line code, you can also use logging breakpoints, that act like printf debuging, but you don't need to scatter your code with print statements all over the place.

You can group, add descripitons, disable, enable and add temporary breakpoints, they are pretty powerful! I just wish intellij had a time travel debbuger like Visual Studio Pro.

https://www.jetbrains.com/help/idea/2024.3/using-breakpoints...

replies(1): >>42149334 #
86. anonymousiam ◴[] No.42147888[source]
DDD is great. I still use it, but I am a fossil. I sought out DDD when I was looking for something similar to dbxtool, which I used on the early Sun Microsystems machines. Folks today are spoiled with things such as Source Level Debugging.
87. gregthelaw ◴[] No.42147889{5}[source]
You need a time travelling debugger!

https://undo.io/

https://rr-project.org/

https://learn.microsoft.com/en-us/windows-hardware/drivers/d...

replies(1): >>42148501 #
88. ksylvestre ◴[] No.42147896{4}[source]
Visual Studio has natstepfilter

https://github.com/ocornut/imgui/blob/master/misc/debuggers/...

89. gregthelaw ◴[] No.42147908{5}[source]
Just yesterday I gave a talk at MeetingC++ in Berlin on debugging multithreaded code. It's amazing how few developers know anything beyond the very basic of their debugger. If all you know is print, break, continue, next and then you dismiss the debugger as "not very useful" then you've not made a judgement based on information but on initial reaction.
90. gregthelaw ◴[] No.42147921{5}[source]
I have a bunch of (36 if you're counting :) short videos and blog posts introducing the advanced features of GDB: https://undo.io/resources/gdb-watchpoint/
91. BearOso ◴[] No.42147930{3}[source]
Inserting a breakpoint is just as easy as a printf, and as long as you're still using a debugging build, you don't have to recompile. With the printf you might not have considered all the variables you need, so you have to go back, insert, and recompile. With a breakpoint you can inspect the contents of anything at that scope, and even see what the code flow is with that given state. You can even save a core dump to go back to later.

You can also script breakpoints to output the info you want and continue, giving you your information ocean.

Basically, a debugger is a more efficient and powerful tool. In the one situation where you're not skilled with a debugger feature, a printf can be quicker than having to learn, but it's objectively worse.

replies(2): >>42148511 #>>42148517 #
92. schmidtleonard ◴[] No.42148103{5}[source]
Is that the only kind of difficulty you can think of? Lol.
93. jmorse3 ◴[] No.42148108[source]
Ensure you're building with DWARF5, and enable accelerator tables like .debug_names, which will allow debuggers to receive a pre-prepared index of the symbol names in the program (and thus it doesn't have to parse all the DWARF on startup).

Slow stepping is a surprise; there's no OS reason for that to be slower. Possibly if your types are really large and complicated, the debugger has to fetch a lot of data to refresh its view of state each time?

94. HumblyTossed ◴[] No.42148121[source]
I use debug logs extensively. I log a LOT. I can put the logs and code next to each other and trace through the code. So much better than a debugger. With the logs, I don't have to worry about timers or concurrency or any of that. I can take my time and read the code and reason about what's going on.

Edit: Logging helps me look at what is going on in prod as well. I can trace messages/transactions completely through the path and if there's an issue, I'll see it.

95. alfiedotwtf ◴[] No.42148130[source]
Debugger vs printf:

Has anyone found a reliable way to use a debugger when you have a) multi-process b) multi-threaded c) async d) timeouts? I would love to use a debugger but printf and logs “just work”

replies(4): >>42148913 #>>42149860 #>>42149876 #>>42151188 #
96. antonyt ◴[] No.42148155{5}[source]
An object with many fields (in a language with no conveniences for it). An object tree with multiple levels of nesting. A list or dictionary of such objects.

In general, print-based debugging requires a greater degree of specificity. If you know exactly what you're looking for it's great.

If you are performing a more exploratory sort of debugging, a decent graphical debugger will save you a ton of time.

97. HumblyTossed ◴[] No.42148173{3}[source]
And a good debug log can help more than either of those.
98. seanw444 ◴[] No.42148175[source]
Ever since the advent of LSP, Emacs has felt superior to everything else. I have no reason to leave it. Especially once they made it faster with native comp.

Like why should I keep trying this month's new editor with a couple new gimmicky features, when I can just pop a plugin onto Emacs that adds that exact feature set, while maintaining everything else how I like it.

I first really got into coding when Atom was a thing, and then that died off and became VS Code and I was pretty sad about it, because while VS Code is good, it doesn't follow the same philosophy as Atom. But then I took the time to learn Emacs ~4 years ago, and nothing new ever comes close to convincing me it's outdated tech that I need to move on from.

That was a random rant, but I'm just really appreciate Emacs, and I'm glad it's stuck around.

replies(1): >>42148264 #
99. VyseofArcadia ◴[] No.42148264{3}[source]
Even before the dawn of the LSP era, Emacs was pretty great with ctags.
replies(1): >>42148303 #
100. seanw444 ◴[] No.42148303{4}[source]
Yeah I first gave it a try before LSP and I don't think I was ready to be redpilled yet, because it didn't stick. So I can't comment on the state of it before then. I kinda joined once the LSP stuff got fairly smoothed out.
101. 0xfeba ◴[] No.42148321{3}[source]
I've had logging slow down a concurrency issue enough to cause the race condition to never appear when logged, but setting a breakpoint (and stopping all threads) prevailed.
102. schmidtleonard ◴[] No.42148387{5}[source]
Yes, portability and simplicity are the best parts of printf.

> If you master printf

The skill ceiling is low. Printf only does so much.

You could rope in environmental optimization to the skill discussion -- the ability to isolate areas of functionality, replicate problems, reason about unknown state, and do the legwork so that you can quickly spin the increased amount of iteration required by a simpler debugging tool -- but by then you have thoroughly sacrificed both simplicity and portability and are far past the skill floor of a debugger.

If we assess this by looking for problems created by overcommitting to one approach or another, overcommitting to a debugger looks like burning time trying to get tooling to work on a problem that doesn't really need it while overcommitting to printf looks like spending way too much time iterating on tiny steps that could have been jumped over given better visibility. I've seen both, of course, but I tend to see more of the latter and more denial about the latter. When you're burning time fighting tools it's obvious. When you're burning time because you don't know how a tool could have saved you time, it's less obvious.

YMMV.

replies(1): >>42148481 #
103. mbrumlow ◴[] No.42148413[source]
Idk. I feel like the second you need to use a debugger your code and design has become too complicated and needs to be rethought.

In general anything you would want to debug should probably be exposed as a unit test and the area of concern should have test cases made that trigger the behavior you are concerned about.

The entire process of debugging essentially results in the same process as you would need to do to create unit test. While it is faster it is lost once done, making the entire process one shot.

104. PontifexMinimus ◴[] No.42148469{3}[source]
I've also used both GUI-based debuggers and printf, and I prefer printf. But the most important thing it to write your code so there aren't many bugs and when there are they are easy to find. I do this using modular code, unit tests and regression tests.
105. PontifexMinimus ◴[] No.42148481{6}[source]
> the ability to isolate areas of functionality

This is the key. You need to be able to narrow down where the bug is.

106. nsteel ◴[] No.42148498{4}[source]
I agree with this comment but you really didn't need the first 4 words.
107. amlib ◴[] No.42148501{6}[source]
What happens if the loop executes some non-idempotent calls? I guess printf debug still has some value :)
replies(1): >>42149383 #
108. corysama ◴[] No.42148511{4}[source]
You can insert and remove breakpoints while running. You can inspect variables the instant you realize they might be relevant.

During my long career, I’ve always been told “You should know you code well enough that a few well placed printfs is the most you’ll need to understand a bug”.

But, most of my career has been spent debugging large volumes of code written by other people. Code I’ve never seen before and usually will never see again.

A debugger making a 10X productivity difference for me is no joke.

109. PontifexMinimus ◴[] No.42148517{4}[source]
> With the printf you might not have considered all the variables you need, so you have to go back, insert, and recompile

In some languages, such as Python, it's fairly easy to write a debug-print function that prints all the local variables (as well as the function name and line number it was called in).

replies(1): >>42148735 #
110. marssaxman ◴[] No.42148520{3}[source]
I made heavy use of interactive debuggers earlier in my career. After several years working in environments where debuggers were broken, unhelpful, or not available, I completely lost the habit. It was not so much a cultural thing as simple practicality: logging always works. I'd rather maximize my limited brainpower by focusing on the software I'm building and thinking as little as possible about the tools I'm using.

It may be somewhat cultural in that influence from functional programming eventually changed the way I think about state and state transitions, leading me to design my code differently, reducing the amount of debugging I have to do and making it easier to do via logging.

111. cess11 ◴[] No.42148634{3}[source]
I use profiling tools more than step-debugging, and printf()/var_dump()/IO.inspect/System.out.println/&c. much more than both, because most of the time I just need to see what the data looks like in a few locations to have a solution.

Sometimes the problem doesn't show up immediately in data and the code is too complex or uses a lot of wormhole techniques like particular forms of exception abuse, that's when I might fire up the debugger and browse frames instead.

112. 9dev ◴[] No.42148735{5}[source]
That misses the mark. You can’t really compare a hackish ”print the world as a string“ function against a debuggers ability to stop time, walk around, pick things up, slice them open, put them somewhere else, and start time again.

That’s not just not the same league, it’s playing a whole different game.

replies(1): >>42149326 #
113. malkia ◴[] No.42148800[source]
In case you are in Windows, and connected to Linux and/or using WSL, you can also use WinDBG/VisualStudio to debug (remotely) Linux processes!
replies(1): >>42151058 #
114. toprerules ◴[] No.42148838{3}[source]
I'm an OS developer and in my view using printf is like seeing only half the world at once. There's a whole world of platform specific decisions that are made at compile time and runtime that you can only see through the lens of a good assembly debugger.

You're also talking about debugging apps running comfortably in the idillic world created by the OS. It's much harder to debug foundational pieces with printf's when the program immediately panics or early printing isn't available.

In my opinion it's good to build habits that can be generalized to all sorts of software and not limit oneself to writing code in a highly structured environment where most of the work is done for you. I can trace through a program faster than someone can insert/remove printfs and recompile their program, and I don't need to think about what to print. I can look at everything at that point in time, covert data to strings, look at the stack, registers, etc. Very powerful stuff.

115. malkia ◴[] No.42148842{3}[source]
I've been, and still am, at the mercy of both of printf-debugging style and real debugger.

Long time ago, worked on a port of game from PC to Playstation 1. Since we had the Yaroze "devkit" (not really a devkit, rather amateur kit for doing games), printf debugging was the only thing available.

Things kind of worked, but when we #ifdef-out the printfs it was crashing (and no debugger). We somehow discovered that one of "printf" side effect was clearing the math errors.

replies(1): >>42150238 #
116. canucker2016 ◴[] No.42148881{3}[source]
Why must this be a mutually-exclusive situation?

You can have the source code debugger log messages to the output window without having to add logging statements and recompile the affected code.

This is the 21st century.

see visual studio's tracepoint functionality - works in native and .Net languages, https://devblogs.microsoft.com/visualstudio/tracepoints/

sure, if you want the logging messages available for perusal when deployed in production, then this won't help.

Even better - use Hot Reload and tweak your code in the debugger - https://learn.microsoft.com/en-us/visualstudio/debugger/hot-...

[edit] GDB's equivalent to tracepoint is mentioned elsewhere in this thread - https://news.ycombinator.com/item?id=42147372

replies(1): >>42148983 #
117. fisf ◴[] No.42148913[source]
GDB can do a, b, c (async Code is not really special?). d is going to be tricky and really depends.
118. lynndotpy ◴[] No.42148922{3}[source]
I think unit tests and debug/verbose print statements are useful for debugging. Even if you're firing up the debugger, these provide a lot of information up front! But more importantly, they make your project more approachable for contributors who aren't already familiar with the debugger.
119. ◴[] No.42148983{4}[source]
120. sakras ◴[] No.42149059{4}[source]
This has definitely been an issue for me before, I think at least for a while Ubuntu/Debian didn't ship gdb with tui enabled, you had to build it yourself.
121. whartung ◴[] No.42149104{3}[source]
I trend more towards print debugging than breakpoints.

To me the beauty of print debugging is you can see the flow, and see it quickly in contrast to the debugger. Simply with the debugger, a lot of the time is spent stepping past (at the moment) superfluous breakpoints.

Step, step, step, step, …, step, step, BANG!

Versus a quick BANG preceded by a trail of debris I can then postmortem. I use both, naturally, but prefer the crashes with a debris field than walking on eggs to potential disaster.

replies(1): >>42152353 #
122. ◴[] No.42149115[source]
123. ◴[] No.42149120[source]
124. rkharsan64 ◴[] No.42149226{3}[source]
From my (super limited) experience, debuggers shine when:

- You're using a dynamically typed language.

Something like Rust can eliminate most bugs that come from incorrect data types. For me, a lot of bugs used to come from types that were different from what I expect.

- It is super easy to run your program with a debugger attached.

If your code needs to run on a K8s cluster or a dedicated test machine instead of locally, logs are much easier to get hold of than a remote debug session. Some people aren't even aware that they can attach a debugger to a computer over the network, or inside a Docker container.

- Your environment.

If you don't use an IDE that supports a debugger, it's another friction point. I'm not sure if Vim has something similar to, say, PyCharm's debugger.

Similarly, if you're a junior, and you reach out to a senior and they tell you to debug using logs, you probably will never switch to using a debugger yourself.

replies(1): >>42150570 #
125. cassepipe ◴[] No.42149234{5}[source]
Oh thanks, I know about that and agree. I did not understand the point about doing debugging in containers.

But I think I understand now. I guess they only debugging a program that is running in a container.

126. PontifexMinimus ◴[] No.42149326{6}[source]
You call it haskish but it's something I've done in the pasty and find useful.

I don't find debuggers all that useful, because I often find I'm spending more time thinking about how to use the debugger rather than how to fix the bug; since debugging is hard I want tools that I don't have to think about at all, as they distract me from thinking about the bug.

Maybe that's because I don't have enough experience with a particular tool. If I used a debugger more often it would come naturally to me. But I find most of my bugs are simple enough that that doesn't happen, because I write modular code and TDD.

replies(1): >>42155951 #
127. mark_undoio ◴[] No.42149334{4}[source]
> I just wish intellij had a time travel debbuger like Visual Studio Pro.

You might find our Java product interesting, it adds Time Travel Debug to IntelliJ - https://undo.io/products/java/

Undo captures everything the process does, below the JVM level, so you can reproduce / rewind any problem you record as many times as you want (and copy the recording out of production onto a dev machine to debug, etc etc).

Please get in touch if you'd like a free trial.

128. mark_undoio ◴[] No.42149383{7}[source]
> What happens if the loop executes some non-idempotent calls? I guess printf debug still has some value :)

Then they'll do the same thing when you replay.

Non-idempotent system calls are tricky because they interact with the outside world - but that's still OK.

In Time Travel Debug, the process you're debugging is essentially in the Matrix. When it's being recorded everything acts as normal (and it'll see the real results of those non-idempotent calls).

When it's being debugged, any interaction with the outside system is prevented and replaced with the behaviour we saw at record time. It'll still think it's doing the non-idempotent calls, they just won't change (or depend upon) the state of the rest of the system.

129. shmerl ◴[] No.42149505[source]
Neovim + nvim-dap + nvim-dap-ui + gdb works much nicer than that.
130. shmerl ◴[] No.42149527[source]
This combo works well for me: neovim + nvim-dap + nvim-dap-ui + gdb (with native DAP protocol support).
131. canucker2016 ◴[] No.42149607{3}[source]
Is there any URL that lists what's new in v3.4.0 and v3.4.1?

The DDD website ( https://www.gnu.org/software/ddd/ ) points to the source tar.gz and the full manual, but nothing that says "What's New" in recent versions.

replies(1): >>42151688 #
132. hulitu ◴[] No.42149697[source]
And DDD. A Motif front end.
133. hulitu ◴[] No.42149716{4}[source]
Citation needed. I use Motif programs without issues on high resolution displays.
134. slashdave ◴[] No.42149837[source]
Coming from VMS at the time, I was confused why there was no decent full screen interface to gdb. DDD was such a disappointment in this regard.
135. slashdave ◴[] No.42149860[source]
The syntax is clunky, but watchpoints can do what you want.

https://ftp.gnu.org/old-gnu/Manuals/gdb/html_mono/gdb.html#S...

136. Mr-Frog ◴[] No.42149876[source]
I used GDB to debug contributions to the ION Delay-Tolerant-Networking stack, which is composed of dozens of processes. After some practice it became super easy to attach GDB instances to several running processes and watch the C structs be passed between them.
137. slashdave ◴[] No.42149899{3}[source]
Um, is it okay to admit, as an "experienced" programmer, that I often resort to print statements? I mean, compilers are just so darn fast these days.

Another trick: for rare circumstances, code whatever complicated logic is needed to isolate the bug in order to issue a print statement, then use the debugger to break on that print statement.

138. srott ◴[] No.42149957{4}[source]
Only seen on some minor embeded systems but it’s not a big deal to compile gdb with tui support enabled.
139. havblue ◴[] No.42150045[source]
I like how gdb with qt creator works without any complicated configuration. You click on some breakpoints then hit play and the ide takes care of the rest.
replies(3): >>42150056 #>>42151074 #>>42151834 #
140. EasyMark ◴[] No.42150049[source]
ctrl+l is a must know for TUI stuff, including when vim messes up. that fixed so many mysterious "crashes" for me after I found out about it.
141. EasyMark ◴[] No.42150056{3}[source]
and drop down into gdb for complicated prints of variables and such
142. jll29 ◴[] No.42150238{4}[source]
Interesting. I had a similar experience: once the debugging instrumentation with #ifdef macros was switched off, the code that worked before suddenly crashed. In my situation it had to do with the stack, because my debugging macros used some local/"automatic" variables, and that had concealed the bug before in the DEBUG build.

One thing I also noticed is that using "problem-oriented" languages like Python or Java changes where you spend your time trouble-shooting: ironically, not where the problem is (business logic) anymore, those parts of the code indeed tend to work better, but intead you waste time with libraries (Java: CLASSPATH, Python: packages, all:version conflicts). In Contrast, in C/C++ it was mostly memory management errors and bugs in the actual business logic (the former is also a great distraction, somewhat diminished by the introduction of smart pointers).

replies(1): >>42150510 #
143. marssaxman ◴[] No.42150401[source]
How have I never heard of this before? Thank you.
144. malkia ◴[] No.42150510{5}[source]
At Google, had to do Java on borg, and used few times the "Cloud Trace" debugger (not sure how it was called), but it allowed you to watch multiple instances of your binary in production, and then add some isolated set of java statements around code blocks, this way you can say (somehow) - if you end up on this line, then "inject" (somehow) something to log out... and then you can add whatever you want to be logged (like arguments, variables around, etc.).

But then later it got scrapped, or something like it.

Cloud "debugging" when you have multiple instances is one of the cases where there is no suitable enough debugger (yet).

145. skirge ◴[] No.42150524[source]
pwndbg, gef, edb
146. levzettelin ◴[] No.42150530[source]
Is this using vscode's DAP under the hood?
replies(1): >>42156982 #
147. skirge ◴[] No.42150533[source]
gef has tmux support so program's output goes to other tmux pane
148. mark_undoio ◴[] No.42150570{4}[source]
If you use a time travel debugger (rr-project.org, undo.io - where I work, or Microsoft's WinTTD) you can generally just record an application to a file and debug it (with full fidelity) somewhere else.

And you don't need a full debugger setup on the target machine, just the recorder binary.

Gives you the possibility to have a proper debug experience without having to set up debugging that somehow works in a live k8s pod, or connects through special firewall holes or somesuch.

149. rty32 ◴[] No.42150865{4}[source]
In theory, yes, but in practice, people who know how to compile gdb is a small subset of people who need to debug c code.

Not to mention that it actually takes extra time to do so, when people are used to debug Python/JavaScript/Go code with one single click these days.

replies(1): >>42153622 #
150. malkia ◴[] No.42151006{4}[source]
Reminds of SmallTalk / and Lisp's - https://en.wikipedia.org/wiki/Common_Lisp_Interface_Manager

There was even a story, that (at least for Common Lisp), you can start from almost blank state, but have an exception handler installed (that can continue), so as you go you live-edit and add pieces missing, or if code crashes change.

This is all good, until nowadays, where you really want to know what's deployed in production, and not just the last stuff I've live fixed.

I mean, I guess both have values tbh, but hard to pull two models like this and use... bit like - debugger or printf statements (or both!)

151. dgfitz ◴[] No.42151058[source]
As long as you have gdbserver running on the remote end, no?
replies(1): >>42155153 #
152. dgfitz ◴[] No.42151074{3}[source]
Qtcreator is phenomenal. I don’t like using anything else if possible.
153. a_e_k ◴[] No.42151135{3}[source]
The big ones for me with log/printf debugging are:

- I can get a good idea of the temporal behavior of the program, and I can just scroll up to see earlier state, rather than having to restart the program in the debugger. (I know that "time travel" debuggers exist, but I've found them finicky.) I can scrub back and forth through time just by scrolling.

- I can compare runs by diffing the logs. Sometimes that alone is enough to show where things start going amiss. Or I can keep instrumented logs from baseline runs.

- If there's a personally useful set of printf statements in an area that I'm in a lot, I can save those off to a patch file or a local branch. I don't have to reapply my breakpoints / watchpoints in the debugger each time. Easy persistence.

(That said, I do like to start with a debugger when tackling reproducible crashes.)

154. alfiedotwtf ◴[] No.42151188[source]
Thanks to all the replies… ok, looks like I’m going to have another go at debugging!
155. b5n ◴[] No.42151565[source]
Personally I prefer cli over tui, but you can just toss something like this in a `.gdbinit`:

  tui new-layout default regs 1 {-horizontal src 1 asm 1} 2 status 0 cmd 1
  tui layout default
  tui enable
156. JNRowe ◴[] No.42151688{4}[source]
Might not be as direct as you'd like, but all well managed¹ GNU projects ship a NEWS file in their tarball. In this case you can also read it from savannah² without fetching the tarball.

¹ https://www.gnu.org/prep/standards/standards.html#NEWS-File

² https://svn.savannah.gnu.org/viewvc/ddd/trunk/doc/NEWS?view=...

157. IshKebab ◴[] No.42151834{3}[source]
VSCode's built in debug interface is also pretty great. I use it with the CodeLLDB extension and LLDB.

I don't really understand why people would use a separate debugger to the one that their IDE has. Most IDEs have solid debugger interfaces.

158. sfink ◴[] No.42152353{4}[source]
Which is why a good reversible debugger is so powerful. (I use rr-project.org and Pernosco but I imagine undo.io is similar.) Don't worry about stopping at the right point. Go back to the critical points over and over again, and go backwards to what generated an input. If you like logs, the debugger has facilities for generating tailored ones. Or manually generate your own debugging session log trail, generating entries throughout the execution in any order, and see them in execution order.
159. dsp_person ◴[] No.42152454[source]
I've been writing C code a lot more like scripting after familiarizing with how easy it is to use gdb compared to jumping through hoops say in vscode to setup a new build target for every new C file I want to mess with.

Just write `test_x.c`, `gcc -o test_x test_x.c -g`, and `gdb --args ./test_x --blah --blah` allows for much faster iteration on things.

PLUS the gdb commands end up far easier and more powerful to probe things than mess with the GUI most of the time.

160. smw ◴[] No.42152657{3}[source]
Try Jetbrains CLion
161. arunc ◴[] No.42153424[source]
Long time gdb TUI user, migrated to VSCode recently. Haven't looked back. Occasionally I do use TUI to look at the disassembly.
162. billfruit ◴[] No.42153573[source]
gud-gdb frontend inside Emacs is quite convenient and easy to use.
163. Gormo ◴[] No.42153622{5}[source]
Just grabbed the source, and it's a pretty bog standard ./configure ; make. Simple build instructions in the readme. Not sure this is a daunting challenge for any even moderately skilled developer.
replies(2): >>42155825 #>>42156098 #
164. asyx ◴[] No.42155153{3}[source]
This is usually not how wsl stuff is implemented. Usually applications set up the Windows to WSL communication themselves including Microsoft products. Might be different in this case of course but then the experience would be a lot less smooth than what Microsoft themselves set as the default with the VSCode remote extension.
replies(1): >>42157222 #
165. sourcepluck ◴[] No.42155589[source]
The GNU project (and RMS) seem to get a lot of meme-ridicule, but GDB is a powerhouse. I've only had occasion to mess with it a little, but it seems to have had such a huge impact on people's development work over the years.
replies(1): >>42155682 #
166. pipes ◴[] No.42155682[source]
Genuine question what does gnu get ridiculed for?
replies(1): >>42155821 #
167. sourcepluck ◴[] No.42155821{3}[source]
The GNU/Linux copypasta thing which is all over reddit all the time, for example. Saying the software is "bloated" is another trope. Thirdly, a suggestion that it (GNU, free software) is all very impractical or "backward". I guess in general a feeling that it's not "cool" or "hip", maybe?

I don't know, it seems very common to me. Have you not seen anything like that?

replies(2): >>42155848 #>>42159704 #
168. desdenova ◴[] No.42155825{6}[source]
Most people who use C nowadays are students, not "moderately skilled developers".

Students barely know how to manually put together a Makefile.

replies(2): >>42156666 #>>42187337 #
169. spamatica ◴[] No.42155848{4}[source]
I must be checking the wrong forums. Never seen it.
replies(1): >>42156088 #
170. howtofly ◴[] No.42155852[source]
I've used classic eclipse-cdt for over a decade until it cannot keep up with post-C++14 standards. It seems that it recently regains activity with the introduction of https://github.com/ghentschke/eclipse-cdt-lsp
171. howtofly ◴[] No.42155917{3}[source]
> I wonder what makes our experiences so different? Do you unit test a lot? Particularly with TDD? I am guessing that this practice means I just don't get to see a lot of the bugs that a debugger would help me with.

Debugger helps a lot when performing TDD. You will enjoy setting a breakpoint to check whether a line is hit as expected by a test case.

172. 9dev ◴[] No.42155951{7}[source]
I mean sure, logging metadata is better than nothing. But that’s akin to saying you don’t need a car because your feet have never failed you at crossing distances. Yes, you need to learn driving first, and that can seem hard at the beginning, but I doubt you’d want to go back to walking after.

To each their own, but I wholeheartedly recommend learning about debuggers. It should be one of the core tools of every software engineer.

173. sourcepluck ◴[] No.42156088{5}[source]
Ok, that's interesting to hear. More reason to spend (even) less time on Reddit and Youtube, I suppose, which is probably where I've been over-exposed to these sorts of points.
174. TeMPOraL ◴[] No.42156098{6}[source]
Where? How?

Last time I tried to build GDB from source, which was some two months ago, it wasn't in any way simple. GDB comes embedded in some GNU binutils repo, instructions to build it in isolation weren't obvious.

I ended up creating a new VM with a more recent Linux distro, that came with newer GDB, and migrating everything I'm working on to it, because that was much easier than building GDB from source.

replies(2): >>42156491 #>>42187304 #
175. idahoduncan ◴[] No.42156144[source]
dape ( https://github.com/svaante/dape# ) is a great option for languages with debuggers implementing the Debug Adapter Protocol. Combined with debugpy it's killed M-x pdb for me, and has a very similar UI to M-x gdb.
176. TeMPOraL ◴[] No.42156264{3}[source]
You can trivially add printf-like statements on the fly with debuggers; with GDB, one method I often use is the ability to attach commands to breakpoints, to be executed when the breakpoint is hit.

  break SourceFile.cpp:123
  command
    pp var1
    pp var2
    continue
  end
With that `continue` at the end there, this breakpoint will not pause execution (except to run the commands).
177. ink_13 ◴[] No.42156491{7}[source]
The GDB source is available as a standalone package: https://www.sourceware.org/gdb/download/
178. dahart ◴[] No.42156666{7}[source]
As long as the number of programmers is growing rapidly, it’s likely that most people who use any language are probably students. The distribution automatically skews toward beginner.

That has no bearing on whether we should have good tools for skilled developers, including debuggers & makefiles & source distributions. Eventually, students become moderately skilled. And we used gdb in class when I was a student.

replies(1): >>42180991 #
179. epasveer ◴[] No.42156982[source]
No it is not.

It's using gdb's "mi" mode.

180. epasveer ◴[] No.42157031[source]
Hi, Seergdb author here.

Thanks for your honest review. Can you explain more about not being able to set the editor font? My tests show that as working. Make sure to "Save Configuration..." to make things permanent.

Also, for the "show variable value on hover", I'll test it.

Can you (or others) create an issue on my github page for any bugs or feature requests?

Thanks.

replies(1): >>42189741 #
181. Jach ◴[] No.42157075[source]
For me it reminds me of Insight, which was my favorite GDB front-end and worked great on Windows back in the cygwin era. Unfortunately it's definitely no longer maintained. https://sourceware.org/insight/screenshots.php (Well, I guess someone did rescue it to put it on github and do some work: https://github.com/antony-jr/insight )
182. dgfitz ◴[] No.42157222{4}[source]
I keyed off “Linux and/or wsl” specifically. I didn’t know wsl had that interoperability cooked in, I would have assumed the vm still needed gdbserver running in order to connect for a “remote” debug session.
183. pipes ◴[] No.42159704{4}[source]
People on Reddit have call bin utils and core utils bloated? I sort of assumed we all just took those for granted as rock solid and the reason that we can have a free Unix operating system. Huh. Maybe I'm wrong though. What subreddits are saying this? Again, genuine question, I think I must be getting old!
replies(1): >>42187387 #
184. pabs3 ◴[] No.42179165{3}[source]
Debuggers can do printf debugging too with tracepoints.
185. TeMPOraL ◴[] No.42180991{8}[source]
> That has no bearing on whether we should have good tools for skilled developers, including debuggers & makefiles & source distributions.

Unfortunately, it's also the best explanation as for why we don't have them in practice, and why all software seems perpetually developed by fresh juniors (because it is).

replies(1): >>42189014 #
186. Gormo ◴[] No.42187304{7}[source]
I'm not sure where you've been looking, but source tarballs have been available from both gnu.org and the GDB website for over 20 years, with every major release going back 30 years available for download.
187. Gormo ◴[] No.42187337{7}[source]
> Most people who use C nowadays are students, not "moderately skilled developers".

That seems a very dubious claim, especially since most students begin with Python or JS. Do you have any data to back that up?

188. sourcepluck ◴[] No.42187387{5}[source]
I'm not on Reddit these days, and haven't been in a year or so maybe, so couldn't show you anything more than what you could find with a quick search on maybe r/linux or similar heavily populated subreddits related to these things.

I saw this comment yesterday and thought of this discussion though, maybe it helps illustrate what I was trying to say? https://news.ycombinator.com/item?id=42170536

The point being made in the comment linked to, briefly, is how non-SW engineers "turn their nose up at open-source solutions". It's a bit broader than what I was saying, but was roughly the kind of trend I was trying to allude to.

189. dahart ◴[] No.42189014{9}[source]
I don’t quite understand where this is going nor why. This little sub-thread stemmed from a good tool that does already exist, and from unsubstantiated claims that C devs are students and that the simple build steps are too hard for most people. Sure, a lot of software is written by junior devs but that has no bearing on whether gdb exists, or even how hard it is to build. We have lots of good debuggers, and luckily it only takes a few experts to write them, which is why we do have them in practice.
replies(1): >>42191373 #
190. badsectoracula ◴[] No.42189741{3}[source]
I submitted a bug report for the font:

https://github.com/epasveer/seer/issues/265

replies(1): >>42208605 #
191. TeMPOraL ◴[] No.42191373{10}[source]
> This little sub-thread stemmed from a good tool that does already exist, and from unsubstantiated claims that C devs are students and that the simple build steps are too hard for most people.

It's next to impossible to properly source any claim in this area; as for a lighter standard of substantiation, C wasn't a big deal in university courses 15 years ago, so it's unlikely to suddenly become it now.

N=1, but back then, between C++ and Java courses jumping straight to IDEs (to focus on language instead of build steps), and Unix/C course sticking to direct calls to GCC, at least my year at my uni managed to go through 5 years without much exposure to make and Makefiles...

Anyway,

> Sure, a lot of software is written by junior devs but that has no bearing on whether gdb exists, or even how hard it is to build.

But it does have a bearing on GDB evolution and GDB GUIs, which almost universally expose less than the bare minimum of useful GDB features; of those that expose more, I'm yet to find one that works.

> We have lots of good debuggers, and luckily it only takes a few experts to write them, which is why we do have them in practice.

Well, yes. WinDbg, that debugger in Visual Studio, etc. :). GDB, too.

My point here is that, for better or worse, size and type of the target audience determines how much and what kind of attention the project gets. "Skilled, experienced developers" are a small niche; the vast majority of developers are fresh juniors (per the growth argument), creating pressure to satisfy them at their level. Which, for GCC, I guess it means the build steps remain arcane even relative to other GNU projects, and powerful GUI frontends for it are not a thing.

192. epasveer ◴[] No.42208605{4}[source]
Thanks. I see it. I also added a bug report for the janky "show variable value" on mouse over.