Dump this hole as a call to a patch_* function.
(self, where: str)
| 172 | self.func = _PATCH_FUNCS[self.kind] |
| 173 | |
| 174 | def as_c(self, where: str) -> str: |
| 175 | """Dump this hole as a call to a patch_* function.""" |
| 176 | if self.custom_location: |
| 177 | location = self.custom_location |
| 178 | else: |
| 179 | location = f"{where} + {self.offset:#x}" |
| 180 | if self.custom_value: |
| 181 | value = self.custom_value |
| 182 | else: |
| 183 | value = _HOLE_EXPRS[self.value] |
| 184 | if self.symbol: |
| 185 | if value: |
| 186 | value += " + " |
| 187 | if self.symbol.startswith("CONST"): |
| 188 | value += f"instruction->{self.symbol[10:].lower()}" |
| 189 | else: |
| 190 | value += f"(uintptr_t)&{self.symbol}" |
| 191 | if _signed(self.addend) or not value: |
| 192 | if value: |
| 193 | value += " + " |
| 194 | value += f"{_signed(self.addend):#x}" |
| 195 | if self.need_state: |
| 196 | return f"{self.func}({location}, {value}, state);" |
| 197 | return f"{self.func}({location}, {value});" |
| 198 | |
| 199 | |
| 200 | @dataclasses.dataclass |
no test coverage detected