home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man1 / db.1 < prev    next >
Encoding:
Text File  |  1975-06-26  |  8.2 KB  |  295 lines

  1. .th DB I 8/20/73
  2. .sh NAME
  3. db \*- debug
  4. .sh SYNOPSIS
  5. .bd db
  6. [ core [ namelist ] ] [
  7. .bd \*-
  8. ]
  9. .sh DESCRIPTION
  10. Unlike
  11. many debugging packages (including DEC's ODT, on
  12. which
  13. .it db
  14. is loosely based),
  15. .it db
  16. is not loaded as part of the
  17. core image which it is used to examine; instead it examines files.
  18. Typically, the file will be either a core image produced
  19. after a fault or the binary output of
  20. the assembler.
  21. .it Core
  22. is the file being debugged; if omitted \fBcore\fR is assumed.
  23. .it Namelist
  24. is a file containing a symbol table.
  25. If it is omitted,
  26. the symbol table is obtained from the
  27. file being debugged,
  28. or if not there from
  29. .bd a.out.
  30. If no appropriate name list file
  31. can be found,
  32. .it db
  33. can still be used but some of its symbolic
  34. facilities become unavailable.
  35. .s3
  36. For the meaning of the optional third argument, see
  37. the last paragraph below.
  38. .s3
  39. The format for most
  40. .it db
  41. requests is an address followed
  42. by a one character command.
  43. Addresses are expressions built up as follows:
  44. .s3
  45. .lp +4 3
  46. 1.    A name has the value assigned to it
  47. when the input file was assembled.
  48. It may be relocatable or not depending
  49. on the use of the name during the assembly.
  50. .s3
  51. .lp +4 3
  52. 2.    An octal number is an absolute quantity with the appropriate
  53. value.
  54. .s3
  55. .lp +4 3
  56. 3.    A decimal number immediately followed by `\fB.\fR' is
  57. an absolute quantity with the appropriate value.
  58. .s3
  59. .lp +4 3
  60. 4.    An octal number immediately followed by \fBr\fR is a relocatable
  61. quantity with the appropriate value.
  62. .s3
  63. .lp +4 3
  64. 5.    The symbol \fB.\fR indicates the current pointer
  65. of \fIdb\fR.
  66. The current pointer is set by many
  67. \fIdb\fR
  68. requests.
  69. .s3
  70. .lp +4 3
  71. 6.    A \fB*\fR before
  72. an expression forms an expression whose value is the
  73. number in the word addressed by the first expression.
  74. A \fB*\fR alone is equivalent to `\fB*.\fR'.
  75. .s3
  76. .lp +4 3
  77. 7.    Expressions separated by \fB+\fR or blank are expressions
  78. with value equal to the sum of the components.  At most
  79. one of the components may be relocatable.
  80. .s3
  81. .lp +4 3
  82. 8.    Expressions separated by \fB\*-\fR form an expression
  83. with value equal to the difference to the components.
  84. If the right component is relocatable, the left component
  85. must be relocatable.
  86. .s3
  87. .lp +4 3
  88. 9.    Expressions are evaluated left to right.
  89. .s3
  90. .in \n(inu
  91. Names for registers are
  92. built in:
  93. .s3
  94. .bd "   r0 ... r5"
  95. .bd "   sp"
  96. .bd "   pc"
  97. .bd "   fr0 ... fr5"
  98. .s3
  99. These may be examined.
  100. Their values are deduced from the contents
  101. of the stack in a core image file.  They are meaningless
  102. in a file that is not a core image.
  103. .s3
  104. If no address is given for a command, the current address
  105. (also specified by ``\fB.\fR'') is assumed.  In general, ``\fB.\fR''
  106. points to the last word or byte printed by
  107. .it db.
  108. .s3
  109. There are
  110. .it db
  111. commands for examining locations
  112. interpreted as numbers, machine instructions,
  113. ASCII characters, and addresses.
  114. For numbers and characters, either bytes
  115. or words may be examined.
  116. The following commands are used to examine the specified file.
  117. .s3
  118. .lp +4 3
  119. /    The addressed word is printed in octal.
  120. .s3
  121. .lp +4 3
  122. \\    The addressed byte is printed in octal.
  123. .s3
  124. .lp +4 3
  125. "    The addressed word is printed as two ASCII characters.
  126. .s3
  127. .lp +4 3
  128. .tr |\*a
  129. |    The addressed byte is printed as an ASCII character.
  130. .s3
  131. .tr ||
  132. .lp +4 3
  133. \*g    The addressed word is printed in decimal.
  134. .s3
  135. .lp +4 3
  136. ?    The addressed word is interpreted as a machine
  137. instruction and a symbolic form of the instruction,
  138. including symbolic addresses, is printed.
  139. Often, the result will appear exactly as it was written
  140. in the source program.
  141. .s3
  142. .lp +4 3
  143. &    The addressed word is interpreted as a symbolic address
  144. and is printed as the name of the symbol whose value is closest
  145. to the addressed word, possibly followed by a signed offset.
  146. .s3
  147. .lp +4 3
  148. <nl>    (i. e., the character ``new line'')  This command advances
  149. the current location counter ``\fB.\fR'' and prints the resulting
  150. location in the mode last specified by
  151. one of the above requests.
  152. .s3
  153. .lp +4 3
  154. ^    This character decrements ``\fB.\fR'' and prints the
  155. resulting location in the mode last selected
  156. one of the above requests.  It is a converse to <nl>.
  157. .s3
  158. .lp +4 3
  159. %    Exit.
  160. .s3
  161. .in \n(inu
  162. Odd addresses to word-oriented commands are rounded
  163. down.
  164. The incrementing and decrementing
  165. of ``\fB.\fR'' done by the
  166. .bd <nl>
  167. and
  168. .bd ^
  169. requests is by one or
  170. two depending on whether the last command
  171. was word or byte oriented.
  172. .s3
  173. The address portion of any of the above commands
  174. may be followed by a comma and then by an
  175. expression.  In this case that number of sequential
  176. words or bytes specified by the expression is printed.
  177. ``\fB.\fR'' is advanced so that it points at the
  178. last thing printed.
  179. .s3
  180. There are two commands to interpret the value
  181. of expressions.
  182. .s3
  183. .lp +4 3
  184. =    When preceded by an expression, the value of the expression
  185. is typed in octal.
  186. When not preceded by an expression, the value of ``\fB.\fR'' is
  187. indicated.
  188. This command does not change the value of ``\fB.\fR''.
  189. .s3
  190. .lp +4 3
  191. :    An attempt is made to print the given expression
  192. as a symbolic address.  If the expression is relocatable,
  193. that symbol is found whose value is nearest
  194. that of the expression, and the symbol is typed, followed by
  195. a sign and the appropriate offset.
  196. If the value of the expression is absolute, a symbol
  197. with exactly the indicated value is sought and
  198. printed if found; if no matching symbol is discovered, the
  199. octal value of the expression is given.
  200. .s3
  201. .in \n(inu
  202. The following command may be used to patch the file being debugged.
  203. .s3
  204. .lp +4 3
  205. !    This command must be preceded by an expression.
  206. The value of the expression is stored at the location
  207. addressed by the current value of ``\fB.\fR''.
  208. The opcodes do not appear in the symbol
  209. table, so the user must assemble them by hand.
  210. .s3
  211. .in \n(inu
  212. The following command is used after a fault has caused
  213. a core image file to be produced.
  214. .s3
  215. .lp +4 3
  216. $    causes the fault type and
  217. the contents of the general registers and
  218. several other registers to be printed both in octal and symbolic
  219. format.
  220. The values are as they were at the time of the fault.
  221. .s3
  222. .in \n(inu
  223. For some purposes, it is important to know how addresses
  224. typed by the user correspond with
  225. locations in the file being debugged.
  226. The mapping algorithm employed by
  227. .it db
  228. is non-trivial
  229. for two reasons:
  230. First, in an
  231. .bd a.out
  232. file, there is a 20(8) byte header
  233. which will not appear when the file is loaded into
  234. core for execution.
  235. Therefore, apparent location 0 should correspond
  236. with actual file offset 20.
  237. Second, addresses
  238. in core images do not correspond with the
  239. addresses used by the program because in a core image
  240. there is a header containing the
  241. system's per-process
  242. data for the dumped process, and also because the
  243. stack is stored contiguously with the text and data
  244. part of the core image rather than at the highest possible
  245. locations.
  246. .it Db
  247. obeys the following rules:
  248. .s3
  249. If exactly one argument is given, and if it appears
  250. to be an
  251. .bd a.out
  252. file, the 20-byte header is skipped
  253. during addressing, i.e., 20 is added to all addresses typed.
  254. As a consequence, the header can be examined
  255. beginning at location \*-20.
  256. .s3
  257. If exactly one argument is given and if the file does
  258. not appear to be an
  259. .bd a.out
  260. file, no mapping is done.
  261. .s3
  262. If zero or two arguments are given,
  263. the mapping appropriate to a core image file is employed.
  264. This means that locations above the program break
  265. and below the stack
  266. effectively do not exist (and are not, in fact, recorded
  267. in the core file).
  268. Locations above the user's stack pointer are mapped,
  269. in looking at the core file, to
  270. the place where they are really stored.
  271. The per-process data kept by the
  272. system, which is stored in the first part
  273. of the core file,
  274. cannot currently be examined (except by \fB$\fR).
  275. .s3
  276. If one wants to examine
  277. a file which has an associated name list,
  278. but is not a core image file, the last argument ``\fB\*-\fR''
  279. can be used (actually the only purpose of the
  280. last argument is to make the number of
  281. arguments not equal to two).
  282. This feature is used most frequently in
  283. examining the memory file /dev/mem.
  284. .sh "SEE ALSO"
  285. as (I), core (V), a.out (V), od (I)
  286. .sh DIAGNOSTICS
  287. ``File not found'' if the first argument
  288. cannot be read; otherwise ``\fB?\fR''.
  289. .sh BUGS
  290. There should be some way to examine the registers
  291. and other per-process data in a core image;
  292. also there should be some way of specifying
  293. double-precision addresses.
  294. It does not know yet about shared text segments.
  295.