From cdffbaa2d25a36f056578b4ab7d46d29c1419c6b Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Mon, 6 Mar 2000 22:14:44 +0000 Subject: [PATCH] 2000-03-06 Elena Zannoni * gdbmi.texinfo: Update data-disassemble documentation. --- gdb/mi/ChangeLog-mi | 4 ++ gdb/mi/gdbmi.texinfo | 125 +++++++++++++++++++++++-------------------- 2 files changed, 70 insertions(+), 59 deletions(-) diff --git a/gdb/mi/ChangeLog-mi b/gdb/mi/ChangeLog-mi index 9a076cb4201..61bfafe2dbb 100644 --- a/gdb/mi/ChangeLog-mi +++ b/gdb/mi/ChangeLog-mi @@ -1,3 +1,7 @@ +2000-03-06 Elena Zannoni + + * gdbmi.texinfo: Update data-disassemble documentation. + 2000-03-01 Elena Zannoni * mi-cmd-disas.c (mi_cmd_disassemble): Use diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo index ec2590e907b..8602885caa8 100644 --- a/gdb/mi/gdbmi.texinfo +++ b/gdb/mi/gdbmi.texinfo @@ -746,16 +746,17 @@ file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}@} @c @subsection Example @c N.A. -@section -data-disassemble +@section -data-disassemble ( -s -e ) | (-f -l [-n ]] -- Where @table @samp -@item -Is a function name or an address (or $pc) -@item -can be 0 (in which case the enclosing function will be disassembled), or -an address. -@item -can be 0 (only disassembly) or 1 (mixed source and disassembly). +@item +Is the beginning address (or $pc). +@item +End address. +@item +Name of the file to disassemble. +@item +Line number to disassemble around. @item specifies the number of disassembly lines to be produced. If it is -1 the whole function will be disassembled, in case no address is @@ -764,79 +765,85 @@ specified. If is specified as a non-zero value, and and , we'll display only lines, vice versa if is higher than the number of lines between and , we'll display only the lines up to . +@item +can be 0 (only disassembly) or 1 (mixed source and disassembly). @end table The output for each instruction is composed of two fields: @itemize @bullet @item Address +@item Func-name +@item Offset @item Instruction @end itemize -Note that whatever included in those fields, is not manipulated -directely by Flathead, i.e. it is not possible to adjust their format. +Note that whatever included in the instruction field, is not manipulated +directely by Flathead, i.e. it is not possible to adjust its format. @subsection GDB command N.A. No direct mapping. @subsection Example 1 +Disassemble from the current PC value to PC + 20. + @example (gdb) --data-disassemble main 0 0 -1 -^done,asm_insns=@{ -@{address="0x100b8
",inst=" stwu r1,-16(r1)"@}, -@{address="0x100bc ",inst="mflr r0"@}, -@{address="0x100c0 ",inst=" stw r31,12(r1)"@}, -@{address="0x100c4 ",inst=" stw r0,20(r1)"@}, -@{address="0x100c8 ",inst=" mr r31,r1"@}, -@{address="0x100cc ",inst=" bl0x1013c <__eabi>"@}, -@{address="0x100d0 ",inst=" lis r9,2"@}, -@{address="0x100d4 ",inst=" addi r3,r9,-25680"@}, -@{address="0x100d8 ",inst=" bl 0x10fc8 "@}, -@{address="0x100dc ",inst=" bl 0x10100 "@}, -@{address="0x100e0 ",inst=" li r3,0"@}, -@{address="0x100e4 ",inst=" b 0x100e8 "@}, -@{address="0x100e8 ",inst=" lwz r11,0(r1)"@}, -@{address="0x100ec ",inst=" lwz r0,4(r11)"@}, -@{address="0x100f0 ",inst=" mtlr r0"@}, -@{address="0x100f4 ",inst=" lwz r31,-4(r11)"@}, -@{address="0x100f8 ",inst=" mr r1,r11"@}, -@{address="0x100fc ",inst=" blr"@} -(gdb) +-data-disassemble -s $pc -e "$pc + 20" -- 0 +^done, +asm_insns={ +{address="0x000107c0",func-name="main",offset="4", +inst="mov 2, %o0"}, +{address="0x000107c4",func-name="main",offset="8", +inst="sethi %hi(0x11800), %o2"}, +{address="0x000107c8",func-name="main",offset="12", +inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"}, +{address="0x000107cc",func-name="main",offset="16", +inst="sethi %hi(0x11800), %o2"}, +{address="0x000107d0",func-name="main",offset="20", +inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}} +(gdb) @end example @subsection Example 2 -@example +Disassemble the whole function main. Line 32 is part of main. +@example +-data-disassemble -f basics.c -l 32 -- 0 +^done,asm_insns={ +{address="0x000107bc",func-name="main",offset="0",inst="save %sp, -112, %sp"}, +{address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"}, +{address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"}, +[...] +{address="0x0001081c",func-name="main",offset="96",inst="ret "}, +{address="0x00010820",func-name="main",offset="100",inst="restore "}} (gdb) --data-disassemble main 0 0 3 -^done,asm_insns=@{ -@{address=" 0x100b8
",inst=" stwu r1,-16(r1)"@}, -@{address=" 0x100bc ",inst="mflr r0"@}, -@{address=" 0x100c0 ",inst=" stw r31,12(r1)"@} -(gdb) @end example @subsection Example 3 +Disassemble 3 instruction from the start of main. +@example +(gdb) +-data-disassemble -f basics.c -l 32 -n 3 -- 0 +^done,asm_insns={ +{address="0x000107bc",func-name="main",offset="0",inst="save %sp, -112, %sp"}, +{address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"}, +{address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"}} +(gdb) +@end example + +@subsection Example 4 +Disassemble 3 instruction from the start of main in mixed mode. @example (gdb) --data-disassemble foo 0 1 -1 -^done,asm_insns=@{src_and_asm_line=@{line="11",file="hello.c", -line_asm_insn=@{ -@{address=" 0x10100 ",inst=" stwu r1,-16(r1)"@}, -@{address=" 0x10104 ",inst=" mflrr0"@}, -@{address=" 0x10108 ",inst=" stw r31,12(r1)"@}, -@{address=" 0x1010c ",inst=" stw r0,20(r1)"@}, -@{address=" 0x10110 ",inst=" mr r31,r1"@}@}@}, -src_and_asm_line=@{line="12",file="hello.c", -line_asm_insn=@{ -@{address=" 0x10114 ",inst=" lisr9,2"@}, -@{address=" 0x10118 ",inst=" addi r3,r9,-25664"@}, -@{address=" 0x1011c ",inst=" bl 0x10fc8 "@}@}@}, -src_and_asm_line=@{line="14",file="hello.c", -line_asm_insn=@{ -@{address=" 0x10120 ",inst=" lwz r11,0(r1)"@}, -@{address=" 0x10124 ",inst=" lwz r0,4(r11)"@}, -@{address=" 0x10128 ",inst=" mtlr r0"@}, -@{address=" 0x1012c ",inst=" lwz r31,-4(r11)"@}, -@{address=" 0x10130 ",inst=" mr r1,r11"@}, -@{address=" 0x10134 ",inst=" blr"@}@}@}@} +-data-disassemble -f basics.c -l 32 -n 3 -- 1 +^done,asm_insns={ +src_and_asm_line={line="31", +file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/testsuite/gdb.mi/basics.c", +line_asm_insn={ +{address="0x000107bc",func-name="main",offset="0",inst="save %sp, -112, %sp"}}}, + +src_and_asm_line={line="32", +file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/testsuite/gdb.mi/basics.c", +line_asm_insn={ +{address="0x000107c0",func-name="main",offset="4",inst="mov 2, %o0"}, +{address="0x000107c4",func-name="main",offset="8",inst="sethi %hi(0x11800), %o2"}}}} (gdb) @end example -- 2.30.2