views:

352

answers:

4
+1  Q: 

PPC breakpoints

How is a breakpoint implemented on PPC (On OS X, to be specific)?

For example, on x86 it's typically done with the INT 3 instruction (0xCC) -- is there an instruction comparable to this for ppc? Or is there some other way they're set/implemented?

A: 

I'm told by a reliable (but currently inebriated, so take it with a grain of salt) source that it's a zero instruction which is illegal and causes some sort of system trap.

EDIT: Made into community wiki in case my friend is so drunk that he's talking absolute rubbish :-)

paxdiablo
Answers provided by inebriated sources should be marked community wine
Vinko Vrsalovic
A: 

Best guess is a 'tw' or 'twi' instruction.

You could dig into the source code of PPC gdb, OS X probably uses the same functionality as its FreeBSD roots.

HUAGHAGUAH
+3  A: 

Besides software breakpoints, PPC also supports hardware breakpoints, implemented via IABR (and possibly IABR2, depending on the core version) registers. These are instructions breakpoints, but there are also data breakpoints (implemented with DABR and, possibly, DABR2). If your core supports two sets of hardware breakpoint registers (i.e. IABR2 and DABR2 are present), you can do more than just trigger on a specific address: you can specify a whole contiguous range of addresses as a breakpoint target. For data breakpoints, you can also specify whether you want them to trigger on write, or read, or any access.

atzz