| 3323 | |
| 3324 | |
| 3325 | fmt::format_context::iterator fmt::formatter<HighLevelILInstruction>::format(const HighLevelILInstruction& obj, format_context& ctx) const |
| 3326 | { |
| 3327 | if (!obj.function) |
| 3328 | return fmt::format_to(ctx.out(), "<uninit>"); |
| 3329 | |
| 3330 | vector<InstructionTextToken> tokens; |
| 3331 | Ref<DisassemblySettings> settings = new DisassemblySettings(); |
| 3332 | vector<DisassemblyTextLine> lines = obj.function->GetExprText(obj, settings); |
| 3333 | if (!lines.empty()) |
| 3334 | { |
| 3335 | if (presentation == '?') |
| 3336 | { |
| 3337 | fmt::format_to(ctx.out(), "{} ", obj.operation); |
| 3338 | fmt::format_to(ctx.out(), "@ {:#x} ", obj.address); |
| 3339 | if (obj.exprIndex != BN_INVALID_EXPR && (obj.exprIndex & 0xffff000000000000) == 0) |
| 3340 | { |
| 3341 | fmt::format_to(ctx.out(), "[expr {}] ", obj.exprIndex); |
| 3342 | } |
| 3343 | if (obj.instructionIndex != BN_INVALID_EXPR && (obj.instructionIndex & 0xffff000000000000) == 0) |
| 3344 | { |
| 3345 | fmt::format_to(ctx.out(), "[instr {}] ", obj.instructionIndex); |
| 3346 | } |
| 3347 | Ref<Type> type = obj.GetType(); |
| 3348 | if (type) |
| 3349 | { |
| 3350 | fmt::format_to(ctx.out(), "[type: {}] ", type->GetString()); |
| 3351 | } |
| 3352 | } |
| 3353 | |
| 3354 | bool first = true; |
| 3355 | for (auto& line: lines) |
| 3356 | { |
| 3357 | if (!first) |
| 3358 | { |
| 3359 | fmt::format_to(ctx.out(), " ; "); |
| 3360 | } |
| 3361 | first = false; |
| 3362 | |
| 3363 | for (auto& token: line.tokens) |
| 3364 | { |
| 3365 | fmt::format_to(ctx.out(), "{}", token.text); |
| 3366 | } |
| 3367 | } |
| 3368 | } |
| 3369 | else |
| 3370 | { |
| 3371 | fmt::format_to(ctx.out(), "???"); |
| 3372 | } |
| 3373 | return ctx.out(); |
| 3374 | } |
nothing calls this directly
no test coverage detected