From f7cacf7fd58f79ff3ddaaa6fff87425090167ebd Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 18 Sep 2022 13:20:20 +0200 Subject: radare2: Add patch to default to AT&T ASM syntax Some personal history on this: I started to get used to AT&T syntax because it's the default in GDB and used that ever since until I one day starting to do some more reverse engineering using radare, which defaults to Intel syntax. Ever since then probably my most used command in GDB was "set disassembly-flavor intel" (because I was to lazy to add it to the config) because I constantly got confused by the source/destination operand swaps. This even happened during live reverse engineering at rC3 where I was confused about some function logic only to find out that I was viewing in AT&T syntax. Fast-forward to today: I'm debugging some application using WINE and winedbg uses AT&T syntax, which I didn't like at first. After reflecting on this for a while, I thought it would probably be better to get used to AT&T syntax again and switch everything to use AT&T for the following reasons: * Operands are more natural to read, since most libraries/APIs in higher level languages do it like this (well, except memcpy, strcpy, etc... maybe I now get confused by libc functions...) * AT&T syntax feels less verbose, for example "mov ecx, dword [eax]" is just "movl (%eax), %ecx" This very commit makes sure that radare2 now defaults to AT&T syntax instead of eg. ensuring that GDB uses Intel syntax by default. Signed-off-by: aszlig --- pkgs/aszlig/default.nix | 3 ++- pkgs/aszlig/radare2/att-syntax-by-default.patch | 7 +++++++ pkgs/aszlig/radare2/default.nix | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 pkgs/aszlig/radare2/att-syntax-by-default.patch create mode 100644 pkgs/aszlig/radare2/default.nix (limited to 'pkgs') diff --git a/pkgs/aszlig/default.nix b/pkgs/aszlig/default.nix index 0629ab8e..9eb0012f 100644 --- a/pkgs/aszlig/default.nix +++ b/pkgs/aszlig/default.nix @@ -1,4 +1,4 @@ -{ callPackage, vim_configurable, gopass, mutt, xterm, rustfmt }: +{ callPackage, vim_configurable, gopass, mutt, xterm, radare2, rustfmt }: { aacolorize = callPackage ./aacolorize { }; @@ -12,6 +12,7 @@ nlast = callPackage ./nlast { }; psi = callPackage ./psi { }; pvolctrl = callPackage ./pvolctrl { }; + radare2 = callPackage ./radare2 { inherit radare2; }; rustfmt = callPackage ./rustfmt { inherit rustfmt; }; vim = callPackage ./vim { vim = vim_configurable; }; xterm = callPackage ./xterm { inherit xterm; }; diff --git a/pkgs/aszlig/radare2/att-syntax-by-default.patch b/pkgs/aszlig/radare2/att-syntax-by-default.patch new file mode 100644 index 00000000..908723b0 --- /dev/null +++ b/pkgs/aszlig/radare2/att-syntax-by-default.patch @@ -0,0 +1,7 @@ +diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c +index 53252df6a..da45bad50 100644 +--- a/libr/core/cconfig.c ++++ b/libr/core/cconfig.c +@@ -3620,1 +3620,1 @@ R_API int r_core_config_init(RCore *core) { +- n = NODECB ("asm.syntax", "intel", &cb_asmsyntax); ++ n = NODECB ("asm.syntax", "att", &cb_asmsyntax); diff --git a/pkgs/aszlig/radare2/default.nix b/pkgs/aszlig/radare2/default.nix new file mode 100644 index 00000000..f786656b --- /dev/null +++ b/pkgs/aszlig/radare2/default.nix @@ -0,0 +1,5 @@ +{ radare2 }: + +radare2.overrideAttrs (drv: { + patches = (drv.patches or []) ++ [ ./att-syntax-by-default.patch ]; +}) -- cgit 1.4.1