You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Instruction.ToString() formats the instruction with default formatter options. To customize we currently have to write many lines of code. Plus we have to create a custom FormatOutput class. While this can be useful in many cases its cumbersome when performance doesn't matter.
Alternatively a new method FormatToString() for the formatter classes which at least removes the step of creating a formatoutput class ourselves. Edit: To clarify we can use the StringOutput. But if you want to output multiple instructions from multiple places you would either have to call Reset all the time or create multiple StringOutput etc. which is what I meant with cumbersome
This request is for C#
The text was updated successfully, but these errors were encountered:
Sounds reasonable. The Python code already supports this where you can pass in extra formatter args. A new ToString(string) method would be needed in C# to do something similar.
# ====== =============================================================================
# F-Spec Description
# ====== =============================================================================
# f Fast formatter (masm-like syntax)
# g GNU Assembler formatter
# i Intel (XED) formatter
# m masm formatter
# n nasm formatter
# X Uppercase hex numbers with ``0x`` prefix
# x Lowercase hex numbers with ``0x`` prefix
# H Uppercase hex numbers with ``h`` suffix
# h Lowercase hex numbers with ``h`` suffix
# r RIP-relative memory operands use RIP register instead of abs addr (``[rip+123h]`` vs ``[123456789ABCDEF0h]``)
# U Uppercase everything except numbers and hex prefixes/suffixes (ignored by fast fmt)
# s Add a space after the operand separator
# S Always show the segment register (memory operands)
# B Don't show the branch size (``SHORT`` or ``NEAR PTR``) (ignored by fast fmt)
# G (GNU Assembler): Add mnemonic size suffix (eg. ``movl`` vs ``mov``)
# M Always show the memory size (eg. ``BYTE PTR``) even when not needed
# _ Use digit separators (eg. ``0x12345678`` vs ``0x1234_5678``) (ignored by fast fmt)
# ====== =============================================================================
new ToString method would be a solution but setting the default formatter allows things like binding in WPF without an additional property or custom converter.
Like a static property we can override:
Iced.Intel.Formatter.Default = new MasmFormatter(...)
and the existing ToString() just uses Iced.Intel.Formatter.Default then.
Currently
Instruction.ToString()
formats the instruction with default formatter options. To customize we currently have to write many lines of code. Plus we have to create a customFormatOutput
class. While this can be useful in many cases its cumbersome when performance doesn't matter.Alternatively a new method FormatToString() for the formatter classes which at least removes the step of creating a formatoutput class ourselves. Edit: To clarify we can use the StringOutput. But if you want to output multiple instructions from multiple places you would either have to call Reset all the time or create multiple StringOutput etc. which is what I meant with cumbersome
This request is for C#
The text was updated successfully, but these errors were encountered: