GCC: Compile assembly with updated code matching?

When you enter the debugger in VS and open the disassembly window, each fragment of the assembly is displayed below the corresponding code section (more or less). GCC with -S only displays the split node.

Is there an option in GCC to display some correspondence to the source code?

The source code is C ++.

+3
source share
4 answers

Compile your code with gcc -g, then you can parse with objdump -S yourfile. this will give you disassembly interspersed with the source.

+5
source

If you are asking about debugging, in gdb use the disassemble command with the / m flag (mixed):

(gdb) disas /m main

++, , , -g.

+3

. , -S, , gcc , , . : , .

+1
gcc yourFile.C -S -fverbose-asm

, , , .

+1

Source: https://habr.com/ru/post/1749909/


All Articles