Live data from Hacker News

“We didn't chase the fad of using every Intel CPU feature”

marc.info

31–35 of 35 posts

Re: “We didn't chase the fad of using every Intel CPU feature”

#31
post #9
post #4

This seems a bit too self-congratulatory to be technically meaningful. What feature did they not use? From the thread history, it sounds like they provided no way for a userspace debugger to (ask the kernel to) set a hardware breakpoint on a section of memory. That means that when you use gdb and set a single breakpoint on some instruction, gdb must instead fall back on single-stepping the entire program until it get…

I think the hardware breakpoint support is for breaking on memory accesses to a particular address. Setting a breakpoint on the execution of a particular opcode at a particular address is easier and can be done by just swapping in an "INT 3" instruction at the particular point with no overhead.

Hardware breakpoint support is also for execution and, oddly, the x86 IO port space reachable by the "in" and "out" instructions.

Using an int3 has some problems. It can be seen by the code, which may change behavior. For example, a self-checksum would fail. The int3 will affect all threads, while the hardware breakpoint can be made to affect just one thread.

Re: “We didn't chase the fad of using every Intel CPU feature”

#33
post #4

This seems a bit too self-congratulatory to be technically meaningful. What feature did they not use? From the thread history, it sounds like they provided no way for a userspace debugger to (ask the kernel to) set a hardware breakpoint on a section of memory. That means that when you use gdb and set a single breakpoint on some instruction, gdb must instead fall back on single-stepping the entire program until it get…

Am I misreading this or are you saying that without hardware breakpoints you have to single step all the way through the program to the breakpoint location?

If so: that's a surprising and weird thing to say. Without hardware breakpoints, userspace debuggers work by overwriting the instruction at the target with an interrupting instruction, and then restoring it before resuming.

I'm trying to imagine how gdb breakpoints in OpenBSD would even work if they required single-stepping whole programs.

Re: “We didn't chase the fad of using every Intel CPU feature”

#34
post #33
post #4

This seems a bit too self-congratulatory to be technically meaningful. What feature did they not use? From the thread history, it sounds like they provided no way for a userspace debugger to (ask the kernel to) set a hardware breakpoint on a section of memory. That means that when you use gdb and set a single breakpoint on some instruction, gdb must instead fall back on single-stepping the entire program until it get…

Am I misreading this or are you saying that without hardware breakpoints you have to single step all the way through the program to the breakpoint location? If so: that's a surprising and weird thing to say. Without hardware breakpoints, userspace debuggers work by overwriting the instruction at the target with an interrupting instruction, and then restoring it before resuming. I'm trying to imagine how gdb breakpoin…

Yes, you read what I said correctly, and I was wrong as others pointed out (I blame a lack of coffee).

Re: “We didn't chase the fad of using every Intel CPU feature”

#35
post #34
post #33

Earlier quoted context omitted.

Am I misreading this or are you saying that without hardware breakpoints you have to single step all the way through the program to the breakpoint location? If so: that's a surprising and weird thing to say. Without hardware breakpoints, userspace debuggers work by overwriting the instruction at the target with an interrupting instruction, and then restoring it before resuming. I'm trying to imagine how gdb breakpoin…

Yes, you read what I said correctly, and I was wrong as others pointed out (I blame a lack of coffee).

I did pick just about the jerkiest way possible to preen about knowing how to implement a software breakpoint, didn't I? Sorry about that.
Post reply on HN