07-24-2023, 12:18 PM
As I was learning about assembly, I used GDB the following way:
<!-- language: none -->
gdb ./a.out (a is a compiled C script that only prints hello world)
break main
run
info registers
Why can I see the registers used by my program when I am myself using the same CPU to print the registers? Shouldn't the use of GDB (or operating system) overwrite the registers and only show me the overwritten registers?
The only answer I can think of is the fact that my CPU is dual-core and that one of the cores is being used and the other is kept for the program.
<!-- language: none -->
gdb ./a.out (a is a compiled C script that only prints hello world)
break main
run
info registers
Why can I see the registers used by my program when I am myself using the same CPU to print the registers? Shouldn't the use of GDB (or operating system) overwrite the registers and only show me the overwritten registers?
The only answer I can think of is the fact that my CPU is dual-core and that one of the cores is being used and the other is kept for the program.