Method: Rex::Poly::Machine#variable_value
- Defined in:
- lib/rex/poly/machine/machine.rb
#variable_value(name, size = nil) ⇒ Object
Resolve a variable name into its currently assigned register value.
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/rex/poly/machine/machine.rb', line 456 def variable_value( name, size=nil ) # Sanity check we this variable has been created if( not @variables.has_key?( name ) ) raise RuntimeError, "Unknown register '#{name}'." end # Pull out its current register value if it has been assigned one regnum = @variables[ name ] if( not regnum ) regnum = @reg_available.pop if( not regnum ) raise RuntimeError, "Unable to assign variable '#{name}' a register value, none available." end # and add it to the consumed list so we can track it later @reg_consumed << regnum # and now assign the variable the register @variables[ name ] = regnum end # resolve the register number int a string representation (e.g. 0 in x86 is EAX if size is 32) return _register_value( regnum, size ) end |