GDBMI_data_disassemble.st
changeset 12 568a2971c977
child 78 c24e7d8bc881
equal deleted inserted replaced
11:474fbb650afe 12:568a2971c977
       
     1 "{ Package: 'jv:libgdbs' }"
       
     2 
       
     3 GDBMICommand subclass:#GDBMI_data_disassemble
       
     4 	instanceVariableNames:''
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'GDB-Core-Commands-MI'
       
     8 !
       
     9 
       
    10 !GDBMI_data_disassemble class methodsFor:'documentation'!
       
    11 
       
    12 documentation
       
    13 "
       
    14 The `-data-disassemble' Command
       
    15 -------------------------------
       
    16 
       
    17 Synopsis
       
    18 ........
       
    19 
       
    20       -data-disassemble
       
    21          [ -s START-ADDR -e END-ADDR ]
       
    22        | [ -f FILENAME -l LINENUM [ -n LINES ] ]
       
    23        -- MODE
       
    24 
       
    25 Where:
       
    26 
       
    27 `START-ADDR'
       
    28      is the beginning address (or `$pc')
       
    29 
       
    30 `END-ADDR'
       
    31      is the end address
       
    32 
       
    33 `FILENAME'
       
    34      is the name of the file to disassemble
       
    35 
       
    36 `LINENUM'
       
    37      is the line number to disassemble around
       
    38 
       
    39 `LINES'
       
    40      is the number of disassembly lines to be produced.  If it is -1,
       
    41      the whole function will be disassembled, in case no END-ADDR is
       
    42      specified.  If END-ADDR is specified as a non-zero value, and
       
    43      LINES is lower than the number of disassembly lines between
       
    44      START-ADDR and END-ADDR, only LINES lines are displayed; if LINES
       
    45      is higher than the number of lines between START-ADDR and
       
    46      END-ADDR, only the lines up to END-ADDR are displayed.
       
    47 
       
    48 `MODE'
       
    49      is either 0 (meaning only disassembly), 1 (meaning mixed source and
       
    50      disassembly), 2 (meaning disassembly with raw opcodes), or 3
       
    51      (meaning mixed source and disassembly with raw opcodes).
       
    52 
       
    53 Result
       
    54 ......
       
    55 
       
    56 The result of the `-data-disassemble' command will be a list named
       
    57 `asm_insns', the contents of this list depend on the MODE used with the
       
    58 `-data-disassemble' command.
       
    59 
       
    60    For modes 0 and 2 the `asm_insns' list contains tuples with the
       
    61 following fields:
       
    62 
       
    63 `address'
       
    64      The address at which this instruction was disassembled.
       
    65 
       
    66 `func-name'
       
    67      The name of the function this instruction is within.
       
    68 
       
    69 `offset'
       
    70      The decimal offset in bytes from the start of `func-name'.
       
    71 
       
    72 `inst'
       
    73      The text disassembly for this `address'.
       
    74 
       
    75 `opcodes'
       
    76      This field is only present for mode 2.  This contains the raw
       
    77      opcode bytes for the `inst' field.
       
    78 
       
    79 
       
    80    For modes 1 and 3 the `asm_insns' list contains tuples named
       
    81 `src_and_asm_line', each of which has the following fields:
       
    82 
       
    83 `line'
       
    84      The line number within `file'.
       
    85 
       
    86 `file'
       
    87      The file name from the compilation unit.  This might be an absolute
       
    88      file name or a relative file name depending on the compile command
       
    89      used.
       
    90 
       
    91 `fullname'
       
    92      Absolute file name of `file'.  It is converted to a canonical form
       
    93      using the source file search path (*note Specifying Source
       
    94      Directories: Source Path.)  and after resolving all the symbolic
       
    95      links.
       
    96 
       
    97      If the source file is not found this field will contain the path as
       
    98      present in the debug information.
       
    99 
       
   100 `line_asm_insn'
       
   101      This is a list of tuples containing the disassembly for `line' in
       
   102      `file'.  The fields of each tuple are the same as for
       
   103      `-data-disassemble' in MODE 0 and 2, so `address', `func-name',
       
   104      `offset', `inst', and optionally `opcodes'.
       
   105 
       
   106 
       
   107    Note that whatever included in the `inst' field, is not manipulated
       
   108 directly by GDB/MI, i.e., it is not possible to adjust its format.
       
   109 
       
   110 {No value for `GDBN'} Command
       
   111 .............................
       
   112 
       
   113 The corresponding {No value for `GDBN'} command is `disassemble'.
       
   114 
       
   115 Example
       
   116 .......
       
   117 
       
   118 Disassemble from the current value of `$pc' to `$pc + 20':
       
   119 
       
   120      (gdb)
       
   121      -data-disassemble -s $pc -e '$pc + 20' -- 0
       
   122      ^done,
       
   123      asm_insns=[
       
   124      {address='0x000107c0',func-name='main',offset='4',
       
   125      inst='mov  2, %o0'},
       
   126      {address='0x000107c4',func-name='main',offset='8',
       
   127      inst='sethi  %hi(0x11800), %o2'},
       
   128      {address='0x000107c8',func-name='main',offset='12',
       
   129      inst='or  %o2, 0x140, %o1\t!! 0x11940 <_lib_version+8>'},
       
   130      {address='0x000107cc',func-name='main',offset='16',
       
   131      inst='sethi  %hi(0x11800), %o2'},
       
   132      {address='0x000107d0',func-name='main',offset='20',
       
   133      inst='or  %o2, 0x168, %o4\t!! 0x11968 <_lib_version+48>'}]
       
   134      (gdb)
       
   135 
       
   136    Disassemble the whole `main' function.  Line 32 is part of `main'.
       
   137 
       
   138      -data-disassemble -f basics.c -l 32 -- 0
       
   139      ^done,asm_insns=[
       
   140      {address='0x000107bc',func-name='main',offset='0',
       
   141      inst='save  %sp, -112, %sp'},
       
   142      {address='0x000107c0',func-name='main',offset='4',
       
   143      inst='mov   2, %o0'},
       
   144      {address='0x000107c4',func-name='main',offset='8',
       
   145      inst='sethi %hi(0x11800), %o2'},
       
   146      [...]
       
   147      {address='0x0001081c',func-name='main',offset='96',inst='ret '},
       
   148      {address='0x00010820',func-name='main',offset='100',inst='restore '}]
       
   149      (gdb)
       
   150 
       
   151    Disassemble 3 instructions from the start of `main':
       
   152 
       
   153      (gdb)
       
   154      -data-disassemble -f basics.c -l 32 -n 3 -- 0
       
   155      ^done,asm_insns=[
       
   156      {address='0x000107bc',func-name='main',offset='0',
       
   157      inst='save  %sp, -112, %sp'},
       
   158      {address='0x000107c0',func-name='main',offset='4',
       
   159      inst='mov  2, %o0'},
       
   160      {address='0x000107c4',func-name='main',offset='8',
       
   161      inst='sethi  %hi(0x11800), %o2'}]
       
   162      (gdb)
       
   163 
       
   164    Disassemble 3 instructions from the start of `main' in mixed mode:
       
   165 
       
   166      (gdb)
       
   167      -data-disassemble -f basics.c -l 32 -n 3 -- 1
       
   168      ^done,asm_insns=[
       
   169      src_and_asm_line={line='31',
       
   170      file='../../../src/gdb/testsuite/gdb.mi/basics.c',
       
   171      fullname='/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c',
       
   172      line_asm_insn=[{address='0x000107bc',
       
   173      func-name='main',offset='0',inst='save  %sp, -112, %sp'}]},
       
   174      src_and_asm_line={line='32',
       
   175      file='../../../src/gdb/testsuite/gdb.mi/basics.c',
       
   176      fullname='/absolute/path/to/src/gdb/testsuite/gdb.mi/basics.c',
       
   177      line_asm_insn=[{address='0x000107c0',
       
   178      func-name='main',offset='4',inst='mov  2, %o0'},
       
   179      {address='0x000107c4',func-name='main',offset='8',
       
   180      inst='sethi  %hi(0x11800), %o2'}]}]
       
   181      (gdb)
       
   182 
       
   183 
       
   184 "
       
   185 ! !
       
   186 
       
   187 !GDBMI_data_disassemble methodsFor:'accessing'!
       
   188 
       
   189 operation
       
   190 	^ 'data-disassemble'
       
   191 ! !
       
   192