MCPcopy Index your code
hub / github.com/qilingframework/qiling / __setattr__

Method __setattr__

qiling/os/struct.py:118–133  ·  view source on GitHub ↗
(self, name: str, value: Any)

Source from the content-addressed store, hash-verified

116 return super().__getattribute__(name)
117
118 def __setattr__(self, name: str, value: Any) -> None:
119 # accessing a structure field?
120 if name in _fields:
121 field = cls.__dict__[name]
122 ftype = _fields[name]
123
124 # transform value into field bytes and write them to memory
125 fvalue = ftype(*value) if hasattr(ftype, '_length_') else ftype(value)
126 data = bytes(fvalue)
127
128 mem.write(address + field.offset, data)
129
130 # proceed to set the value to the structure in order to maintain consistency with ctypes.Structure
131
132 # set attribute value
133 super().__setattr__(name, value)
134
135 return VolatileStructRef()
136

Callers 2

__getattribute__Method · 0.45

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected