Skip to content

Instantly share code, notes, and snippets.

@brainsucker
Created July 29, 2012 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainsucker/3200260 to your computer and use it in GitHub Desktop.
Save brainsucker/3200260 to your computer and use it in GitHub Desktop.
metasm
module Metasm
# this class implements a high-level debugging API (abstract superclass)
class Debugger
class Breakpoint
attr_accessor :address,
# context where the bp was defined
:pid, :tid,
# bool: oneshot ?
:oneshot,
# current bp state: :active, :inactive (internal use), :disabled (user-specified)
:state,
# type: type of breakpoint (:bpx = soft, :hw = hard)
:type,
# Expression if this is a conditionnal bp
# may be a Proc, String or Expression, evaluated every time the breakpoint hits
# if it returns 0 or false, the breakpoint is ignored
:condition,
# Proc to run if this bp has a callback
:action,
# Proc to run to emulate the overwritten instr behavior
# used to avoid unset/singlestep/re-set, more multithread friendly
# may be a DecodedInstruction for lazy initialization, see Debugger#init_bpx/has_emul_instr(bpx)
:emul_instr,
# internal data, cpu-specific (overwritten byte for a softbp, memory type/size for hwbp..)
:internal,
# reference breakpoints sharing a target implementation (same hw debug register, soft bp addr...)
# shared is an array of Breakpoints, the same Array object in all shared breakpoints
# owner is a hash key => shared (dbg.breakpoint)
# key is an identifier for the Bp class in owner (bp.address)
:hash_shared, :hash_owner, :hash_key,
# user-defined breakpoint-specific stuff
:userdata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment