I don't use SO for bugs very often. The main use case is getting example syntax for something I know I want to do, but dont know off hand.
sort dataframe on column pandas
(actually interesting, google gives me the `DataFrame.sort_values` documentation page as the first hit for that one, SO is second but you get the idea)
Answer: read the code, step through it on paper, use a debugger and read the documentation related to environment. Even now it is fairly easy to find circumstances where SO, or the web in general, gives no help if you stray outside of common languages or technology.
PS Good advice is - there is nothing wrong with the compiler!
A combination of thorough logging throughout the codebase at various levels of detail, one off print statements, then once it's narrowed down to a specific chunk of code reading it intently and finally if that doesn't work fire up a debugger and step through it.
Same way I do now: Logs, printf statements, debuggers, failed assertions, stack traces. That'll at least get me to the part of the code where the problem exists. I actually don't use SO much.
Books. We used to have a huge library were I worked, with a couple full time librarians on staff. This was before Google showed up. After Google everything changed.