Setbreakpointext

OllyDbg Plugin API

Setbreakpointext

Sets new INT3 breakpoint or changes type of existing breakpoint at specified address. Returns 0 on success and -1 on error (i.e. breakpoint was neither set nor restored). If bit TY_KEEPCOND in type is set, condition, explanation and expression associated with breakpoint (explained here) remain unchanged, otherwise they are removed. If bit TY_SETCOUNT is set or breakpoint is absent, sets specified pass count, otherwise pass count remains unchanged.

int Setbreakpointext(ulong addr,ulong type,uchar cmd,ulong passcount);

Parameters:

addr - address of breakpoint. If address points to data or in the middle of the command, OllyDbg will ask you for confirmation;

type - combination of bits TY_xxx that specify requested actions and type of breakpoint:

Flag Meaning
TY_ACTIVE Set permanent (user) breakpoint or restore disabled
TY_DISABLED Temporarily deactivate permanent breakpoint. If TY_ACTIVE and TY_DISABLED are set simultaneously, TY_DISABLED is ignored
TY_ONESHOT Set one-shot breakpoint that will be automatically removed when hit. Doesn't interfere with active breakpoint
TY_TEMP Set temporary breakpoint that will be automatically removed when hit. Execution continues automatically. TY_TEMP does not interfere with active breakpoint
TY_STOPAN Stop animation if breakpoint is hit
TY_KEEPCODE Force original command (parameter cmd)
TY_SETCOUNT Force pass count even if breakpoint already exists
TY_KEEPCOND Leave associated names of types NM_BREAK, NM_BREAKEXPR, NM_BREAKEXPL and NM_PLUGCMD unchanged. If this bit is not set, breakpoints of types TY_ACTIVE and TY_DISABLED clear these names

cmd - original command that will be saved to descriptor if bit TY_KEEPCODE is set. Otherwise, this parameter is ignored and command is read from the memory;

passcount - pass count, i.e. the number of times this breakpoint should be skipped. If breakpoint already exists and flag TY_SETCOUNT is not set, this parameter is ignored and pass count remains unchanged.

To set conditional breakpoint, consider use of Manualbreakpoint. If breakpoint must be set automatically (i.e. without user's interference), please do the following:

·If debugged program is still running, call Suspendprocess to make following operations atomic;

·Call Setbreakpointext(addr,TY_ACTIVE,0,passcount), thus setting INT3 breakpoint and related pass count. This is enough for ordinary (unconditional) breakpoint;

·If necessary, set condition by call to Insertname(addr,NM_BREAK,condition). This is enough for conditional breakpoint;

·To set conditional logging breakpoint, you must additionally prepare control byte, expression and explanation and set them calling Insertname(NM_BREAKEXPR) and Insertname(NM_BREAKEXPL);

·If necessary, resume execution (Go).

See also: Breakpoint functions, Manualbreakpoint, Setbreakpoint, Getbreakpointtypecount.