sun-dbx.doc 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519
  1. .ds + \v'-0.06i'+\v'0.06i'
  2. .de PR
  3. .sp 1
  4. .in +1.5i
  5. .ti -0.8i
  6. .nh
  7. \s-2\fL\\$1 \s+2\(->\s-2 \\$2\fR\s+2
  8. .hy
  9. .in -1.5i
  10. ..
  11. .de PC
  12. .in +1.5i
  13. .ti -0.8i
  14. .nh
  15. .sp 0.05i
  16. \s-2\fL\\$1 \s+2\(->\s-2 \\$2\fR\s+2
  17. .hy
  18. .in -1.5i
  19. ..
  20. .OF 'Sun Microsystems'8 Apr 86'Programming Languages Group'
  21. .EF 'Sun Microsystems'8 Apr 86'Programming Languages Group'
  22. .ps 12
  23. .nr PS 12
  24. .vs 14p
  25. .nr VS 14p
  26. .ce
  27. \fB\s20Dbx and Dbxtool Interfaces\s0\fR
  28. .sp 1
  29. .ce
  30. Steven S. Muchnick
  31. .sp 1
  32. .ce
  33. \fI8 April 1986\fR
  34. .sp 2
  35. .NH 1
  36. Introduction and Assumptions
  37. .PP
  38. This document specifies two interfaces, one between Sun's compilers and
  39. the \fIdbx\fR and \fIdbxtool\fR debuggers and the other between the two
  40. processes which make up \fIdbxtool\fR.
  41. The information is current as of the 3.0 Sun Software Release and the
  42. 1.0 release of Sun Modula-2 and is intended for compiler implementors.
  43. .PP
  44. The interface languages are expected to grow and evolve over time.
  45. While they may be extended at arbitrary times and bugs fixed in them as needed,
  46. major changes which introduce incompatibilities with previous versions
  47. will generally be synchronized with major system releases.
  48. .PP
  49. This document assumes the reader is familiar with the Sun assembler and linker,
  50. and with \fIdbx\fR and \fIdbxtool\fR.
  51. .PP
  52. .sp 1
  53. .NH 1
  54. \fIDbx\fB and \fIDbxtool\fR
  55. .PP
  56. \fIDbxtool\fR consists of two processes, the debugger process (DP), which is
  57. identical to \fIdbx\fR, and the user interface process (UIP).
  58. When the UIP starts the DP it passes a flag to it telling it that it was
  59. started by the UIP, rather than directly by the user.
  60. Commands are communicated from the UIP to the DP in the same form that they
  61. are typed by the user to \fIdbx\fR, as character strings consisting of the
  62. command name followed by the arguments, and are presented to it via its
  63. standard input.
  64. Commands entered via the mouse are translated by the UIP into the standard
  65. form: the command button provides the command name to be placed at the
  66. beginning of the string and the selected argument is translated according
  67. to the selection interpretation associated with the command button.
  68. The DP communicates to the UIP in the DP-UIP interface language,
  69. instead of the usual tty-oriented responses used by the DP when it is
  70. invoked directly as \fIdbx\fR.
  71. .PP
  72. The next section presents the syntax and semantics of the language which
  73. compilers use to convey information about data types, variables and the
  74. relationship between source statements and machine instructions to the DP
  75. (or, equivalently, to \fIdbx\fR).
  76. The following section presents the syntax and semantics of the interface
  77. between the DP and the UIP.
  78. Appendix A lists the standard types defined for Sun's supported languages.
  79. Appendix B gives an example of the compiler-debugger interface.
  80. .PP
  81. .sp 1
  82. .NH 1
  83. Overview of the Compiler-Debugger Interface Language
  84. .PP
  85. All information about a compiled module needed by \fIdbx\fR and \fIdbxtool\fR
  86. is contained in the symbol table part of the \fIa.out\fR file.
  87. Some of this information is derived from ordinary linker and assembler
  88. symbols; the rest is passed by the compilers to the assembler via \fL.stab\fR
  89. ("symbol table") directives.
  90. The debuggers distinguish the two types of symbols by whether or not any of
  91. the \fLN_STAB\fR* bits are set in the type field of the symbol entry, as
  92. described below in Section 3.31.
  93. .FS
  94. *Symbols beginning with \fLN_\fR are defined in the files
  95. \fL/usr/include/a.out.h\fR and \fL/usr/include/stab.h\fR.
  96. .FE
  97. .PP
  98. The \fL.stab\fR directives have the following forms:
  99. .sp 1
  100. .in +1.0i
  101. \fL .stabs "\fIname\fR",\fItype\fR,0,\fIdesc\fR,\fIvalue\fR
  102. .sp 1
  103. \fL .stabn \fItype\fR,0,\fIdesc\fR,\fIvalue\fR
  104. .in -1.0i
  105. .sp 0.6
  106. or
  107. .sp 0.6
  108. .in +1.0i
  109. \fL .stabd \fItype\fR,0,\fIdesc\fR
  110. .in -1.0i
  111. .sp 1
  112. .LP
  113. The \fL.stabs\fR directives are used to describe types, variables,
  114. procedures, and so on, while the \fL.stabn\fR directives convey
  115. information about scopes and the mapping from source statements to
  116. object code.
  117. A \fL.stabd\fR directive is identical in meaning to a
  118. corresponding \fL.stabn\fR directive with the value field set to "." (dot),
  119. which the assembler uses to mean the current location.
  120. Most of the needed information, for example symbol name and type structure,
  121. is contained in the \fIname\fR field.
  122. The \fItype\fR field identifies the type of symbolic information, for
  123. example source file, global symbol, or source line.
  124. The \fIdesc\fR field specifies the number of bytes occupied by a variable or
  125. type or the nesting level for a scope symbol.
  126. The \fIvalue\fR field specifies an address or an offset.
  127. .PP
  128. The following classes of \fL.stab\fR information are needed to describe
  129. a compiled module or file, with of course considerable variations
  130. depending on the source language:
  131. .IP -
  132. file and module identification and (for Modula-2) the list of imported
  133. separate units
  134. .IP -
  135. program structure information and descriptions of types, variables and scopes
  136. .IP -
  137. code address information for statements
  138. .PP
  139. The \fL.stab\fR directives may be interspersed in the generated assembly
  140. language with relatively few constraints on their ordering.
  141. In particular, the \fLN_SLINE .stabd\fR or \fL.stabn\fR directives which
  142. describe the relationship between the source and object code need to
  143. appear in the same order as the corresponding source lines and
  144. the \fL.stabs\fR directives which describe variables need to be ordered
  145. to correspond to the scope structure of the program.
  146. .PP
  147. The name field in a \fL.stabs\fR entry for a symbol contains the
  148. symbol's name, followed by a colon, a one-character symbol
  149. descriptor, and descriptor-specific information, i.e.
  150. .sp 1
  151. .in +1.0i
  152. \fLsymbol : descriptor debuginfo\fR
  153. .in -1.0i
  154. .sp 0.5
  155. .PP
  156. The linker and assembler symbols and \fL.stab\fR directives expected by
  157. the debuggers and their meanings are described below.
  158. .PP
  159. .sp 1
  160. .NH 2
  161. Syntax Notation
  162. .PP
  163. In the syntax notation used below nonterminal symbols are those in
  164. \fLtypewriter font\fR which are more than one character long and begin with
  165. a capital letter.
  166. The left and right sides of a production are separated by an arrow
  167. "\fL\(->\fR".
  168. Braces "\fL{\fR" and "\fL}\fR" are used to indicate grouping, brackets
  169. "\fL[\fR" and "\fL]\fR" to indicate optionality, vertical bar "\fL|\fR" for
  170. alternation, asterisk "\fL*\fR" for zero or more repetitions, and plus
  171. "\fL\*+\fR" for one or more repetitions.
  172. All other symbols in \fLtypewriter font\fR which are not part of the notation
  173. denote terminals.
  174. .PP
  175. .sp 1
  176. .NH 2
  177. Lexical Rules
  178. .PP
  179. Lexically \fL.stab\fR directives follow the conventions of ordinary
  180. assembly language lines.
  181. The string in a \fL.stabs\fR directive may be continued from one line to the
  182. next by terminating it with a backslash '\\', completing the other fields
  183. of the directive, and continuing the string in another \fL.stabs\fR
  184. directive on the next line with the same non-string fileds.
  185. Thus, for example,
  186. .in +1.0i
  187. .nf
  188. \fL\s-2.stabs "int:t(0,1)=r(0,1);-2147483648;\\",0x80,0,0,0
  189. .stabs "2147483647;",0x80,0,0,0\s+2\fR
  190. .fi
  191. .in -1.0i
  192. .LP
  193. and
  194. .in +1.0i
  195. .nf
  196. \fL\s-2.stabs "int:t(0,1)=r(0,1);-2147483648;2147483647;",0x80,0,0,0\s+2\fR
  197. .fi
  198. .in -1.0i
  199. .LP
  200. are equivalent.
  201. There may be any number of such continuation lines.
  202. .PP
  203. .sp 1
  204. .NH 2
  205. Linker and Assembler Symbols
  206. .PP
  207. The linker and assembler symbols used by the debuggers are those which
  208. identify object files, procedures, and variables.
  209. These symbols are generated either by the linker (object filenames) or by
  210. the assembler (procedure names and variables) without the compiler having
  211. to supply \fL.stab\fR directives for them.
  212. .PP
  213. Symbols in text space whose names end in "\fL.o\fR" are taken as object
  214. filenames.
  215. The debugger strips off the "\fL.o\fR" and any leading directory names.
  216. The resulting filename becomes associated with following symbols as the
  217. file which contains them, until another object filename or the end of file
  218. is seen.
  219. Text-space symbols other than object filenames are taken by the debugger
  220. as names of procedures.
  221. If the symbol has a leading underscore, it is removed.
  222. If a debugger symbol entry is later encountered for the same symbol, the
  223. assembler symbol is discarded in its favor.
  224. .PP
  225. Data- and bss-space symbols are taken by the debugger as representing
  226. global variables in the corresponding spaces.
  227. Leading underscores are stripped off and the scope information is preserved.
  228. A debugger symbol is also required for such symbols to provide full information
  229. for them (see Section 3.13).
  230. .PP
  231. .sp 1
  232. .NH 2
  233. Top-Level Structure of Debugger Symbols
  234. .PP
  235. .PR DebuggerStabs "{CodeStabs | SourceFileStabs | UnitStab | ProcStab | ScopeBgnStab StructureStabs* ScopeEndStab | TypeStab | GlblVarStab | StaticVarStab | LclVarStab | ParamStab | CommonStabs | ImpExpStab}*"
  236. .PP
  237. .NH 2
  238. Source-to-Object Code Mapping
  239. .PP
  240. .PR CodeStabs "{BlockBgnStab LineStab* BlockEndStab}*"
  241. .PC BlockBgnStab ".stabn N_LBRAC , 0 , Level , CodeAddr"
  242. .PC N_LBRAC 0xc0
  243. .PC LineStab ".stabn N_SLINE , 0 , Line , CodeAddr"
  244. .PC N_SLINE 0x44
  245. .PC BlockEndStab ".stabn N_RBRAC , 0 , Level , CodeAddr"
  246. .PC N_RBRAC 0xe0
  247. .PP
  248. \fLCodeStabs\fR define the relationship between the source code and the
  249. object code.
  250. The object code generated for each block (e.g. a group of statements
  251. delimited by curly braces in C or by \fLbegin\fR and \fLend\fR in Pascal)
  252. is enclosed in \fLBlockBgnStab\fR and \fLBlockEndStab\fR directives.
  253. A \fLLineStab\fR is given for the first instruction generated for
  254. each statement.
  255. \fLLevel\fR identifies the static nesting level of a block, \fLLine\fR
  256. gives the source line number for a statement and \fLCodeAddr\fR
  257. gives the relocatable address of the corresponding object code.
  258. .PP
  259. .NH 2
  260. Source File Identification
  261. .PP
  262. .PR SourceFileStab ".stabs "" SourceFileString "" , N_SO , 0 , 0 , CodeAddr"
  263. .PC SourceFileString String
  264. .PC N_SO 0x64
  265. .PP
  266. A \fLSourceFileStab\fR identifies the source file which was compiled to
  267. produce this object code.
  268. The \fLSourceFileString\fR is the name of the source file in the form it was
  269. given to the compiler.
  270. The \fLCodeAddr\fR gives the relocatable address of the beginning of the
  271. generated object code.
  272. .PP
  273. .NH 2
  274. Unit Identification (Modula-2 only)
  275. .PP
  276. .PR UnitStab ".stabs "" UnitString "" , N_M2C , 0 , UnitNumber , UnitFlag"
  277. .PC UnitString "Name , UnitTimeStamp [, CodeTimeStamp]"
  278. .PC N_M2C 0x42
  279. .PC UnitNumber Number
  280. .PC UnitTimeStamp String
  281. .PC CodeTimeStamp String
  282. .PC UnitFlag "0 | 1"
  283. .PP
  284. A \fLUnitStab\fR provides some debugging information, in addition to
  285. identifying a Modula-2 separate compilation unit for version consistency
  286. checking in the Modula-2 linker \fIm2l\fR .
  287. The \fLName\fR field defines the the name of the module to the
  288. debugger.
  289. The \fLUnitNumber\fR field is used to identify the modules of imported
  290. and exported identifiers (see Section 3.12).
  291. The \fLUnitTimeStamp\fR is used internally in the debugger to provide
  292. unique entries in its module table.
  293. The \fLUnitFlag\fR field is used only to identify the main module
  294. (its \fLUnitFlag\fR is \fL0\fR).
  295. The \fLCodeTimeStamp\fR field is used only for consistency checking.
  296. .PP
  297. .NH 2
  298. Functions and Procedures (C, FORTRAN and Pascal)
  299. .PP
  300. .PR ProcStab ".stabs "" ProcName : ProcClass ProcRtnType "" , N_FUN , 0 , RtnSize , CodeAddr"
  301. .PC ProcClass "F | f"
  302. .PC ProcRtnType TypeRef
  303. .PC N_FUN 0x24
  304. .PP
  305. A \fLProcStab\fR defines the beginning of a C, FORTRAN or Pascal function or
  306. procedure.
  307. It gives the routine's name and storage class, the type and size of the value
  308. it returns, and the address of the beginning of its code.
  309. The class is \fLF\fR for globally defined routines and \fLf\fR for local ones.
  310. For procedures, the return type is \fLvoid\fR.
  311. .PP
  312. .NH 2
  313. Module, Function and Procedure Scopes (Modula-2 only)
  314. .PP
  315. .PR ScopeBgnStab ".stabs "" ScopeBgnString "" , N_SCOPE , 0 , Level , CodeAddr"
  316. .PC ScopeEndStab ".stabs "" ScopeEndString "" , N_SCOPE , 0 , Level , 0"
  317. .PC ScopeBgnString "Name : ScopeId"
  318. .PC ScopeId "M ScopeNumber | Q ScopeNumber ResultType"
  319. .PC ResultType TypeRef
  320. .PC ScopeEndString "Name : E ScopeNumber"
  321. .PC N_SCOPE 0xc4
  322. .PC ScopeNumber Number
  323. .PP
  324. A \fLScopeBgnStab\fR - \fLScopeEndStab\fR pair delimits a module, procedure or
  325. function scope in Modula-2.
  326. The \fLScopeBgnString\fR gives the name of the scope and a \fLScopeId\fR
  327. which identifies it as a module (\fLM\fR) or a function or procedure
  328. (\fLQ\fR) and gives the sequence number (\fLScopeNumber\fR) assigned to it
  329. and, for functions and procedures, the type of its return value; for
  330. procedures the return type is \fLvoid\fR.
  331. The \fLLevel\fR field gives the static nesting level of the scope.
  332. The \fLScopeEndString\fR gives the name of the scope and the assigned sequence
  333. number.
  334. .PP
  335. .NH 2
  336. Type Identifiers
  337. .PP
  338. .PR TypeStab ".stabs "" TypeString "" , TypeScope , 0 , Size , 0"
  339. .PC TypeScope "N_LSYM | N_GSYM"
  340. .PC N_GSYM 0x20
  341. .PC N_LSYM 0x80
  342. .PC TypeString "[Name] : t Type"
  343. .PP
  344. A \fLTypeStab\fR describes a data type, giving its name,
  345. a description of the range of values it comprises and (for Modula-2) the size
  346. in bytes of the storage it occupies.
  347. The \fLSize\fR field is ignored by \fIdbx\fR for languages other than
  348. Modula-2 and the size of a type is determined by its range of values.
  349. The \fLTypeScope\fR indicates whether the type is locally or globally
  350. defined.
  351. See Section 3.20 below for a description of \fLType\fR.
  352. .PP
  353. .NH 2
  354. Local Variables
  355. .PP
  356. .PR LclVarStab ".stabs "" Name : Type "" , N_LSYM , 0 , 0 , DataOffset"
  357. .PP
  358. A \fLLclVarStab\fR describes a local variable, giving its name, kind and type
  359. and the offset from the stack pointer to the local.
  360. .PP
  361. .NH 2
  362. Modula-2 Imports and Exports
  363. .PP
  364. .PR ImpExpStab ".stabs "" ImpExpString "" , N_LSYM , 0 , 0 , 0"
  365. .PC ImpExpString "Name : ImpExpId"
  366. .PC ImpExpId "U UnitNumber | u UnitNumber | d ScopeNumber"
  367. .PP
  368. An \fLImpExpStab\fR is used by Modula-2 to describe a separately compiled
  369. module and the symbols it defines.
  370. See Table 2 (Section 3.30) below for a description of the letters occurring in
  371. the \fLImpExpId\fR field.
  372. .PP
  373. .NH 2
  374. Global Variables
  375. .PP
  376. .PR GlblVarStab ".stabs "" Name : G Type "" , N_GSYM , 0 , 0 , 0"
  377. .PC N_GSYM 0x20
  378. .PP
  379. A \fLGlblVarStab\fR identifies a global variable.
  380. The address of the variable is gotten from the corresponding assembler symbol.
  381. .PP
  382. .NH 2
  383. Static Variables
  384. .PP
  385. .PR StaticVarStab ".stabs "" Name : StaticKind Type "" , StaticSym , 0 , 0 , DataAddr"
  386. .PC StaticKind "S | V"
  387. .PC StaticSym "N_STSYM | N_LCSYM"
  388. .PC N_STSYM 0x26
  389. .PC N_LCSYM 0x28
  390. .PP
  391. A \fLStaticVarStab\fR identifies a static variable, which may be either
  392. uninitialized or initialized and either global or local.
  393. Global statics are identified by \fLStaticKind\fR \fLS\fR and local ones
  394. by \fLV\fR.
  395. Uninitialized statics are identified by \fLStaticSym\fR \fLN_LCSYM\fR and
  396. initialized ones by \fLN_STSYM\fR.
  397. The \fLDataAddr\fR is the relocatable address assigned to the static
  398. variable.
  399. .PP
  400. .NH 2
  401. Parameters
  402. .PP
  403. .PR ParamStab ".stabs "" Name : ParamKind Type "" , N_PSYM , 0 , 0 , DataOffset"
  404. .PC ParamKind "p | i | v | C | x | pP | pF | X"
  405. .PC N_PSYM 0xa0
  406. .PP
  407. A \fLParamStab\fR describes a procedure or function parameter, giving its
  408. name, kind, type and stack offset.
  409. The kind is as described in Table 2 (Section 3.30) below, except that \fLpP\fR
  410. and \fLpF\fR are used for Pascal procedure and function parameters,
  411. respectively.
  412. For register parameters a \fLRegStab\fR is also generated.
  413. .PP
  414. .NH 2
  415. Register Variables
  416. .PP
  417. .PR RegStab ".stabs "" Name : Type "" , N_RSYM , 0 , RegSize , RegNumber"
  418. .PC RegSize Number
  419. .PC RegNumber Number
  420. .PC N_RSYM 0x40
  421. .PP
  422. A \fLRegStab\fR describes a register variable or parameter, giving its
  423. name, size in bytes, type and register number.
  424. The register numbers are assigned as shown in Table 1.
  425. .KF
  426. .TS
  427. box center;
  428. l | l
  429. l | l.
  430. Register class Numbers
  431. _ _
  432. Data registers d0 - d7 0 - 7
  433. Address registers a0 - a7 8 - 15
  434. MC68881 registers fp0 - fp7 18 - 25
  435. FPA registers fpa0 - fpa31 31 - 62
  436. .TE
  437. .ce
  438. Table 1. Register Numbers
  439. .sp 1
  440. .KE
  441. .LP
  442. For register parameters a \fLParamStab\fR is also generated.
  443. .PP
  444. .NH 2
  445. Common Blocks
  446. .PP
  447. .PR CommonStabs "BgnCommonStab GlblVarStab* EndCommonStab"
  448. .PC BgnCommonStab ".stabs ""BlockName"" , N_BCOMM , 0 , 0 , 0"
  449. .PC EndCommonStab ".stabs ""BlockName"" , N_ECOMM , 0 , 0 , 0"
  450. .PC BlockName Name
  451. .PC N_BCOMM 0xe2
  452. .PC N_ECOMM 0xe4
  453. .PP
  454. A \fLBgnCommonStab\fR introduces the symbol list for a common block and the
  455. corresponding \fLEndCommonStab\fR ends it.
  456. .PP
  457. .NH 2
  458. Other Terms
  459. .PP
  460. .PR Level Number
  461. .PC Size Number
  462. .PC Line Number
  463. .PC CodeAddr AddrExpr
  464. .PC DataAddr AddrExpr
  465. .PC DataOffset Number
  466. .PR Number "[-] {DIGIT}\*+ | 0x {HEXDIGIT}\*+"
  467. .PC Name " LETTER {LETTER | DIGIT}*"
  468. .PC String "{CHARACTER}*"
  469. .PP
  470. An \fLAddrExpr\fR is an assembler address expression (see the assembly language
  471. manual).
  472. A \fLDIGIT\fR may be any decimal digit.
  473. A \fLHEXDIGIT\fR may be a decimal digit or an upper or lower case letter in
  474. the range \fLA\fR through \fLF\fR.
  475. A \fLCHARACTER\fR may be any character accepted by the assembler in a string
  476. (see the assembly language manual).
  477. .PP
  478. .sp 1
  479. .NH 2
  480. Specification of Types
  481. .PP
  482. Type information starts with a type descriptor, followed by type-specific
  483. information, which is a sequence of information blocks separated by semicolons.
  484. .sp 1
  485. .in +1.0i
  486. \fLtypedescriptor typeinfoblock ; ... ; typeinfoblock\fR
  487. .in -1.0i
  488. .sp 0.5
  489. .LP
  490. Upon definition of a type, a type number or type number pair is assigned
  491. to it which can be used in later type specifications to refer to the
  492. type definition.
  493. .NH 2
  494. Types, Type Definitions, Type References and Standard Types
  495. .PP
  496. .PR Type "TypeRef | TypeDef | Enumeration | RangeOrFloat | Array | DynArray | ConfArray | Record | Set | Pointer | ProcType | FuncType | FileType | SeparateType"
  497. .PC TypeRef "Number | ( Number , Number )"
  498. .PC TypeDef "TypeRef = Type"
  499. .PP
  500. A type may be any of those allowed by the C, FORTRAN 77, Modula-2 and
  501. Pascal languages.
  502. A \fLTypeRef\fR is the number or pair of numbers assigned to a type.
  503. Whether numbers or pairs are used depends on the compiler.
  504. Currently, C uses pairs and FORTRAN 77, Pascal and Modula-2 use
  505. single numbers.
  506. .PP
  507. In the single number form, the numbers are assigned sequentially by the
  508. compiler as it encounters type definitions during processing a source file and
  509. the files included into it.
  510. In the pair form, the first element identifies the file (the source file is
  511. number 0 and successive include files are given successive numbers) and the
  512. second element identifies successive types defined within each file.
  513. .PP
  514. A \fLTypeDef\fR associates a type number with a type definition.
  515. .PP
  516. Each language defines some standard types by a series of \fL.stabs\fR
  517. lines, as shown in Appendix A.
  518. .PP
  519. .NH 2
  520. Enumeration Types
  521. .PP
  522. .PR Enumeration "e {EnumName : OrdinalValue ,}\*+"
  523. .PC EnumName Name
  524. .PC OrdinalValue Number
  525. .PP
  526. An \fLEnumeration\fR defines an enumeration type by giving the names and values
  527. of its elements.
  528. .PP
  529. .NH 2
  530. Range, Floating-Point and Complex Types
  531. .PP
  532. .PR RangeOrFloat "r Type ; MinValue ; MaxValue"
  533. .PC MinValue RangeValue
  534. .PC MaxValue RangeValue
  535. .PC RangeValue "[ A | J] Number"
  536. .PP
  537. A \fLRangeOrFloat\fR defines a range, floating-point or complex type.
  538. It describes a range type if the number in the \fLMaxValue\fR field is
  539. nonzero and the \fLMinValue\fR number is less than or equal to the
  540. \fLMaxValue\fR number.
  541. In this case, it gives the minimal and maximal values of the range and the
  542. type it is a subrange of.
  543. The letters \fLA\fR or \fLJ\fR occur only for ranges.
  544. An \fLA\fR indicates that the following number, instead of being the range
  545. value is the run-time offset from the frame pointer of the range.
  546. A \fLT\fR indicates that the bound is adjustable at runtime and not
  547. determinable, as may be the case for FORTRAN array arguments.
  548. .PP
  549. It describes a floating-point or complex type if the \fLMaxValue\fR field is
  550. zero and the \fLMinValue\fR is greater than the \fLMaxValue\fR.
  551. In this case, the \fLMinValue\fR field gives the number of bytes occupied by
  552. values of the floating-point or complex type.
  553. The type is interpreted as complex if the name in the \fL.stabs\fR line is
  554. \fLcomplex\fR or \fLdouble complex\fR.
  555. .PP
  556. .NH 2
  557. Array Types
  558. .PP
  559. .PR Array "a IndexType ; ElementType"
  560. .PC IndexType Type
  561. .PC ElementType Type
  562. .PC DynArray "a r IndexType ; 0 ; A HighBound ; ElementType"
  563. .PC ConfArray "a C LowBound , HighBound , IndexType ; ElementType"
  564. .PC LowBound Number
  565. .PC HighBound Number
  566. .PP
  567. An \fLArray\fR defines an array type by giving the types of the indexes and
  568. elements.
  569. Multidimensional arrays are treated as if they were one-dimensional arrays
  570. of arrays.**
  571. .FS
  572. **See Appendix B, line 36 for an example.
  573. .FE
  574. .PP
  575. A \fLDynArray\fR defines a Modula-2 dynamic array type by giving the types
  576. of the indexes and elements and the high bound.
  577. Note that \fLDynArray\fR is identical to an ordinary array whose index is
  578. a range type (see Section 3.22).
  579. .PP
  580. A \fLConfArray\fR defines a Pascal conformant array type by giving the types
  581. of the indexes and elements and the low and high bounds.
  582. .PP
  583. .NH 2
  584. Record Types
  585. .PP
  586. .PR Record "s ByteSize FieldList"
  587. .PC FieldList "{FieldName : {Type | Variant} , BitOffset , BitSize ;}\*+"
  588. .PC Variant "Selector ; { Case ; }\*+"
  589. .PC Selector "v Flag : Type"
  590. .PC Case "{CaseValue ,}\*+ : FieldList"
  591. .PC FieldName Name
  592. .PC ByteSize Number
  593. .PC BitOffset Number
  594. .PC BitSize Number
  595. .PC CaseValue Number
  596. .PC Flag "0 | 1"
  597. .PP
  598. A \fLRecord\fR defines a record type, giving the size in bytes of an instance
  599. of the type and a description of each field.
  600. A field description includes its name, either a type or a variant description,
  601. bit offset within the record type and length in bits.
  602. A variant consists of the selector name and a series of cases.
  603. The flag in a selector indicates whether a variant record has a discriminant
  604. (\fL1\fR) or not (\fL0\fR).
  605. .PP
  606. .NH 2
  607. Set Types
  608. .PP
  609. .PR Set "S Type"
  610. .PP
  611. A \fLSet\fR defines a set type and specifies its base type.
  612. .PP
  613. .NH 2
  614. Pointer Types
  615. .PP
  616. .PR Pointer "* Type"
  617. .PP
  618. A \fLPointer\fR defines a pointer type and specifies its base type.
  619. .PP
  620. .NH 2
  621. Function and Procedure Types
  622. .PP
  623. .PR FuncType "Q ResultType , ParamNumber {; FormalType}*"
  624. .PC ParamNumber Number
  625. .PC FormalType "DataKind Type"
  626. .PP
  627. A \fLFuncType\fR defines a function or procedure type, giving its result type,
  628. the number of parameters expected and descriptions of the parameters.
  629. The \fLDataKind\fR field may be any of the type descriptors listed in
  630. Table 2 (Section 3.31) below.
  631. .PP
  632. .NH 2
  633. File Types (Pascal only)
  634. .PP
  635. .PR FileType "L Type"
  636. .PP
  637. A \fLFileType\fR describes a Pascal file type by giving its base type.
  638. .PP
  639. .NH 2
  640. Types Defined in Separate Units (Modula-2)
  641. .PP
  642. .PR SeparateType "I UnitNumber , Name"
  643. .PP
  644. A \fLSeparateType\fR describes a type defined in a different compiled unit in
  645. a Modula-2 program, giving its unit number and name.
  646. .PP
  647. .NH 2
  648. Summary of Symbol Descriptors
  649. .PP
  650. Table 2 lists the symbol descriptors currently in use, along with their
  651. meanings and the languages which generate them (C = C, F = FORTRAN 77,
  652. M = Modula-2, P = Pascal).
  653. .KF
  654. .sp 1
  655. .TS
  656. center box;
  657. c | c | c
  658. cfL | l | c.
  659. descriptor meaning languages
  660. _
  661. (empty) local variable C F M P
  662. d symbol defined in other scope M
  663. f local (function) procedure C P
  664. i value parameter by reference (indirect access) M
  665. p value parameter C F M P
  666. r register variable C
  667. t type name C F M P
  668. u symbol defined in a separate unit (module) M
  669. v variable parameter by reference F M P
  670. x conformant array value parameter P
  671. A bound value in parameter with specified offset F M
  672. C read-only parameter (conformant array bound) P
  673. E end of scope M
  674. F global (function) procedure C F P
  675. G global variable C F P
  676. M module M
  677. Q procedure or function M
  678. S static global variable C M
  679. T enumeration or structure type tag C
  680. U separate unit (module) M
  681. V common / static local variable F / C
  682. X function result variable F P
  683. .TE
  684. .ce
  685. Table 2. Symbol Descriptors
  686. .sp 1
  687. .KE
  688. .NH 2
  689. Summary of Type Descriptors
  690. .PP
  691. Table 3 lists the type descriptors which are currently in use,
  692. along with their meanings and the languages which generate them (C = C,
  693. F = FORTRAN 77, M = Modula-2, P = Pascal).
  694. .KF
  695. .sp 1
  696. .TS
  697. center box;
  698. c | c | c
  699. cfL | l | c.
  700. descriptor meaning languages
  701. _
  702. (empty) type reference C F M P
  703. a array type C F M P
  704. c conformant array P
  705. e enumeration type C M P
  706. f function type C
  707. r range type C F M P
  708. s record / structure type C M P
  709. u union specification C
  710. v variant specification P
  711. C lower and upper bound of a conformant array P
  712. F function parameter type P
  713. I separate type M
  714. L file type P
  715. P procedure parameter type P
  716. Q function or procedure type M
  717. S set type M P
  718. * pointer type C F M P
  719. .TE
  720. .ce
  721. Table 3. Type Descriptors
  722. .sp 1
  723. .KE
  724. .PP
  725. .NH 2
  726. Generating Object Code Instead of Assembly Language
  727. .PP
  728. Some compilers prefer to generate object code directly, rather than Sun
  729. assembly language.
  730. This section explains how to generate the appropriate code for the assembler
  731. symbols and \fL.stab\fR directives described above (linker symbols are
  732. generated automatically by the system linker).
  733. .PP
  734. In the Sun-2 and Sun-3 assemblers, the three types of directives
  735. .sp 1
  736. .in +1.0i
  737. \fL .stabs "\fIname\fL",\fItype\fL,0,\fIdesc\fL,\fIvalue\fR
  738. .sp 1
  739. \fL .stabn \fItype\fL,0,\fIdesc\fL,\fIvalue\fR
  740. .in -1.0i
  741. .sp 0.6
  742. and
  743. .sp 0.6
  744. .in +1.0i
  745. \fL .stabd \fItype\fL,0,\fIdesc\fR
  746. .in -1.0i
  747. .sp 1
  748. .LP
  749. generate records in the \fIa.out\fR symbol table which are described by
  750. variations of the C structure
  751. .ne 7
  752. .TS
  753. center;
  754. l l lw(1.5i) lw(1.0i) l lw(2.7i) l.
  755. \s-2\fLstruct nlist
  756. { long n_strx; /* \fRstring table index\fL */
  757. unsigned char n_type; /* \fRtype field\fL */
  758. char n_other; /* \fRunused\fL */
  759. short n_desc; /* \fRdesc field\fL */
  760. unsigned long n_value; /* \fRsymbol value or offset\fL */
  761. };\fR\s+2
  762. .TE
  763. with the variations as given by the field names, i.e. a \fL.stabs\fR directive
  764. fills all five fields, a \fL.stabn\fR directive defaults the \fLn_strx\fR
  765. field to zero, and a \fL.stabd\fR directive, in addition to defaulting
  766. \fLn_strx\fR, sets the \fLn_value\fR field to the current value of the
  767. assembler location counter.
  768. .PP
  769. Symbols generated by \fL.stab\fR directives are distinguished from assembler
  770. symbols by whether any of the bits in the mask \fLN_STAB\fR (with value
  771. \fL0xe0\fR) are set.
  772. .PP
  773. The \fLn_strx\fR field contains an index into the \fIa.out\fR string table for
  774. the string occurring in a \fL.stabs\fR directive.
  775. The string table consists of a 32-bit word containing the length of the table
  776. in bytes (including the length word) followed by a series of
  777. null-terminated strings.
  778. The index is the offset of the first character of a string from the first
  779. byte of the length word.
  780. .PP
  781. If the value field given in a \fL.stabd\fR directive is a symbol, the offset of
  782. the symbol from the beginning of the appropriate control section (text, data
  783. or bss) is placed in the \fLn_value\fR field.
  784. The current location is handled similarly for the \fL.stabd\fR directive.
  785. .PP
  786. Assembler symbols can be described in terms of the \fL.stabs\fR directives
  787. which would generate the same information.
  788. Their syntax is as follows:
  789. .PP
  790. .PR AssemblerSymbol ".stabs "" SymbolName "" , SymbolType , 0 , 0 , SymbolOffset
  791. .PC SymbolName Name
  792. .PC SymbolType "N_TEXT | TextExternal | N_DATA | DataExternal | N_BSS | BssExternal"
  793. .PC N_TEXT 0x04
  794. .PC TextExternal 0x05
  795. .PC N_DATA 0x06
  796. .PC DataExternal 0x07
  797. .PC N_BSS 0x08
  798. .PC BssExternal 0x09
  799. .PP
  800. The \fLSymbolName\fR and \fLSymbolOffset\fR are simply the text of the symbol
  801. and its offset within the text, data or bss space.
  802. The \fLSymbolType\fR indicates the address space and whether the symbol is
  803. external.
  804. External symbols are indicated by or'ing the value of \fLN_EXT\fR, which is
  805. \fL0x01\fR, with the type for the corresponding space.
  806. .PP
  807. .sp 1
  808. .NH 2
  809. Other Issues
  810. .PP
  811. There are several other things one needs to know to interface to the debuggers:
  812. .sp 0.5
  813. .IP 1.
  814. The debuggers require that a program include a routine named \fL_main\fR.
  815. If none is found, an internal error results.
  816. .IP 2.
  817. The debuggers assume the Sun standard format for the run-time stack.
  818. If yours differs, it may still be possible to interface to them.
  819. Contact us for more information.
  820. .PP
  821. .sp 1
  822. .NH 1
  823. The DP-UIP Interface Language
  824. .PP
  825. As mentioned above in Section 2, \fIdbxtool\fR consists of two processes, the
  826. DP (debugger process) and the UIP (user interface process).
  827. Commands passed from the DP to the UIP pass through a pipe which is created
  828. by the UIP when it starts the DP.
  829. The commands are expressed in the DP-UIP interface language, whose
  830. syntax and semantics appear below.
  831. .NH 2
  832. What the UIP and DP Know About Each Other
  833. .PP
  834. In the current version of \fIdbxtool\fR there are several assumptions which
  835. the UIP makes about the DP and vice versa, as follows:
  836. .IP 1.
  837. The name of the program which the UIP starts is \fLdbx\fR.
  838. To do so, it calls \fLttysw_fork(\ )\fR with its second argument set to a
  839. pointer to an array \fLnargv[ ]\fR of character strings of the form
  840. .TS
  841. center;
  842. lfL l.
  843. nargv[0] \fLdbx\fR
  844. nargv[1] \fL-P\fR
  845. nargv[2] \fIpipenumber\fR
  846. nargv[3] \v'0.02i'\(rt\v'-0.02i'
  847. ... \(rk \fIarguments\fR
  848. nargv[\fIn\fR] \v'-0.02i'\(rb\v'0.02i'
  849. .TE
  850. where \fIpipenumber\fR is the number of the pipe which the DP uses in writing
  851. to the UIP and \fIarguments\fR are the arguments with which \fIdbxtool\fR
  852. was invoked.
  853. .IP 2.
  854. The sequence of directories to search for source files (provided by
  855. the \fIuse\fR command in \fIdbx\fR and \fIdbxtool\fR) is passed by the
  856. DP to the UIP (via the \fLI_USE\fR command described below) and used by it
  857. to display source in the source window.
  858. .IP 3.
  859. The lineno selection interpretation is expanded into the form
  860. "\fIfilename\fR":\fIlineno\fR before it is passed to the DP.
  861. .IP 4.
  862. The UIP's command button mechanism assumes that the DP expects commands in
  863. prefix form, i.e. with the command name first, and with a blank separating
  864. the name from the following argument (if any).
  865. Further, for the command buttons to be really useful it must be the case that
  866. the DP's most used commands take either zero or one argument, since the
  867. argument selection mechanism cannot accomodate more than one selection per
  868. command.
  869. .PP
  870. .NH 2
  871. Commands and Type Identifiers
  872. .PP
  873. .PR Command "VersionCheck | InitDone | Stopped | Quit | PrintLines | BreakSet | BreakDel | Resume | Use | Reinit | Kill | Chdir | Emphasize | Trace | Display | ToolEnv | Width | SourceLines | CommandLines | DisplayLines | Font | TopMargin | BotMargin | Un
  874. button | Button"
  875. .PP
  876. Each command and argument begins with a type identifier which indicates the
  877. command or the type of the argument.
  878. The mapping between integers and type identifiers is given in Table 4.
  879. .KF
  880. .sp 1
  881. .TS
  882. center box;
  883. n | lfL.
  884. 0 I_BADTYPE
  885. 1 I_INITDONE
  886. 2 I_STOPPED
  887. 3 I_STRING
  888. 4 I_INT
  889. 5 I_QUIT
  890. 6 I_PRINTLINES
  891. 7 I_BRKSET
  892. 8 I_BRKDEL
  893. 9 I_RESUME
  894. 10 I_USE
  895. 11 I_REINIT
  896. 12 I_KILL
  897. 13 I_CHDIR
  898. 14 I_EMPHASIZE
  899. 15 I_TRACE
  900. 16 I_DISPLAY
  901. 17 I_VERSION
  902. 18 I_TOOLENV
  903. 19 I_WIDTH
  904. 20 I_SRCLINES
  905. 21 I_CMDLINES
  906. 22 I_DISPLINES
  907. 23 I_FONT
  908. 24 I_TOPMARGIN
  909. 25 I_BOTMARGIN
  910. 26 I_UNBUTTON
  911. 27 I_BUTTON
  912. .TE
  913. .ce
  914. Table 4. Command and Type Identifiers
  915. .sp 1
  916. .KE
  917. .PP
  918. .NH 2
  919. Version Consistency Checking
  920. .PP
  921. .PR VersionCheck "I_VERSION VersionNumber"
  922. .PP
  923. The DP issues this command during initialization to insure that the versions
  924. of the DP and UIP being run are consistent with each other.
  925. It tells the UIP the version number of the DP, which must match that of the
  926. UIP.
  927. It must be the first command issued.
  928. .PP
  929. .NH 2
  930. Initialization Finished
  931. .PP
  932. .PR InitDone "I_INITDONE FileName LineNumber"
  933. .PP
  934. The DP issues this command to inform the UIP that it has completed initializing
  935. itself.
  936. It tells the UIP the name of the source file to display and the line number of
  937. the line to appear at the top of the source window.
  938. .PP
  939. .NH 2
  940. Breakpoint Reached
  941. .PP
  942. .PR Stopped "I_STOPPED FileName FuncName LineNumber BreakFile BreakFunc BreakLine"
  943. .PP
  944. This command indicates that a breakpoint has been reached and tells the
  945. UIP the filename, function name and line number of the point currently
  946. being displayed and the same information concerning the breakpoint.
  947. .PP
  948. .NH 2
  949. Terminate \fIDbxtool\fR
  950. .PP
  951. .PR Quit "I_QUIT ExitStatus"
  952. .PP
  953. This command tells the UIP to terminate execution of \fIdbxtool\fR and return
  954. the given exit status to the shell which invoked it.
  955. .PP
  956. .NH 2
  957. Print Source Lines
  958. .PP
  959. .PR PrintLines "I_PRINTLINES FileName LineNumber LineNumber"
  960. .PP
  961. This command specifies a filename and two line numbers, the second of which
  962. is ignored by the UIP.
  963. It causes the UIP to display lines from the given file in the source window.
  964. .PP
  965. .NH 2
  966. Set a Breakpoint
  967. .PP
  968. .PR BreakSet "I_BRKSET FileName LineNumber"
  969. .PP
  970. This command tells the UIP to display a stop sign on the given line
  971. of the given file.
  972. .PP
  973. .NH 2
  974. Delete a Breakpoint
  975. .PP
  976. .PR BreakDel "I_BRKDEL FileName LineNumber"
  977. .PP
  978. This command tells the UIP to remove a stop sign from the given line
  979. of the given file.
  980. .PP
  981. .NH 2
  982. Ready to Resume Execution
  983. .PP
  984. .PR Resume "I_RESUME"
  985. .PP
  986. This command tells the UIP that the DP is ready to resume execution of the
  987. process being debugged.
  988. .PP
  989. .NH 2
  990. Specify Directory Search Path
  991. .PP
  992. .PR Use "I_USE DirNumber Directory*"
  993. .PP
  994. This command specifies to the UIP the search path to be used in locating
  995. source files.
  996. It specifies the number of directories followed by their names.
  997. .PP
  998. .NH 2
  999. Reinitialize the Debugger
  1000. .PP
  1001. .PR Reinit "I_REINIT"
  1002. .PP
  1003. This command indicates that the debugger is being reinitialized to debug
  1004. another process.
  1005. .PP
  1006. .NH 2
  1007. Kill the Process Being Debugged
  1008. .PP
  1009. .PR Kill "I_KILL"
  1010. .PP
  1011. This command informs the UIP that the process being debugged has been
  1012. discarded by the DP.
  1013. .PP
  1014. .NH 2
  1015. Change Directory
  1016. .PP
  1017. .PR Chdir "I_CHDIR Directory"
  1018. .PP
  1019. This command tells the UIP to change its notion of the current directory
  1020. to the one specified.
  1021. .PP
  1022. .NH 2
  1023. Display and Highlight Source Lines
  1024. .PP
  1025. .PR Emphasize "I_EMPHASIZE FileName LineNumber"
  1026. .PP
  1027. This command tells the UIP to highlight the given source line (and to display
  1028. it if it is not already displayed).
  1029. .PP
  1030. .NH 2
  1031. Display and Highlight Traced Lines
  1032. .PP
  1033. .PR Trace "I_TRACE BreakFile BreakFunc BreakLine"
  1034. .PP
  1035. This command tells the UIP to highlight the given source line and display the
  1036. arrow indicating the execution focus next to it (and to display it if it
  1037. is not already displayed).
  1038. .PP
  1039. .NH 2
  1040. Update Variable Display
  1041. .PP
  1042. .PR Display "I_DISPLAY DisplayFile"
  1043. .PP
  1044. This command tells the UIP to update the variable display window by
  1045. showing the contents of the given file.
  1046. .PP
  1047. .NH 2
  1048. Print the Tool Environment
  1049. .PP
  1050. .PR ToolEnv "I_TOOLENV"
  1051. .PP
  1052. This command causes the UIP to print the current tool environment parameters.
  1053. .PP
  1054. .NH 2
  1055. Specify Width of Window
  1056. .PP
  1057. .PR Width "I_WIDTH Number"
  1058. .PP
  1059. This command causes the UIP to change the width of the window to the
  1060. given number of characters.
  1061. .PP
  1062. .NH 2
  1063. Specify Number of Lines in Source Window
  1064. .PP
  1065. .PR SourceLines "I_SRCLINES NumberLines"
  1066. .PP
  1067. This command causes the UIP to set the vertical size of the source window to
  1068. the given number of lines.
  1069. .PP
  1070. .NH 2
  1071. Specify Number of Lines in Command Window
  1072. .PP
  1073. .PR CommandLines "I_CMDLINES NumberLines"
  1074. .PP
  1075. This command causes the UIP to set the vertical size of the command window to
  1076. the given number of lines.
  1077. .PP
  1078. .NH 2
  1079. Specify Number of Lines in Display Window
  1080. .PP
  1081. .PR DisplayLines "I_DISPLINES NumberLines"
  1082. .PP
  1083. This command causes the UIP to set the vertical size of the display window to
  1084. the given number of lines.
  1085. .PP
  1086. .NH 2
  1087. Change Font
  1088. .PP
  1089. .PR Font "I_FONT FontFile"
  1090. .PP
  1091. This command causes the UIP to using the font given in the specified font file.
  1092. .PP
  1093. .NH 2
  1094. Change Top Margin of Source Window
  1095. .PP
  1096. .PR TopMargin "I_TOPMARGIN NumberLines"
  1097. .PP
  1098. This command causes the UIP to set the number of lines between the top of the
  1099. source window and the first line containing a breakpoint or the current
  1100. execution focus.
  1101. .PP
  1102. .NH 2
  1103. Change Bottom Margin of Source Window
  1104. .PP
  1105. .PR BotMargin "I_BOTMARGIN NumberLines"
  1106. .PP
  1107. This command causes the UIP to set the number of lines between the bottom
  1108. of the source window and the last line containing a breakpoint or the current
  1109. execution focus.
  1110. .PP
  1111. .NH 2
  1112. Remove a Button from the Buttons Window
  1113. .PP
  1114. .PR Unbutton "I_UNBUTTON ButtonName"
  1115. .PP
  1116. This command causes the UIP to remove from the buttons window the first button
  1117. with the given name.
  1118. .PP
  1119. .NH 2
  1120. Add a Button to the Buttons Window
  1121. .PP
  1122. .PR Button "I_BUTTON SelectionType ButtonName"
  1123. .PP
  1124. This command causes the UIP to add to the buttons window a button with the
  1125. indicated selection interpretation and name.
  1126. The mapping between selection type numbers and selection interpretations
  1127. and their meanings is given in Table 5.
  1128. .KF
  1129. .sp 1
  1130. .TS
  1131. center box;
  1132. c | c | cw(3.5i)
  1133. n | l | lw(3.5i).
  1134. type name meaning
  1135. _
  1136. 1 command T{
  1137. the selection, which must be in the command window, is expanded to produce
  1138. the command which contains it
  1139. T}
  1140. _
  1141. 2 expand T{
  1142. the selection produces exactly the selected text, except that if either
  1143. its first or last character is an alphanumeric or an underscore it is
  1144. expanded to produce the longest enclosing sequence of alphanumerics and
  1145. underscores
  1146. T}
  1147. _
  1148. 3 ignore T{
  1149. the selection is ignored, producing the null string
  1150. T}
  1151. _
  1152. 4 lineno T{
  1153. the selection, which must be in the source window, produces a string of the
  1154. form "\fIfilename\fR":\fIlineno\fR, where \fIfilename\fR is the name of the
  1155. file displayed in the source window and \fIlineno\fR is the line number of
  1156. the selected line
  1157. T}
  1158. _
  1159. 5 literal T{
  1160. the selection produces exactly the selected text
  1161. T}
  1162. .TE
  1163. .ce
  1164. Table 5. Selection Interpretations
  1165. .sp 1
  1166. .KE
  1167. .PP
  1168. .NH 2
  1169. Other Items
  1170. .PP
  1171. .PR SelectionType Number
  1172. .PC FileName String
  1173. .PC LineNumber Number
  1174. .PC FuncName String
  1175. .PC BreakFile String
  1176. .PC BreakFunc String
  1177. .PC BreakLine Number
  1178. .PC ExitStatus Number
  1179. .PC DirNumber Number
  1180. .PC Directory String
  1181. .PC DisplayFile String
  1182. .PC NumberLines Number
  1183. .PC FontFile String
  1184. .PC ButtonName String
  1185. .PP
  1186. .NH 2
  1187. Numbers and Strings
  1188. .PP
  1189. .PR Number "I_INT Integer"
  1190. .PC String "I_STRING StringLen Character*"
  1191. .PC StringLen Integer
  1192. .PP
  1193. A number is a 32-bit integer.
  1194. A string consists of a 32-bit integer followed by a sequence of that many
  1195. characters.
  1196. .PP
  1197. .bp
  1198. .ce
  1199. \s+2\fBAppendix A. Standard Types for Sun C, FORTRAN 77, Pascal
  1200. .ce
  1201. and Modula-2\fR\s-2
  1202. .sp 1
  1203. .PP
  1204. Each language defines some standard types by a series of \fL.stabs\fR
  1205. lines, as follows.
  1206. For C***, they are
  1207. .FS
  1208. ***The "\fL???\fR" entry at the end is a debugging artifact.
  1209. It serves no purpose in ordinary usage of \fIdbx\fR.
  1210. .FE
  1211. .sp 1
  1212. .in +0.75i
  1213. .nf
  1214. \fL\s-2
  1215. .stabs "int:t(0,1)=r(0,1);-2147483648;2147483647;",0x80,0,0,0
  1216. .stabs "char:t(0,2)=r(0,2);0;127;",0x80,0,0,0
  1217. .stabs "long:t(0,3)=r(0,1);-2147483648;2147483647;",0x80,0,0,0
  1218. .stabs "short:t(0,4)=r(0,1);-32768;32767;",0x80,0,0,0
  1219. .stabs "unsigned char:t(0,5)=r(0,1);0;255;",0x80,0,0,0
  1220. .stabs "unsigned short:t(0,6)=r(0,1);0;65535;",0x80,0,0,0
  1221. .stabs "unsigned long:t(0,7)=r(0,1);0;-1;",0x80,0,0,0
  1222. .stabs "unsigned int:t(0,8)=r(0,1);0;-1;",0x80,0,0,0
  1223. .stabs "float:t(0,9)=r(0,1);4;0;",0x80,0,0,0
  1224. .stabs "double:t(0,10)=r(0,1);8;0;",0x80,0,0,0
  1225. .stabs "void:t(0,11)=(0,11)",0x80,0,0,0
  1226. .stabs "???:t(0,12)=(0,1)",0x80,0,0,0
  1227. \fR\s+2
  1228. .fi
  1229. .in -0.75i
  1230. .sp 1
  1231. For FORTRAN 77, they are
  1232. .sp 1
  1233. .in +0.75i
  1234. .nf
  1235. \fL\s-2
  1236. .stabs "integer*2:t2=r2;-32768;32767;",0x20,0,0,0
  1237. .stabs "integer*4:t3=r3;-2147483648;2147483647;",0x20,0,0,0
  1238. .stabs "real:t5=r5;4;0;",0x20,0,0,0
  1239. .stabs "double precision:t6=r6;8;0;",0x20,0,0,0
  1240. .stabs "complex:t7=r7;8;0;",0x20,0,0,0
  1241. .stabs "double complex:t8=r8;16;0;",0x20,0,0,0
  1242. .stabs "logical:t9=3;",0x20,0,0,0
  1243. .stabs "char:t10=r10;0;127;",0x20,0,0,0
  1244. .stabs "void:t11=r11;0;0;",0x20,0,0,0
  1245. \fR\s+2
  1246. .fi
  1247. .in -0.75i
  1248. .sp 1
  1249. For Pascal, they are
  1250. .sp 1
  1251. .in +0.75i
  1252. .nf
  1253. \fL\s-2
  1254. .stabs "boolean:t1=efalse:0,true:1,",0x20,0x0,0x0,0x0
  1255. .stabs "char:t2=r2;0;127",0x20,0x0,0x0,0x0
  1256. .stabs "integer:t3=r3;-2147483648;2147483647",0x20,0x0,0x0,0x0
  1257. .stabs "shortreal:t4=r4;4;0",0x20,0x0,0x0,0x0
  1258. .stabs "real:t5=r5;8;0",0x20,0x0,0x0,0x0
  1259. .stabs "(void):t6=6",0x20,0x0,0x0,0x0
  1260. .stabs "Boolean:t1",0x20,0x0,0x0,0x0
  1261. .stabs "intset:t7=Sr3;0;127",0x20,0x0,0x0,0x0
  1262. .stabs "alfa:t8=ar3;1;10;2",0x20,0x0,0x0,0x0
  1263. .stabs "text:t9=L2",0x20,0x0,0x0,0x0
  1264. .stabs "longreal:t5",0x20,0x0,0x0,0x0
  1265. \fR\s+2
  1266. .fi
  1267. .in -0.75i
  1268. .sp 1
  1269. .ne 10
  1270. For Modula-2, they are
  1271. .sp 1
  1272. .in +0.75i
  1273. .nf
  1274. \fL\s-2
  1275. .stabs "INTEGER:t1=r1;-2147483648;2147483647", 0x80, 0, 4, 0
  1276. .stabs "SHORTINT:t2=r1;-32768;32767", 0x80, 0, 2, 0
  1277. .stabs "CARDINAL:t3=r3;0;-1", 0x80, 0, 4, 0
  1278. .stabs "SHORTCARD:t4=r3;0;65535", 0x80, 0, 2, 0
  1279. .stabs "CHAR:t5=r5;0;255", 0x80, 0, 1, 0
  1280. .stabs "BOOLEAN:t6=eFALSE:0,TRUE:1,", 0x80, 0, 1, 0
  1281. .stabs "REAL:t7=r7;4;0", 0x80, 0, 4, 0
  1282. .stabs "(void):t8=8", 0x80, 0, 4, 0
  1283. .stabs "PROC:t9=Q8,0", 0x80, 0, 4, 0
  1284. .stabs "BITSET:t10=Sr3;0;31", 0x80, 0, 4, 0
  1285. .stabs "BYTE:t11=r11;0;255", 0x80, 0, 1, 0
  1286. .stabs "WORD:t12=r12;0;-1", 0x80, 0, 4, 0
  1287. .stabs "ADDRESS:t13=r3;0;-1", 0x80, 0, 4, 0
  1288. .stabs "PROCESS:t14=*12", 0x80, 0, 4, 0
  1289. \fR\s+2
  1290. .fi
  1291. .in -0.75i
  1292. .sp 1
  1293. .bp
  1294. .ce
  1295. \s+2\fBAppendix B. An Example of the Compiler-Debugger Interface\fR\s-2
  1296. .sp 1
  1297. .PP
  1298. This appendix gives an example of the code generated by the Sun C compiler
  1299. to interface to the \fIdbx\fR and \fIdbxtool\fR debuggers.
  1300. We take as our example the (nonsense) C program
  1301. .sp 1
  1302. .in +1.0i
  1303. .nf
  1304. \fL
  1305. int a;
  1306. static int b;
  1307. static void l( );
  1308. main (d)
  1309. register short int d;
  1310. { int e[10][20];
  1311. static int g = 3;
  1312. register int h;
  1313. struct i {
  1314. int j;
  1315. float k;
  1316. } i;
  1317. a = 2;
  1318. i.j = b;
  1319. l( );
  1320. }
  1321. static void l()
  1322. {
  1323. b = 3;
  1324. }
  1325. \fR
  1326. .fi
  1327. .in -1.0i
  1328. .LP
  1329. Compiling this program with \fLcc -g -S example.c\fR results in the following
  1330. assembly code in \fLexample.s\fR (with line numbers supplied at the left):
  1331. .TS
  1332. nw(0.4i) lw(0.7i)fL lw(0.9i)fL lfL.
  1333. \s-2
  1334. 1 .stabs "example.c",0x64,0,0,LL0
  1335. 2 LL0:
  1336. 3 .data
  1337. 4 .stabs "int:t(0,1)=r(0,1);-2147483648;2147483647;",
  1338. 0x80,0,0,0
  1339. 5 .stabs "char:t(0,2)=r(0,2);0;127;",0x80,0,0,0
  1340. 6 .stabs "long:t(0,3)=r(0,1);-2147483648;2147483647;",
  1341. 0x80,0,0,0
  1342. 7 .stabs "short:t(0,4)=r(0,1);-32768;32767;",0x80,0,0,0
  1343. 8 .stabs "unsigned char:t(0,5)=r(0,1);0;255;",
  1344. 0x80,0,0,0
  1345. 9 .stabs "unsigned short:t(0,6)=r(0,1);0;65535;",
  1346. 0x80,0,0,0
  1347. 10 .stabs "unsigned long:t(0,7)=r(0,1);0;-1;",0x80,0,0,0
  1348. 11 .stabs "unsigned int:t(0,8)=r(0,1);0;-1;",0x80,0,0,0
  1349. 12 .stabs "float:t(0,9)=r(0,1);4;0;",0x80,0,0,0
  1350. 13 .stabs "double:t(0,10)=r(0,1);8;0;",0x80,0,0,0
  1351. 14 .stabs "void:t(0,11)=(0,11)",0x80,0,0,0
  1352. 15 .stabs "???:t(0,12)=(0,1)",0x80,0,0,0
  1353. 16 .stabs "a:G(0,1)",0x20,0,4,0
  1354. 17 .comm _a,0x4
  1355. 18 .stabs "b:S(0,1)",0x28,0,4,_b
  1356. 19 .lcomm _b,4
  1357. 20 ||| no info for l (18)
  1358. 21 .stabs "main:F(0,1)",0x24,0,4,_main
  1359. 22 .stabs "d:r(0,4)",0x40,0,2,7
  1360. 23 .stabs "d:p(0,4)",0xa0,0,2,8
  1361. 24 .text
  1362. 25 .stabn 0x44,0,8,LL1
  1363. 26 LL1:
  1364. 27 | #PROC# 04
  1365. 28 .globl _main
  1366. 29 _main:
  1367. 30 link a6,#0
  1368. 31 addl #-LF14,sp
  1369. 32 moveml #LS14,sp@
  1370. 33 movw a6@(10),d7
  1371. 34 .stabn 0x44,0,8,LL2
  1372. 35 LL2:
  1373. 36 .stabs "e:(0,13)=ar(0,1);0;9;(0,14)=ar(0,1);0;19;(0,1)",
  1374. 0x80,0,4,-800
  1375. 37 .stabs "g:V(0,1)",0x26,0,4,L16
  1376. 38 .data
  1377. 39 .even
  1378. 40 L16:
  1379. 41 .text
  1380. 42 .data
  1381. 43 .long 0x3
  1382. 44 .stabs "h:r(0,1)",0x40,0,4,6
  1383. 45 .stabs "i:T(0,15)=s8j:(0,1),0,32;k:(0,9),32,32;;",
  1384. 0x80,0,8,-1275
  1385. 46 .stabs "i:(0,15)",0x80,0,8,-808
  1386. 47 .stabn 0xc0,0,2,LL3
  1387. 48 LL3:
  1388. 49 .text
  1389. 50 .stabn 0x44,0,16,LL4
  1390. 51 LL4:
  1391. 52 movl #0x2,_a
  1392. 53 .stabn 0x44,0,17,LL5
  1393. 54 LL5:
  1394. 55 movl _b,a6@(-0x328)
  1395. 56 .stabn 0x44,0,18,LL6
  1396. 57 LL6:
  1397. 58 jbsr _l
  1398. 59 .stabn 0xe0,0,2,LL7
  1399. 60 LL7:
  1400. 61 .stabn 0x44,0,19,LL8
  1401. 62 LL8:
  1402. 63 LE14:
  1403. 64 moveml a6@(-0x32c),#0x80
  1404. 65 unlk a6
  1405. 66 rts
  1406. 67 LF14 = 812
  1407. 68 LS14 = 0x80
  1408. 69 LFF14 = 808
  1409. 70 LSS14 = 0x0
  1410. 71 LP14 = 0x8
  1411. 72 .data
  1412. 73 .stabs "l:f(0,11)",0x24,0,0,_l
  1413. 74 .text
  1414. 75 .stabn 0x44,0,22,LL9
  1415. 76 LL9:
  1416. 77 | #PROC# 0
  1417. 78 _l:
  1418. 79 link a6,#0
  1419. 80 addl #-LF17,sp
  1420. 81 moveml #LS17,sp@
  1421. 82 .stabn 0x44,0,22,LL10
  1422. 83 LL10:
  1423. 84 .stabn 0x44,0,23,LL11
  1424. 85 LL11:
  1425. 86 movl #0x3,_b
  1426. 87 .stabn 0x44,0,24,LL12
  1427. 88 LL12:
  1428. 89 LE17:
  1429. 90 unlk a6
  1430. 91 rts
  1431. 92 LF17 = 0
  1432. 93 LS17 = 0x0
  1433. 94 LFF17 = 0
  1434. 95 LSS17 = 0x0
  1435. 96 LP17 = 0x8
  1436. 97 .data
  1437. \s+2
  1438. .TE
  1439. .LP
  1440. The following commentary is keyed to the line numbers appearing at the left.
  1441. .IP 1: 0.75i
  1442. Identifies the source file from which the program was compiled.
  1443. .IP "4 - 15:" 0.75i
  1444. The C standard types, generated automatically by the compiler.
  1445. Line 4, for example, defines \fLint\fR to be type number \fL(0,1)\fR, to be
  1446. a subrange of itself with values extending from \fL-2147483648\fR through
  1447. \fL2147483647\fR and to be local.
  1448. .IP "16 - 17:" 0.75i
  1449. The variable \fLa\fR is identified as being a global \fLint\fR
  1450. ("\fLG(0,1)\fR") and as occupying 4 bytes of storage.
  1451. Its address is given by the assembler symbol \fL_a\fR.
  1452. .IP "18 - 19:" 0.75i
  1453. The variable \fLb\fR is identified as being a static global \fLint\fR
  1454. ("\fLS(0,1)\fR") occupying 4 bytes of storage an with address \fL_b\fR.
  1455. .IP 20: 0.75i
  1456. The information about \fLl\fR will come later when it is declared (see
  1457. line 73).
  1458. .IP 21: 0.75i
  1459. The symbol \fLmain\fR is identified as a function returning an \fLint\fR
  1460. ("\fLF(0,1)\fR") and as beginning at the assembler symbol \fL_main\fR.
  1461. .IP "22 - 23:" 0.75i
  1462. The symbol \fLd\fR is a \fLshort int\fR parameter ("\fLp(0,4)\fR") and a
  1463. register variable ("\fLr(0,4)\fR") occupying in register d7.
  1464. .IP 25: 0.75i
  1465. This entry represents a bug discovered in the C compiler discovered during
  1466. preparation of this document.
  1467. The entry on line 34 is the correct one (\fIq.v.\fR)
  1468. The bug causes no errors in the debugger since the second (correct) entry for
  1469. line 8 simply supplants this one.
  1470. .IP 34: 0.75i
  1471. Identifies the first line of \fLexample.c\fR for which any executable code is
  1472. generated as line 8 and as corresponding to assembly label \fLLL2\fR.
  1473. Line 8 is the entry point of \fLmain\fR.
  1474. .IP 36: 0.75i
  1475. Identifies the symbol \fLe\fR as an array of arrays with anonymous type
  1476. \fL(0,13)\fR.
  1477. Its subscript is a subrange of \fLint\fR with range \fL0\fR through \fL9\fR
  1478. and its elements are arrays with anonymous type \fL(0,14)\fR, which in turn
  1479. is an array whose subscript is a subrange of \fLint\fR with range \fL0\fR
  1480. through \fL19\fR and element type \fLint\fR.
  1481. Its stack offset is -800.
  1482. .IP 37: 0.75i
  1483. Identifies the symbol \fLg\fR as a static local variable of type \fLint\fR
  1484. ("\fLV(0,1)\fR") located at label \fLL16\fR.
  1485. .IP 44: 0.75i
  1486. The variable \fLh\fR is identified as being a \fLregister int\fR
  1487. ("\fLr(0,1)\fR") occupying register d6.
  1488. .IP 45: 0.75i
  1489. Identifies the symbol \fLi\fR as a structure tag of anonymous type
  1490. \fL(0,15)\fR.
  1491. Type \fL(0,15)\fR is defined as a structure type occupying 8 bytes with fields
  1492. named \fLj\fR and \fLk\fR.
  1493. Field \fLj\fR is of type \fLint\fR, begins at bit offset zero and runs for
  1494. 32 bits; field \fLk\fR is of type \fLfloat\fR, begins at bit offset 32 and
  1495. runs for 32 bits.
  1496. .IP 46: 0.75i
  1497. Identifies the symbol \fLi\fR as a local variable of type \fL(0,15)\fR
  1498. occupying eight bytes and located at stack offset -808.
  1499. .IP 47: 0.75i
  1500. Identifies a level 2 scope beginning at label \fLLL3\fR.
  1501. .IP 59: 0.75i
  1502. Identifies a level 2 scope ending at label \fLLL7\fR.
  1503. .IP 73: 0.75i
  1504. Identifies \fLl\fR as a local function returning \fLvoid\fR and beginning at
  1505. symbol \fL_l\fR.
  1506. .IP "75 & 82:" 0.75i
  1507. These two lines represent the same harmless C compiler bug as do lines 25 and
  1508. 34.