Skip to main content

Timeline for How does GDB pause an execution

Current License: CC BY-SA 4.0

10 events
when toggle format what by license comment
Jan 29, 2019 at 4:08 comment added jamesqf @Ben Voigt: Yes, I perhaps phrased it poorly. What I meant is that it isn't the actual machine registers being altered (since gdb is using them to run), but the thread/process state in memory.
Jan 27, 2019 at 21:34 history edited Erik Eidt CC BY-SA 4.0
added 128 characters in body
Jan 27, 2019 at 18:29 history edited Erik Eidt CC BY-SA 4.0
deleted 95 characters in body
Jan 27, 2019 at 17:10 comment added Ben Voigt @jamesqf: Describing that as a copy is a bit misleading. It's the official storage for the thread state while the thread isn't running.
Jan 27, 2019 at 6:10 comment added Erik Eidt @BenVoigt, agreed. though while debuggers can handle unlimited numbers of breakpoints, hardware can handle zero or a few, so the debugger has to do some juggling.
Jan 27, 2019 at 5:39 comment added Erik Eidt @jamesqf, yes, thx!
Jan 27, 2019 at 5:14 comment added jamesqf Re "If you alter the CPU registers..." in the last paragraph, I think you mean "If you alter the saved copy of the CUP registers..." Then when the OS resumes the process, that altered data is written back to the actual registers.
Jan 27, 2019 at 1:49 comment added Ben Voigt Well, most processor architectures support debug traps that for example trigger when the IP (instruction pointer) is equal to the address stored in a breakpoint register, saving the need to rewrite code. (By matching registers other than IP, you can get data breakpoints, and by trapping after every instruction, you can get single stepping) What you described is also possible of course, as long as the code isn't in a readonly memory.
Jan 27, 2019 at 1:25 history edited Erik Eidt CC BY-SA 4.0
added 123 characters in body
Jan 27, 2019 at 1:18 history answered Erik Eidt CC BY-SA 4.0