Where does the asm code during the debugging process in GDB come from?

Viewed 274

Basically, according to my knowledge,

If we use GDB to debug execute code compiled from C source code, compiler will leave the source code Path in the ELF/PE file, so GDB will use the source code to facilitate our debug process.

But how can GDB provide the asm code info in the above process? I give a example captured on my computer as below:

enter image description here

So my questions are:

  1. How GDB provide the asm code? Is this asm code generated by disassembly?
  2. If so, then how can GDB guarantee the disassembly accuracy? as I know that linear disassembly algorithm like OBJDUMP used can not distinguish data from code, commercial tool like IDA pro can also make mistake from time to time

Could anyone give me some help? Thank you!

1 Answers
Related