Visual Studio Code breakpoint appearing in wrong place

To answer this for any particular case, one would need the launch.json configuration being used, and the source folder structure, at minimum. I have a true story from just last week to illustrate why: Background I recently inherited a relatively small Vue project, and immediately encountered the same problem. Breakpoints in VSCode were “jumpy” in … Read more

How to debug Haskell code?

The GHCi option -fbreak-on-exception can be useful. Here’s an example debugging session. First we load our file into GHCi. $ ghci Broken.hs GHCi, version 7.0.2: http://www.haskell.org/ghc/ 😕 for help Loading package ghc-prim … linking … done. Loading package integer-gmp … linking … done. Loading package base … linking … done. Loading package ffi-1.0 … linking … Read more

How to check release / debug builds using cfg in Rust?

You can use debug_assertions as the appropriate configuration flag. It works with both #[cfg(…)] attributes and the cfg! macro: #[cfg(debug_assertions)] fn example() { println!(“Debugging enabled”); } #[cfg(not(debug_assertions))] fn example() { println!(“Debugging disabled”); } fn main() { if cfg!(debug_assertions) { println!(“Debugging enabled”); } else { println!(“Debugging disabled”); } #[cfg(debug_assertions)] println!(“Debugging enabled”); #[cfg(not(debug_assertions))] println!(“Debugging disabled”); example(); } … Read more

How can I make gdb save the command history?

Short answer: mkdir -p ~/.config/gdb echo ‘set history save on’ >> ~/.config/gdb/gdbinit Long answer: Command history is covered in the GDB manual, 22.3 Command History. Create a file $HOME/.config/gdb/gdbinit, and add the following line: set history save on You can set the number of past commands saved with the following. The command is described as … Read more

How to debug Greasemonkey script with the Firebug extension?

Updatier: The Mene+Shuman fix now is busted with Firefox 30 and Firebug 2. Firefox 31 may provide workarounds (will investigate). In the meantime, use the “General workaround strategies” listed below. Update: This answer is now obsolete. If you open about:config and set extensions.firebug.filterSystemURLs to false then you can use Firebug to debug the Greasemonkey script … Read more

JSP debugging in IntelliJ IDEA

For JSP debugging in Intellij there are some configurations that must be in order. The fact that Intellij always allows you to add a breakpoint on a JSP line does not necessarily imply that you’ve configured JSP debugging. In the following I refer to Intellij 8 configuration, w.r.t. previous versions you will need to do … Read more

How do I use PDB files

PDB files map an assembly’s MSIL to the original source lines. This means that if you put the PDB that was compiled with the assembly in the same directory as the assembly, your exception stack traces will have the names and lines of the positions in the original source files. Without the PDB file, you … Read more