4 ms·
Drgn: A programmable C debugger, scriptable from Python
- KerrAvon 4y ago`lldb` also uses Python, and it’s insane. Nobody wants a language where whitespace is significant as a debugging extension language! It’s verbose and unpleasant and fiddly to write in a REPL.
- sidkshatriya 4y ago> Nobody wants a language where whitespace is significant as a debugging extension language! It’s verbose and unpleasant and fiddly to write in a REPL. You are correct about it being fiddly to write multi-line Python scripts at the REPL. However: - Modern python REPLs are really good. They auto-complete very well and suggest indentation when they recognise the syntax of the previous line: ``` $ python3 >>> for x in range(1, 10):<user presses enter key> ....<indentation is provided by REPL, note the "...."> ``` - Python indentation rules are quite simple once you get the hang of it - The issue with typing at the REPL is really more about remembering the syntax of various language statements rather than the white space rules of Python. This is a problem with using any (other language) like, say, Lua/Javascript at the REPL. - Most "scripts" at the REPL tend to be just a single line where you don't need to worry about whitespace indentation. When you have a long script then you simply run a program directly - Yes, Python scripting at the REPL is a bit more verbose than Javascript (for example). But most people can live with the extra characters and the verbosity makes it easier to understand what you meant a few REPL commands ago - The reason to use Python generally its insanely large ecosystem of software. The inconvenience of the white-space-significant aspect of language at the REPL is totally offset by that.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- throw827474737 4y ago> Nobody wants a language where whitespace is significant as a debugging extension language! Nobody just not true, and also overdramatizing at the whitespaces, lol. Taking the expressiveness over C anytime, and also over Javascrpt's uglyness and insanities. What's your fav then?
- pjmlp 4y agoGDB also uses Python for scripting, and Python is the official scripting language for the VFX and games industry (in what concerns tooling), all major products support it. A newcomer will have a hard time replacing it.
- BiteCode_dev 4y agoBecause Python has a long experience with REPL, the experience ends up being awesome. If you try iPython + a PYTHONSTARTUP script, it will be very hard to use anything else. And ipdb is a very good example of using a debugger that fully benefit from that. So it is entirely possible to have an exceptionnally good experience in a Python REPL, despite the significant whitespaces, but it does depend of the implementation.
- fmajid 4y agoGDB also uses Python
- dang 4y agoRelated: Drgn: How the Linux kernel team at Facebook debugs the kernel at scale - https://news.ycombinator.com/item?id=29537594 https://news.ycombinator.com/item?id=29537594 - Dec 2021 (125 comments)
- ot 4y agoThis talk has a very good hands-on demo of investigating a kernel bug with drgn: https://www.youtube.com/watch?v=ukxH_55BiQE https://www.youtube.com/watch?v=ukxH_55BiQE
- unnah 4y agoInteresting, apparently drgn doesn't even depend on existing debuggers like gdb or lldb. And since drgn uses debug information, it doesn't need any boilerplate to integrate with C code and data structures, which makes for even easier language integration than pybind11. Perhaps drgn could eventually become a replacement for pybind11?
- post-factum 4y agoI'm building a crash-like environment on top of drgn: https://codeberg.org/pf-kernel/crush https://codeberg.org/pf-kernel/crush
- sim7c00 4y agothis is pretty amazing tbh. scripting debuggers can be so tedious. i havemt tried it yet but this looks really sane and nice. thanks!