Supported on windows
Supported on linux
Supported on embedded
Supported on android

set disassemble-next-line command

Controls whether GDB should show the disassembly of the next line each time it stops at a breakpoint or after a step.

Syntax

set disassemble-next-line on
set disassemble-next-line off
show disassemble-next-line

Modes

off
Each time GDB is stopped at a breakpoint or after executing a step it will display the next source line, but will not disassemble it.
on
Each time GDB is stopped at a breakpoint or after executing a step it will display the next source line followed by the disassembly of it.

Default mode

The default value for the disassemble-next-line setting is 'off'.

Remarks

Enabling the disassemble-next-line setting can be useful when stepping the code one instruction at a time (stepi/nexti commands) or when debugging optimized code.

Examples

In this example we will debug a basic C program consisting of 2 functions:

int func(int a, int b)
{
    return a + b;
}

int main()
{
    return func(1, 2);
}

We will first step through it normally and then enable the disassemble-next-line setting:

(gdb) show disassemble-next-line
Debugger's willingness to use disassemble-next-line is off.
(gdb) start
Temporary breakpoint 1 at 0x8048400: file test.c, line 8.
Starting program: /home/bazis/test
s
Temporary breakpoint 1, main () at test.c:8
8 return func(1, 2);
(gdb) step
func (a=1, b=2) at test.c:3
3 return a + b;
(gdb) set disassemble-next-line on
(gdb) next
4 }
=> 0x080483f8 <func+11>: 5d pop %ebp
0x080483f9 <func+12>: c3 ret
(gdb) next
main () at test.c:9
9 }
=> 0x08048414 <main+26>: c9 leave
0x08048415 <main+27>: c3 ret

Compatibility with VisualGDB

Normally you don't need the set disassemble-next-line command when using VisualGDB. Simply use the Debug->Windows->Disassembly window in Visual Studio to view the disassembly.

See also