Uncategorized

Why there is less thing I can do in Rust debugging than in Python/C++ debugging? – Editors and IDEs


As is known by Python users, one can do many things when using ipdb to debug python.

But I found that when i am using gdb or some Rust-IDEs to debug Rust, I can do far less things on breakpoints(see examples below)which may certainly bring lots of inconvenience to Rust coding and debugging.

I want to know the reason(My misoperation or some theoretical reasons?)

I also raise a question about simliar problem on Stackoverflow: Edit – Stack Overflow

Thanks for your replying~

So,May I conclude that:

  • The debugging difference between Python and C++/Rust are almost equal to the debugging difference between interpreted languages and compiled languages
    • When I am using interpreted languages, surely there is more convenience while debugging.
  • But The debugging difference between C++ and Rust is from the current poor Rust support of debug tools
    • Maybe in the future Rust codes(even c++ codes) can be debugged more conveniently, but not now.

On the flip side, I can not write C++ w/o valgrind + gdb, but in Rust, println! + logging has been enough for everything I need. I.e. it is not clear to me effort spent on “better debugging” is better than spent on “reduce need for debugger / catch more at compile time”



2 Likes

Yeah I think that is the advantage of Rust, one can spend less time on manually solving memory problems which is unavoidable in other languages.

But in my daily works, memory management is not the main problem, the challenge is mainly about writing complicated codes to achieve various complex functions(or effect? Pls ignore my poor English)

So i …just cannot endure the inconvenience of using “println!”https://users.rust-lang.org/”debug!” and then compiling once to debug. Each time I do that, I miss the convenience of C++ debugging and Python ipdb, badly

Maybe Rust is not suitable for research works? I think…

There is GitHub – evcxr/evcxr , but I do not think “repl / interactive” driven development is the Rust way — and I used to use Clojure before Rust. :slight_smile:



2 Likes

Thanks, i will immediately try it out

This isn’t what you asked for, but I think this might be useful to you:

As a Python developer I can understand why you emphasise a great debugging experience when experimenting in Rust, because in any sufficiently large Python application, debugging is something we have to do a lot – because the debugger is the only place were we get to find out what is really happening behind the “it’s duck typed, don’t worry about it” facade and do things correctly.

In Rust, thanks to its strong type system, this is almost never necessary, even more so when not using unsafe, because so many mistakes are caught by the compiler. This is in extreme contrast to Python, where almost nothing is caught by the compiler.

Before you invest a lot of time and energy into replicating a Python-like debugging experience, try to write idiomatic, type-safe Rust code. You will notice that you almost never have to debug. I’ve been writing Rust professionally for a year now and I’ve yet to need a debugger.



1 Like



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *