From 44b8a07a42b7434088e0e636cf00c50d131bee57 Mon Sep 17 00:00:00 2001 From: Alexis Pereda Date: Thu, 26 Mar 2020 10:57:52 +0100 Subject: [PATCH] update README.md --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 705dc2c..3d65e7e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ These examples codes are **not** for production and often are simplified with re ```bash mkdir build cd build -cmake .. +cmake -DCMAKE_BUILD_TYPE=Release .. make ``` @@ -19,10 +19,16 @@ then run any example binary, located inside the `build/examples/` directory. ### Assembler code Some examples are meant to show the assembler code they generate. -To see that, one can use for example https://godbolt.org/ or GDB. -With GDB: +To see that, one can use for example https://godbolt.org/ or objdump or GDB. +As objdump cannot only dump a specific function, here is the GDB version: ```bash -gdb -q -ex 'disassemble main' -ex q "${program_to_execute}" +gdb -batch -ex 'set disassembly-flavor intel' -ex 'set print asm-demangle on' -ex 'disassemble main' "${program_to_execute}" +``` + +One can create an alias to ease the usage of GDB: +```bash +alias disas="gdb -batch -ex 'set disassembly-flavor intel' -ex 'set print asm-demangle on' -ex 'disassemble main'" +disas "${program_to_execute}" ``` Important note: