binutils-gdb/gdb/cli
Kevin Buettner e94802301b Disassemble blocks with non-contiguous ranges
This patch adds support for disassembly of blocks with non-contiguous
ranges.  These blocks are printed as follows:

(gdb) disassemble foo
Dump of assembler code for function foo:
Address range 0x401136 to 0x401151:
   0x0000000000401136 <+0>:     push   %rbp
   0x0000000000401137 <+1>:     mov    %rsp,%rbp
   0x000000000040113a <+4>:     callq  0x401134 <bar>
   0x000000000040113f <+9>:     mov    0x2eef(%rip),%eax        # 0x404034 <e>
   0x0000000000401145 <+15>:    test   %eax,%eax
   0x0000000000401147 <+17>:    je     0x40114e <foo+24>
   0x0000000000401149 <+19>:    callq  0x401128 <foo+4294967282>
   0x000000000040114e <+24>:    nop
   0x000000000040114f <+25>:    pop    %rbp
   0x0000000000401150 <+26>:    retq
Address range 0x401128 to 0x401134:
   0x0000000000401128 <+-14>:   push   %rbp
   0x0000000000401129 <+-13>:   mov    %rsp,%rbp
   0x000000000040112c <+-10>:   callq  0x401126 <baz>
   0x0000000000401131 <+-5>:    nop
   0x0000000000401132 <+-4>:    pop    %rbp
   0x0000000000401133 <+-3>:    retq
End of assembler dump.

This is an actual dump from the test case that I constructed for
this work.  The ranges are printed in the order encountered in the
debug info. For the above example, note that the second range occupies
lower addresses than the first range.

Functions with contiguous ranges are still printed as follows:

(gdb) disassemble main
Dump of assembler code for function main:
   0x0000000000401151 <+0>:     push   %rbp
   0x0000000000401152 <+1>:     mov    %rsp,%rbp
   0x0000000000401155 <+4>:     callq  0x401136 <foo>
   0x000000000040115a <+9>:     mov    $0x0,%eax
   0x000000000040115f <+14>:    pop    %rbp
   0x0000000000401160 <+15>:    retq
End of assembler dump.

gdb/ChangeLog:

	* cli/cli-cmds.c (block.h): Include.
	(print_disassembly): Handle printing of non-contiguous blocks.
	(disassemble_current_function): Likewise.
	(disassemble_command): Likewise.
2018-08-23 16:16:07 -07:00
..
cli-cmds.c Disassemble blocks with non-contiguous ranges 2018-08-23 16:16:07 -07:00
cli-cmds.h Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
cli-decode.c Remove old lint code 2018-07-30 08:29:47 -06:00
cli-decode.h Use counted_command_line everywhere 2018-05-04 15:58:06 -06:00
cli-dump.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
cli-interp.c Use thread_info and inferior pointers more throughout 2018-06-21 17:09:31 +01:00
cli-interp.h Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
cli-logging.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
cli-script.c Remove "repeat" argument from command_line_input 2018-08-17 16:39:06 -06:00
cli-script.h Let gdb.execute handle multi-line commands 2018-05-04 15:58:09 -06:00
cli-setshow.c Convert observers to C++ 2018-03-19 09:37:49 -06:00
cli-setshow.h Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
cli-utils.c Add helper functions parse_flags and parse_flags_qcs 2018-07-12 22:50:26 +02:00
cli-utils.h Add helper functions parse_flags and parse_flags_qcs 2018-07-12 22:50:26 +02:00