Last active
July 9, 2019 16:05
-
-
Save OwenChia/384cc1bd577a4832a8eae1826d50fb89 to your computer and use it in GitHub Desktop.
Permanently Change gef/pwndbg disassembly flavor from intel to att syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gef.py b/gef.py | |
index 13e26eb..2f189eb 100644 | |
--- a/gef.py | |
+++ b/gef.py | |
@@ -1160,6 +1160,7 @@ def capstone_disassemble(location, nb_insn, **kwargs): | |
capstone = sys.modules["capstone"] | |
arch, mode = get_capstone_arch(arch=kwargs.get("arch", None), mode=kwargs.get("mode", None), endian=kwargs.get("endian", None)) | |
cs = capstone.Cs(arch, mode) | |
+ cs.syntax = capstone.CS_OPT_SYNTAX_ATT | |
cs.detail = True | |
page_start = align_address_to_page(location) | |
@@ -8395,13 +8396,6 @@ if __name__ == "__main__": | |
# pretty print | |
gdb.execute("set print pretty on") | |
- try: | |
- # this will raise a gdb.error unless we're on x86 | |
- gdb.execute("set disassembly-flavor intel") | |
- except gdb.error: | |
- # we can safely ignore this | |
- pass | |
- | |
# SIGALRM will simply display a message, but gdb won't forward the signal to the process | |
gdb.execute("handle SIGALRM print nopass") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pwndbg/__init__.py b/pwndbg/__init__.py | |
index b6d5dac..bf51f8b 100755 | |
--- a/pwndbg/__init__.py | |
+++ b/pwndbg/__init__.py | |
@@ -148,12 +148,6 @@ handle SIGSEGV stop print nopass | |
for line in pre_commands.strip().splitlines(): | |
gdb.execute(line) | |
-# This may throw an exception, see pwndbg/pwndbg#27 | |
-try: | |
- gdb.execute("set disassembly-flavor intel") | |
-except gdb.error: | |
- pass | |
- | |
# handle resize event to align width and completion | |
signal.signal(signal.SIGWINCH, lambda signum, frame: gdb.execute("set width %i" % pwndbg.ui.get_window_size()[1])) | |
diff --git a/pwndbg/disasm/__init__.py b/pwndbg/disasm/__init__.py | |
index 42d4fe9..5d3cad3 100644 | |
--- a/pwndbg/disasm/__init__.py | |
+++ b/pwndbg/disasm/__init__.py | |
@@ -76,6 +76,7 @@ def get_disassembler_cached(arch, ptrsize, endian, extra=None): | |
mode |= CapstoneEndian[endian] | |
cs = Cs(arch, mode) | |
+ cs.syntax = CS_OPT_SYNTAX_ATT | |
cs.detail = True | |
return cs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment