C++ – Match source code with disassembled code

Match source code with disassembled code… here is a solution to the problem.

Match source code with disassembled code

As part of my work, I often need to analyze non-reproducible retail crashes with/without core dumps. I am generally equipped

  1. Call Stack, registry information in case of crash, signal information
  2. The module is actually loaded
  3. Match the source code

Generally, according to the offset, the disassembly is generated through objdump to calculate the failed instruction (machine code/sink code).

The next job is tedious. I tried mapping the failed instruction to the actual source location. This is time-consuming and painful. Is there an easy, easy way to map source code to failed instructions?

I

tried using the assembly source with the gcc -S option, but I can’t map the source efficiently. I usually can’t find a logical way to map the assembly output with the crash offset of the source.

Please suggest a recommended method.

Solution

Create your retail code with debug information enabled, then delete it before shipping, but keep it yourself. You can then use your copy to analyze the core dump.

Related Problems and Solutions