1
0

vi 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. .TH VI 1
  2. .SH NAME
  3. 0i, 5i, ki, vi \- instruction simulators
  4. .SH SYNOPSIS
  5. .B vi
  6. [
  7. .I textfile
  8. ]
  9. .br
  10. .B vi
  11. .I pid
  12. .br
  13. .B 0i
  14. [
  15. .I textfile
  16. ]
  17. .br
  18. .B 0i
  19. .I pid
  20. .br
  21. .B 5i
  22. [
  23. .I textfile
  24. ]
  25. .br
  26. .B 5i
  27. .I pid
  28. .br
  29. .B ki
  30. [
  31. .I textfile
  32. ]
  33. .br
  34. .B ki
  35. .I pid
  36. .SH DESCRIPTION
  37. .I Vi
  38. simulates the execution of a MIPS binary in
  39. a Plan 9 environment.
  40. It has two main uses: as
  41. a debugger and as a statistics gatherer.
  42. Programs running under
  43. .I vi
  44. execute about two hundred times
  45. slower than normal\(embut faster than
  46. single stepping under
  47. .IR db .
  48. .IR 0i ,
  49. .IR 5i ,
  50. and
  51. .IR ki
  52. are similar to
  53. .I vi
  54. but interpret little-endian MIPS, ARM 7500, and SPARC binaries.
  55. The following discussion refers to
  56. .I vi
  57. but applies to the others
  58. as well.
  59. .PP
  60. .I Vi
  61. will simulate the execution of a named
  62. .IR textfile .
  63. It will also make a copy of an existing process with process id
  64. .I pid
  65. and simulate its continuation.
  66. .PP
  67. As a debugger
  68. .I vi
  69. offers more complete information
  70. than
  71. .IR db (1).
  72. Tracing can be performed at the level of instructions,
  73. system calls, or function calls.
  74. .I Vi
  75. allows breakpoints to be triggered when specified addresses
  76. in memory are accessed.
  77. A report of instruction counts,
  78. load delay fills and distribution is produced for
  79. each run.
  80. .I Vi
  81. simulates the CPU's caches and MMU
  82. to assist the optimization of compilers and programs.
  83. .PP
  84. The command interface mirrors the interface to
  85. .IR db ;
  86. see
  87. .IR db (1)
  88. for a detailed description.
  89. Data formats and addressing are compatible with
  90. .I db
  91. except
  92. for disassembly:
  93. .I vi
  94. offers only MIPS
  95. .RB ( db
  96. .BR -mmipsco )
  97. mnemonics for
  98. machine instructions.
  99. .I Ki
  100. offers both Plan 9 and Sun SPARC formats.
  101. .PP
  102. Several extra commands allow
  103. extended tracing and printing of statistics:
  104. .TP
  105. .BR $t [ 0ics ]
  106. The
  107. .I t
  108. command controls tracing. Zero cancels all tracing
  109. options.
  110. .RS
  111. .TP
  112. .B i
  113. Enable instruction tracing
  114. .TP
  115. .B c
  116. Enable call tracing
  117. .TP
  118. .B s
  119. Enable system call tracing
  120. .RE
  121. .TP
  122. .BR $i [ itsp ]
  123. The
  124. .B i
  125. command prints statistics accumulated by
  126. all code run in this session.
  127. .RS
  128. .TP
  129. .B i
  130. Print instruction counts and frequency.
  131. .TP
  132. .B p
  133. Print cycle profile.
  134. .TP
  135. .B t
  136. .RI ( Vi
  137. only) Print TLB and cache statistics.
  138. .TP
  139. .B s
  140. Print memory reference, working set and size statistics.
  141. .RE
  142. .TP
  143. .BR :b [ arwe ]
  144. .I Vi
  145. allows breakpoints to be set on any memory location.
  146. These breakpoints monitor when a location is
  147. accessed, read, written, or equals a certain value.
  148. For equality the compared value is the
  149. .I count
  150. (see
  151. .IR db (1))
  152. supplied to the command.
  153. .SH SOURCE
  154. .B /sys/src/cmd/vi
  155. etc.
  156. .SH "SEE ALSO"
  157. .IR nm (1),
  158. .IR db (1)
  159. .SH BUGS
  160. The code generated by
  161. the compilers
  162. is well supported, but some unusual instructions are unimplemented.
  163. Some Plan 9 system calls such as
  164. .I rfork
  165. cause simulated traps.
  166. The floating point simulation makes assumptions about the interpreting
  167. machine's floating point support. The floating point conversions performed
  168. by
  169. .I vi
  170. may cause a loss of precision.