34 ms·
Not mentioned: the collateral damage. You'll probably trash your debugger's object visualizer in doing this. And probably other facilities in your IDE that help
by dataflow 6y ago
Not mentioned: the collateral damage. You'll probably trash your debugger's object visualizer in doing this. And probably other facilities in your IDE that helps you deal with class members, really.
- stephc_int13 6y agoIn my opinion, when you're serious about debugging your code, you'll use your own debugging tools, and from experience I'd say that using handles is not an issue. But yeah, standard IDEs won't see anything behind the opaque reference.
- dataflow 6y ago> In my opinion, when you're serious about debugging your code, you'll use your own debugging tools So what does this mean about my past debugging experiences? And and those of everyone else who uses an IDE? They've been jokes all along?
- seibelj 6y agoI find print debugging to be fine. Unless we are talking Java - coding in that requires the IntelliJ command center.
- stephc_int13 6y agoI think this is highly context dependent. I've worked in fields where no debugger where available, not even printf. (embedded software, interrupt driven) I had to write ad-hoc debugging tools with difficult contraints. I grew the habit of debugging by reading the code first, then using traces, then writing custom tests or ad-hoc tools as last resort solution. (extremely rare) I used Visual Studio debugger and GDB a few times, but I've not been convinced by the productivity gains, quite the contrary, but I am probably not using them well. In practice, the most difficult bugs are often tied to concurrency issues, and I haven't found much help with those general purpose tools.
- dataflow 6y agoI mean, these are orthogonal, not mutually exclusive. You need to use whatever combination of tools makes sense for your tasks. Sometimes it's a debugger, sometimes it's printf, sometimes it's a hard reboot, sometimes it's an infinite loop, etc... and sometimes there just isn't any great solution. Nobody was suggesting you have to use a debugger everywhere or that a debugger is the solution to every problem. Just like none of the solutions you mentioned is. I'm just saying if you are using a debugger/IDE (which I can assure people use quite seriously, even if you don't come across such situations personally), then you might want to watch out for the repercussions.
- nicetryguy 6y agoMmhmm... What debugging tools have you written?
- yellowapple 6y agoI'm already having to write my own operating system, CPU architecture, and programming language in order to do "Hello world" the "serious" way, and now you want me to write my own debugger, too?
- adrift 6y agoWhat's not to like?
- bentcorner 6y agoI haven't thought this through totally but you can write visualizers in VS[1]. I don't know if it'd work but there's a fair amount of power in natvis expressions. [1] https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2019 https://docs.microsoft.com/en-us/visualstudio/debugger/creat...)
- dataflow 6y agoI do write natvis but it seems to be based on the assumption that the object (+ globals) are sufficient for displaying the data. Which isn't the case if your handle is an index into some other object/array at a random place in memory (unless you make the array a global).
- rini17 6y agoThis is not unsolvable problem. In the simplest case you can (in debug build) add private pointer to actual object to the handle structure. If you're doing something more complicated..then you presumably know what you're doing and the debugging strategies/tradeoffs.
- dataflow 6y agoYeah I didn't mean it was unsolvable, I just meant this is something you'll want to consider in the process and adjust accordingly.