简体   繁体   中英

Debugging workflow aspects of Visual Studio development vs. “Linux” development?

OK, so there are numerous questions around, asking for a "Visual Studio equivalent on Linux" or a variation of this question. ( here , here , here , ...)

I would like to focus on one aspect and ask how the debugging workflow possibly differs on different systems, specifically the full-integrated-IDE approach used by Visual Studio (like) systems and a possibly more "separate" toolchain oriented approach.

To this end, let me present what I consider a short description of the "Visual Studio Debugging Workflow":

  • Given an existing project
  • I open up the project (one single step from a user perspective)
  • I navigate to the code I want to debug (possibly by searching of my project files, which is simply done by opening the Find in Files dialog box.)
  • I put a breakpoint at line (a), simply by putting the cursor on the line and hitting F9
  • I put a "tracepoint" at line (b), by adding a breakpoint there and then changing the breakpoint properties so that the debugger doesn't stop, but instead traces the value of a local variable.
  • I hit F5 , which automatically compiles my executable, starts it under the debugger and then I wait until the prg stops at (a), meanwhile monitoring the trace window for output of (b)
  • When the debugger finally stops at (a), my screen automatically shows me the following information in (one-time preconfigured windows) side-by-side at the same time :
    • Current call stack
    • values of the most recently changed local variables
    • loaded modules (DLLs)
    • a list of all active breakpoints with their locations
    • a watch window with the last watch expressions I entered
    • A memory window to examine raw memory contents
    • a small window displaying current register values

Plus/minus some features, this is what I would expect under Eclipse/CDT under Linux also. How would this workflow and presented information be retrieved when developing with VIM, Emacs, gdb/DDD and the likes?

This question isn't really about if some tool has one feature or not, it's about seeing that development/debugging work is using a combination of features and having a multitude of options available at your fingertips and how you access this information when not using a fully integrated IDE.

I think your answer isn't just about which software you use, but also what methodology you use. I use Emacs and depends on TDD for most of my debugging. When I see something fail, I usually write tests filling in the gap which I (obviously) have missed, and checks every expectation that way. So it goes far between each time I use the debugger.

When I do run into problems I have several options. In some cases I use valgrind first, it can tell me if there is some memory related problems right away, eliminating the need for the debugger. It will point straight to the line where i overwrite or delete memory that should be left alone. If I suspect a race condition valgrind is pretty good at that to.

When I use the debugger I often use it right in emacs, through GUD mode. It will give me a view with stack, local variables, the source code, breakpoints and a window where I can command the debugger. It usually involves setting a couple of breakpoints, watching some memory or some evaluation, and stepping through the code. It is pretty much like using the debugger in an IDE. The GDB debugger is a powerful beast, but my problems has never been large enough to need to invoke its power.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM