| 3171 | |
| 3172 | |
| 3173 | fmt::format_context::iterator fmt::formatter<MediumLevelILInstruction>::format(const MediumLevelILInstruction& obj, format_context& ctx) const |
| 3174 | { |
| 3175 | if (!obj.function) |
| 3176 | return fmt::format_to(ctx.out(), "<uninit>"); |
| 3177 | |
| 3178 | vector<InstructionTextToken> tokens; |
| 3179 | #ifdef BINARYNINJACORE_LIBRARY |
| 3180 | bool success = obj.function->GetExprText(obj.function->GetFunction(), obj.function->GetArchitecture(), obj, tokens, new DisassemblySettings()); |
| 3181 | #else |
| 3182 | bool success = obj.function->GetExprText(obj.function->GetArchitecture(), obj.exprIndex, tokens); |
| 3183 | #endif |
| 3184 | if (success) |
| 3185 | { |
| 3186 | string text; |
| 3187 | if (presentation == '?') |
| 3188 | { |
| 3189 | fmt::format_to(ctx.out(), "{} ", obj.operation); |
| 3190 | fmt::format_to(ctx.out(), "@ {:#x} ", obj.address); |
| 3191 | if (obj.exprIndex != BN_INVALID_EXPR && (obj.exprIndex & 0xffff000000000000) == 0) |
| 3192 | { |
| 3193 | fmt::format_to(ctx.out(), "[expr {}] ", obj.exprIndex); |
| 3194 | } |
| 3195 | if (obj.instructionIndex != BN_INVALID_EXPR && (obj.instructionIndex & 0xffff000000000000) == 0) |
| 3196 | { |
| 3197 | fmt::format_to(ctx.out(), "[instr {}] ", obj.instructionIndex); |
| 3198 | } |
| 3199 | Ref<Type> type = obj.GetType(); |
| 3200 | if (type) |
| 3201 | { |
| 3202 | fmt::format_to(ctx.out(), "[type: {}] ", type->GetString()); |
| 3203 | } |
| 3204 | } |
| 3205 | |
| 3206 | for (auto& token: tokens) |
| 3207 | { |
| 3208 | fmt::format_to(ctx.out(), token.text); |
| 3209 | } |
| 3210 | } |
| 3211 | else |
| 3212 | { |
| 3213 | fmt::format_to(ctx.out(), "???"); |
| 3214 | } |
| 3215 | return ctx.out(); |
| 3216 | } |
nothing calls this directly
no test coverage detected