symbols.h 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675
  1. /*++
  2. Copyright (c) 2012 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. symbols.h
  9. Abstract:
  10. This header contains definitions for the generic debugger symbol
  11. information.
  12. Author:
  13. Evan Green 1-Jul-2012
  14. --*/
  15. //
  16. // ---------------------------------------------------------------- Definitions
  17. //
  18. #define MAX_RANGE_STRING 32
  19. //
  20. // ------------------------------------------------------ Data Type Definitions
  21. //
  22. typedef struct _STRUCTURE_MEMBER STRUCTURE_MEMBER, *PSTRUCTURE_MEMBER;
  23. typedef struct _ENUMERATION_MEMBER ENUMERATION_MEMBER, *PENUMERATION_MEMBER;
  24. typedef struct _DEBUG_SYMBOLS DEBUG_SYMBOLS, *PDEBUG_SYMBOLS;
  25. typedef struct _DATA_SYMBOL DATA_SYMBOL, *PDATA_SYMBOL;
  26. typedef struct _SOURCE_FILE_SYMBOL SOURCE_FILE_SYMBOL, *PSOURCE_FILE_SYMBOL;
  27. typedef struct _FUNCTION_SYMBOL FUNCTION_SYMBOL, *PFUNCTION_SYMBOL;
  28. typedef enum _DATA_TYPE_TYPE {
  29. DataTypeInvalid,
  30. DataTypeRelation,
  31. DataTypeNumeric,
  32. DataTypeStructure,
  33. DataTypeEnumeration,
  34. DataTypeFunctionPointer,
  35. DataTypeNumberOfTypes
  36. } DATA_TYPE_TYPE, *PDATA_TYPE_TYPE;
  37. typedef enum _X86_REGISTER {
  38. X86RegisterEax,
  39. X86RegisterEcx,
  40. X86RegisterEdx,
  41. X86RegisterEbx,
  42. X86RegisterEsp,
  43. X86RegisterEbp,
  44. X86RegisterEsi,
  45. X86RegisterEdi,
  46. X86RegisterEip,
  47. X86RegisterEflags,
  48. X86RegisterCs,
  49. X86RegisterSs,
  50. X86RegisterDs,
  51. X86RegisterEs,
  52. X86RegisterFs,
  53. X86RegisterGs,
  54. X86RegisterSt0,
  55. X86RegisterSt1,
  56. X86RegisterSt2,
  57. X86RegisterSt3,
  58. X86RegisterSt4,
  59. X86RegisterSt5,
  60. X86RegisterSt6,
  61. X86RegisterSt7,
  62. X86RegisterCtrl,
  63. X86RegisterStat,
  64. X86RegisterTag,
  65. X86RegisterFpcs,
  66. X86RegisterFpIp,
  67. X86RegisterFpDs,
  68. X86RegisterFpDo
  69. } X86_REGISTER, *PX86_REGISTER;
  70. typedef enum _ARM_REGISTER {
  71. ArmRegisterR0,
  72. ArmRegisterR1,
  73. ArmRegisterR2,
  74. ArmRegisterR3,
  75. ArmRegisterR4,
  76. ArmRegisterR5,
  77. ArmRegisterR6,
  78. ArmRegisterR7,
  79. ArmRegisterR8,
  80. ArmRegisterR9,
  81. ArmRegisterR10,
  82. ArmRegisterR11,
  83. ArmRegisterR12,
  84. ArmRegisterR13,
  85. ArmRegisterR14,
  86. ArmRegisterR15,
  87. ArmRegisterSpsr = 128,
  88. ArmRegisterSpsrFiq,
  89. ArmRegisterSpsrIrq,
  90. ArmRegisterSpsrAbort,
  91. ArmRegisterSpsrUndefined,
  92. ArmRegisterSpsrSvc,
  93. ArmRegisterR8User = 144,
  94. ArmRegisterR9User,
  95. ArmRegisterR10User,
  96. ArmRegisterR11User,
  97. ArmRegisterR12User,
  98. ArmRegisterR13User,
  99. ArmRegisterR14User,
  100. ArmRegisterR8Fiq,
  101. ArmRegisterR9Fiq,
  102. ArmRegisterR10Fiq,
  103. ArmRegisterR11Fiq,
  104. ArmRegisterR12Fiq,
  105. ArmRegisterR13Fiq,
  106. ArmRegisterR14Fiq,
  107. ArmRegisterR8Irq,
  108. ArmRegisterR9Irq,
  109. ArmRegisterR10Irq,
  110. ArmRegisterR11Irq,
  111. ArmRegisterR12Irq,
  112. ArmRegisterR13Irq,
  113. ArmRegisterR14Irq,
  114. ArmRegisterR8Abort,
  115. ArmRegisterR9Abort,
  116. ArmRegisterR10Abort,
  117. ArmRegisterR11Abort,
  118. ArmRegisterR12Abort,
  119. ArmRegisterR13Abort,
  120. ArmRegisterR14Abort,
  121. ArmRegisterR8Undefined,
  122. ArmRegisterR9Undefined,
  123. ArmRegisterR10Undefined,
  124. ArmRegisterR11Undefined,
  125. ArmRegisterR12Undefined,
  126. ArmRegisterR13Undefined,
  127. ArmRegisterR14Undefined,
  128. ArmRegisterR8Svc,
  129. ArmRegisterR9Svc,
  130. ArmRegisterR10Svc,
  131. ArmRegisterR11Svc,
  132. ArmRegisterR12Svc,
  133. ArmRegisterR13Svc,
  134. ArmRegisterR14Svc,
  135. ArmRegisterD0 = 256,
  136. ArmRegisterD1,
  137. ArmRegisterD2,
  138. ArmRegisterD3,
  139. ArmRegisterD4,
  140. ArmRegisterD5,
  141. ArmRegisterD6,
  142. ArmRegisterD7,
  143. ArmRegisterD8,
  144. ArmRegisterD9,
  145. ArmRegisterD10,
  146. ArmRegisterD11,
  147. ArmRegisterD12,
  148. ArmRegisterD13,
  149. ArmRegisterD14,
  150. ArmRegisterD15,
  151. ArmRegisterD16,
  152. ArmRegisterD17,
  153. ArmRegisterD18,
  154. ArmRegisterD19,
  155. ArmRegisterD20,
  156. ArmRegisterD21,
  157. ArmRegisterD22,
  158. ArmRegisterD23,
  159. ArmRegisterD24,
  160. ArmRegisterD25,
  161. ArmRegisterD26,
  162. ArmRegisterD27,
  163. ArmRegisterD28,
  164. ArmRegisterD29,
  165. ArmRegisterD30,
  166. ArmRegisterD31,
  167. } ARM_REGISTER, *PARM_REGISTER;
  168. typedef enum _X64_REGISTER {
  169. X64RegisterRax,
  170. X64RegisterRdx,
  171. X64RegisterRcx,
  172. X64RegisterRbx,
  173. X64RegisterRsi,
  174. X64RegisterRdi,
  175. X64RegisterRbp,
  176. X64RegisterRsp,
  177. X64RegisterR8,
  178. X64RegisterR9,
  179. X64RegisterR10,
  180. X64RegisterR11,
  181. X64RegisterR12,
  182. X64RegisterR13,
  183. X64RegisterR14,
  184. X64RegisterR15,
  185. X64RegisterReturnAddress,
  186. X64RegisterXmm0 = 17,
  187. X64RegisterXmm1,
  188. X64RegisterXmm2,
  189. X64RegisterXmm3,
  190. X64RegisterXmm4,
  191. X64RegisterXmm5,
  192. X64RegisterXmm6,
  193. X64RegisterXmm7,
  194. X64RegisterXmm8,
  195. X64RegisterXmm9,
  196. X64RegisterXmm10,
  197. X64RegisterXmm11,
  198. X64RegisterXmm12,
  199. X64RegisterXmm13,
  200. X64RegisterXmm14,
  201. X64RegisterXmm15,
  202. X64RegisterSt0 = 33,
  203. X64RegisterSt1,
  204. X64RegisterSt2,
  205. X64RegisterSt3,
  206. X64RegisterSt4,
  207. X64RegisterSt5,
  208. X64RegisterSt6,
  209. X64RegisterSt7,
  210. X64RegisterMm0 = 41,
  211. X64RegisterMm1,
  212. X64RegisterMm2,
  213. X64RegisterMm3,
  214. X64RegisterMm4,
  215. X64RegisterMm5,
  216. X64RegisterMm6,
  217. X64RegisterMm7,
  218. X64RegisterRflags = 49,
  219. X64RegisterEs = 50,
  220. X64RegisterCs,
  221. X64RegisterSs,
  222. X64RegisterDs,
  223. X64RegisterFs,
  224. X64RegisterGs,
  225. X64RegisterFsBase = 58,
  226. X64RegisterGsBase = 59,
  227. X64RegisterTr = 62,
  228. X64RegisterLdtr = 63,
  229. X64RegisterMxcsr = 64,
  230. X64RegisterFcw = 65,
  231. X64RegisterFsw = 66,
  232. X64RegisterXmm16 = 67,
  233. X64RegisterXmm17,
  234. X64RegisterXmm18,
  235. X64RegisterXmm19,
  236. X64RegisterXmm20,
  237. X64RegisterXmm21,
  238. X64RegisterXmm22,
  239. X64RegisterXmm23,
  240. X64RegisterXmm24,
  241. X64RegisterXmm25,
  242. X64RegisterXmm26,
  243. X64RegisterXmm27,
  244. X64RegisterXmm28,
  245. X64RegisterXmm29,
  246. X64RegisterXmm30,
  247. X64RegisterXmm31,
  248. X64RegisterK0 = 118,
  249. X64RegisterK1,
  250. X64RegisterK2,
  251. X64RegisterK3,
  252. X64RegisterK4,
  253. X64RegisterK5,
  254. X64RegisterK6,
  255. X64RegisterK7,
  256. X64RegisterBnd0 = 126,
  257. X64RegisterBnd1,
  258. X64RegisterBnd2,
  259. X64RegisterBnd3,
  260. } X64_REGISTER, *PX64_REGISTER;
  261. typedef enum _DATA_SYMBOL_LOCATION_TYPE {
  262. DataLocationInvalid,
  263. DataLocationRegister,
  264. DataLocationIndirect,
  265. DataLocationAbsoluteAddress,
  266. DataLocationComplex
  267. } DATA_SYMBOL_LOCATION_TYPE, *PDATA_SYMBOL_LOCATION_TYPE;
  268. typedef enum _SYMBOL_RESULT_TYPE {
  269. SymbolResultInvalid,
  270. SymbolResultFunction,
  271. SymbolResultType,
  272. SymbolResultData
  273. } SYMBOL_RESULT_TYPE, *PSYMBOL_RESULT_TYPE;
  274. //
  275. // Symbol interface function types.
  276. //
  277. typedef
  278. INT
  279. (*PSYMBOLS_LOAD) (
  280. PSTR Filename,
  281. IMAGE_MACHINE_TYPE MachineType,
  282. ULONG Flags,
  283. PVOID HostContext,
  284. PDEBUG_SYMBOLS *Symbols
  285. );
  286. /*++
  287. Routine Description:
  288. This routine loads debugging symbol information from the specified file.
  289. Arguments:
  290. Filename - Supplies the name of the binary to load symbols from.
  291. MachineType - Supplies the required machine type of the image. Set to
  292. unknown to allow the symbol library to load a file with any machine
  293. type.
  294. Flags - Supplies a bitfield of flags governing the behavior during load.
  295. These flags are specific to each symbol library.
  296. HostContext - Supplies the value to store in the host context field of the
  297. debug symbols.
  298. Symbols - Supplies an optional pointer where a pointer to the symbols will
  299. be returned on success.
  300. Return Value:
  301. 0 on success.
  302. Returns an error number on failure.
  303. --*/
  304. typedef
  305. VOID
  306. (*PSYMBOLS_UNLOAD) (
  307. PDEBUG_SYMBOLS Symbols
  308. );
  309. /*++
  310. Routine Description:
  311. This routine frees all memory associated with an instance of debugging
  312. symbols, including the symbols structure itsefl.
  313. Arguments:
  314. Symbols - Supplies a pointer to the debugging symbols.
  315. Return Value:
  316. None.
  317. --*/
  318. typedef
  319. INT
  320. (*PSYMBOLS_STACK_UNWIND) (
  321. PDEBUG_SYMBOLS Symbols,
  322. ULONGLONG DebasedPc,
  323. PSTACK_FRAME Frame
  324. );
  325. /*++
  326. Routine Description:
  327. This routine attempts to unwind the stack by one frame.
  328. Arguments:
  329. Symbols - Supplies a pointer to the debug symbols.
  330. DebasedPc - Supplies the program counter value, assuming the image were
  331. loaded at its preferred base address (that is, actual PC minus loaded
  332. base difference of the module).
  333. Frame - Supplies a pointer where the basic frame information for this
  334. frame will be returned.
  335. Return Value:
  336. 0 on success.
  337. EOF if there are no more stack frames.
  338. Returns an error code on failure.
  339. --*/
  340. typedef
  341. INT
  342. (*PSYMBOLS_READ_DATA_SYMBOL) (
  343. PDEBUG_SYMBOLS Symbols,
  344. PDATA_SYMBOL Symbol,
  345. ULONGLONG DebasedPc,
  346. PVOID Data,
  347. ULONG DataSize,
  348. PSTR Location,
  349. ULONG LocationSize
  350. );
  351. /*++
  352. Routine Description:
  353. This routine reads the contents of a data symbol.
  354. Arguments:
  355. Symbols - Supplies a pointer to the debug symbols.
  356. Symbol - Supplies a pointer to the data symbol to read.
  357. DebasedPc - Supplies the program counter value, assuming the image were
  358. loaded at its preferred base address (that is, actual PC minus the
  359. loaded base difference of the module).
  360. Data - Supplies a pointer to the buffer where the symbol data will be
  361. returned on success.
  362. DataSize - Supplies the size of the data buffer in bytes.
  363. Location - Supplies a pointer where the symbol location will be described
  364. in text on success.
  365. LocationSize - Supplies the size of the location buffer in bytes.
  366. Return Value:
  367. 0 on success.
  368. Returns an error code on failure.
  369. --*/
  370. typedef
  371. INT
  372. (*PSYMBOLS_GET_ADDRESS_OF_DATA_SYMBOL) (
  373. PDEBUG_SYMBOLS Symbols,
  374. PDATA_SYMBOL Symbol,
  375. ULONGLONG DebasedPc,
  376. PULONGLONG Address
  377. );
  378. /*++
  379. Routine Description:
  380. This routine gets the memory address of a data symbol.
  381. Arguments:
  382. Symbols - Supplies a pointer to the debug symbols.
  383. Symbol - Supplies a pointer to the data symbol to read.
  384. DebasedPc - Supplies the program counter value, assuming the image were
  385. loaded at its preferred base address (that is, actual PC minus the
  386. loaded base difference of the module).
  387. Address - Supplies a pointer where the address of the data symbol will be
  388. returned on success.
  389. Return Value:
  390. 0 on success.
  391. ENOENT if the data symbol is not currently valid.
  392. ERANGE if the data symbol is not stored in memory.
  393. Other error codes on other failures.
  394. --*/
  395. typedef
  396. BOOL
  397. (*PSYMBOLS_CHECK_RANGE) (
  398. PDEBUG_SYMBOLS Symbols,
  399. PSOURCE_FILE_SYMBOL Source,
  400. ULONGLONG Address,
  401. PVOID Ranges
  402. );
  403. /*++
  404. Routine Description:
  405. This routine determines whether the given address is actually in range of
  406. the given ranges. This is used for things like inline functions that have
  407. several discontiguous address ranges.
  408. Arguments:
  409. Symbols - Supplies a pointer to the debug symbols.
  410. Source - Supplies a pointer to the compilation unit the given object is in.
  411. Address - Supplies the address to query.
  412. Ranges - Supplies the opaque pointer to the range list information.
  413. Return Value:
  414. TRUE if the address is within the range list for the object.
  415. FALSE if the address is not within the range list for the object.
  416. --*/
  417. /*++
  418. Structure Description:
  419. This structure defines the interface to a symbol parsing library.
  420. Members:
  421. Load - Stores a pointer to a function that loads symbols.
  422. Unload - Stores a pointer to a function that unloads loaded symbols.
  423. Unwind - Stores an optional pointer to a function that can unwind the
  424. target stack. If not supplied, then traditional frame chaining will be
  425. used.
  426. ReadDataSymbol - Stores an optional pointer to a function that can read
  427. a data symbol value.
  428. GetAddressOfDataSymbol - Stores an optional pointer to a function that
  429. can return the memory address of a data symbol.
  430. CheckRange - Stores an optional pointer to a function used to determine if
  431. an address is within a given discontiguous range for a function or
  432. module.
  433. --*/
  434. typedef struct _DEBUG_SYMBOL_INTERFACE {
  435. PSYMBOLS_LOAD Load;
  436. PSYMBOLS_UNLOAD Unload;
  437. PSYMBOLS_STACK_UNWIND Unwind;
  438. PSYMBOLS_READ_DATA_SYMBOL ReadDataSymbol;
  439. PSYMBOLS_GET_ADDRESS_OF_DATA_SYMBOL GetAddressOfDataSymbol;
  440. PSYMBOLS_CHECK_RANGE CheckRange;
  441. } DEBUG_SYMBOL_INTERFACE, *PDEBUG_SYMBOL_INTERFACE;
  442. /*++
  443. Structure Description:
  444. This structure holds internal information pertaining to a loaded module's
  445. symbols. It stores all symbol information for a given module.
  446. Members:
  447. Filename - Stores the file name of the current module. This will most likely
  448. point to the RawStabStrings buffer, and will not need to be freed
  449. explicitly.
  450. ImageBase - Stores the default base of the image.
  451. Machine - Stores the machine architecture of the file.
  452. ImageFormat - Stores the image format of the file.
  453. RawSymbolTable - Stores a pointer to a buffer containing the symbol table
  454. out of the PE or ELF file.
  455. RawSymbolTableSize - Stores the size of the RawSymbolTable buffer, in bytes.
  456. RawSymbolTableStrings - Stores a pointer to a buffer containing the string
  457. table associated with the symbol table in the PE or ELF file.
  458. RawSymbolTableStringsSize - Stores the size of the RawSymbolTableStrings,
  459. in bytes.
  460. SourcesHead - Stores the list head for a linked list of SOURCE_FILE_SYMBOL
  461. structures. This list contains the symbols for all the source files in
  462. the image.
  463. SymbolContext - Stores an opaque pointer that the symbol parsing library
  464. can use to store global state for this image.
  465. Interface - Stores a pointer to a table of functions used to interact with
  466. the symbol library.
  467. HostContext - Stores a pointer's worth of context for the user of the
  468. debug symbols library. This currently holds a pointer back to the
  469. debugger context.
  470. RegistersContext - Stores an optional pointer's worth of context regarding
  471. which set of registers to access when the symbol library needs to do
  472. accesses.
  473. --*/
  474. struct _DEBUG_SYMBOLS {
  475. PSTR Filename;
  476. ULONGLONG ImageBase;
  477. ULONG Machine;
  478. IMAGE_FORMAT ImageFormat;
  479. LIST_ENTRY SourcesHead;
  480. PVOID SymbolContext;
  481. PDEBUG_SYMBOL_INTERFACE Interface;
  482. PVOID HostContext;
  483. PVOID RegistersContext;
  484. };
  485. /*++
  486. Structure Description:
  487. This structure holds a subrange. This is used in type definitions where a
  488. type will be defined as a subrange of another type. It's also used in array
  489. definitions, specifying the minimum and maximum index in the array.
  490. Members:
  491. Minimum - Stores the minimum value of the range, inclusive.
  492. Maximum - Stores the maximum value of the range.
  493. MaxUlonglong - Stores a boolean indicating if the actual maximum of the
  494. range is maximum value of a 64-bit unsigned integer. If this flag is
  495. set, the Maximum field is undefined.
  496. --*/
  497. typedef struct _DATA_RANGE {
  498. LONGLONG Minimum;
  499. LONGLONG Maximum;
  500. BOOL MaxUlonglong;
  501. } DATA_RANGE, *PDATA_RANGE;
  502. /*++
  503. Structure Description:
  504. This structure stores all of the debug symbols for one source file.
  505. Members:
  506. SourceDirectory - Stores a string of the sources complete directory path.
  507. This will not need to be freed explicitly if it points directly to a
  508. stab string.
  509. SourceFile - Stores a string of the source file name. This will also not
  510. need to be freed explicitly.
  511. ListEntry - Stores links to the next and previous source files in the image.
  512. TypesHead - Stores the list head for all the types defined by this file. The
  513. values for these list entries will be TYPE_SYMBOL structures.
  514. SourceLinesHead - Stores the list head for all the source line symbols
  515. defined in this file. These entries will be of type SOURCE_LINE_SYMBOL.
  516. FunctionsHead - Stores the list head for all the functions defined in this
  517. file. These entries will be of type FUNCTION_SYMBOL.
  518. DataSymbolsHead - Stores the list head for all the data symbols defined in
  519. this source file. These entries will be of type DATA_SYMBOL.
  520. StartAddress - Stores the virtual address of the start of the text section
  521. for this source file. This makes it easy narrow down which file a
  522. symbol is in.
  523. EndAddress - Stores the virtual address of the end of the text section for
  524. this source file.
  525. Identifier - Stores an identifier for the source file, used to match up
  526. future references to the file. For Stabs, this is the value of the
  527. stab, and is used to match N_EXCL references to N_BINCLs.
  528. SymbolContext - Stores a pointer's worth of context reserved for the symbol
  529. parsing library.
  530. --*/
  531. struct _SOURCE_FILE_SYMBOL {
  532. PSTR SourceDirectory;
  533. PSTR SourceFile;
  534. LIST_ENTRY ListEntry;
  535. LIST_ENTRY TypesHead;
  536. LIST_ENTRY SourceLinesHead;
  537. LIST_ENTRY FunctionsHead;
  538. LIST_ENTRY DataSymbolsHead;
  539. ULONGLONG StartAddress;
  540. ULONGLONG EndAddress;
  541. ULONG Identifier;
  542. PVOID SymbolContext;
  543. };
  544. /*++
  545. Structure Description:
  546. This structure stores symbols information pertaining to a function.
  547. Members:
  548. ParentSource - Stores a pointer to the source file this function is defined
  549. in.
  550. Name - Stores a pointer to the name of the function. This buffer will need
  551. to be freed explicitly on destruction.
  552. FunctionNumber - Stores the function number, as referred to by the stab
  553. Description field. This information is stored but currently unused.
  554. ListEntry - Stores links to the next and previous functions in the owning
  555. source file.
  556. ParametersHead - Stores the head of the list of the function's parameters,
  557. in order. The list values will be of type DATA_SYMBOL.
  558. LocalsHead - Stores the head of the list of the function's local variables.
  559. The list will be of type DATA_SYMBOL.
  560. FunctionsHead - Stores the head of the list of the function's subfunctions
  561. (often inlined functions).
  562. StartAddress - Stores the starting virtual address of the function.
  563. EndAddress - Stores the ending virtual address of the function, exclusive.
  564. Ranges - Stores an opaque pointer that is passed in to the check range
  565. function to determine if the given address is in range.
  566. ReturnTypeNumber - Stores the type number of the function's return type.
  567. ReturnTypeOwner - Stores a pointer to the source file where the function's
  568. return type resides.
  569. SymbolContext - Stores a pointer's worth of additional context for the
  570. symbol library.
  571. ParentFunction - Stores a pointer to the parent function if this is an
  572. inner or inlined function.
  573. --*/
  574. struct _FUNCTION_SYMBOL {
  575. PSOURCE_FILE_SYMBOL ParentSource;
  576. PSTR Name;
  577. USHORT FunctionNumber;
  578. LIST_ENTRY ListEntry;
  579. LIST_ENTRY ParametersHead;
  580. LIST_ENTRY LocalsHead;
  581. LIST_ENTRY FunctionsHead;
  582. ULONGLONG StartAddress;
  583. ULONGLONG EndAddress;
  584. PVOID Ranges;
  585. LONG ReturnTypeNumber;
  586. PSOURCE_FILE_SYMBOL ReturnTypeOwner;
  587. PVOID SymbolContext;
  588. PFUNCTION_SYMBOL ParentFunction;
  589. };
  590. /*++
  591. Structure Description:
  592. This structure stores a single source line symbol.
  593. Members:
  594. ParentSource - Stores a pointer to the source file that this line refers to.
  595. This could point to an include file.
  596. ListEntry - Stores links to the previous and next source lines in this
  597. source file.
  598. LineNumber - Stores the line number of this source line symbol.
  599. Start - Stores the starting address of this line, inclusive.
  600. End - Stores the ending address of this line, exclusive.
  601. --*/
  602. typedef struct _SOURCE_LINE_SYMBOL {
  603. PSOURCE_FILE_SYMBOL ParentSource;
  604. LIST_ENTRY ListEntry;
  605. LONG LineNumber;
  606. ULONGLONG Start;
  607. ULONGLONG End;
  608. } SOURCE_LINE_SYMBOL, *PSOURCE_LINE_SYMBOL;
  609. /*++
  610. Structure Description:
  611. This structure defines a relation type between the type being defined and
  612. another type.
  613. Members:
  614. Pointer - Stores a combination of a flag and a value. If zero, it indicates
  615. this relation is not a pointer. If non-zero it indicates both that this
  616. relation is a pointer type, and the size of a pointer on the machine.
  617. OwningFile - Stores a pointer to the source file that contains the
  618. reference type.
  619. TypeNumber - Stores the number of the reference type.
  620. Array - Stores the allowable array indices of this type. If any of the
  621. values inside this parameter are nonzero, this indicates that this type
  622. is an array of the reference type.
  623. Function - Stores a flag which is set when this type is a function. The type
  624. information then refers to the return type of the function.
  625. --*/
  626. typedef struct _DATA_TYPE_RELATION {
  627. UCHAR Pointer;
  628. PSOURCE_FILE_SYMBOL OwningFile;
  629. LONG TypeNumber;
  630. DATA_RANGE Array;
  631. BOOL Function;
  632. } DATA_TYPE_RELATION, *PDATA_TYPE_RELATION;
  633. /*++
  634. Structure Description:
  635. This structure defines a numeric type.
  636. Members:
  637. Signed - Stores a flag indicating whether this type is signed or unsigned.
  638. Float - Stores a flag indicating whether this type should be interpreted as
  639. a floating point number. If this flag is TRUE, the Signed member is
  640. meaningless.
  641. BitSize - Stores the size of the numeric type, in bits.
  642. --*/
  643. typedef struct _DATA_TYPE_NUMERIC {
  644. BOOL Signed;
  645. BOOL Float;
  646. ULONG BitSize;
  647. } DATA_TYPE_NUMERIC, *PDATA_TYPE_NUMERIC;
  648. /*++
  649. Structure Description:
  650. This structure defines a structure type (ie. the source file defined a
  651. structure of some sort).
  652. Members:
  653. SizeInBytes - Stores the total size of the structure, in bytes.
  654. MemberCount - Stores the number of members in this structure.
  655. FirstMember - Stores a pointer to the first structure member.
  656. --*/
  657. typedef struct _DATA_TYPE_STRUCTURE {
  658. ULONG SizeInBytes;
  659. ULONG MemberCount;
  660. PSTRUCTURE_MEMBER FirstMember;
  661. } DATA_TYPE_STRUCTURE, *PDATA_TYPE_STRUCTURE;
  662. /*++
  663. Structure Description:
  664. This structure defines an enumeration type.
  665. Members:
  666. SizeInBytes - Stores the number of bytes required to hold an instantiation
  667. of this enumeration. This might be zero if the symbol format does not
  668. describe this information.
  669. MemberCount - Stores the number of values defined in this enum.
  670. FirstMember - Stores a pointer to the first enumeration definition.
  671. --*/
  672. typedef struct _DATA_TYPE_ENUMERATION {
  673. ULONG SizeInBytes;
  674. ULONG MemberCount;
  675. PENUMERATION_MEMBER FirstMember;
  676. } DATA_TYPE_ENUMERATION, *PDATA_TYPE_ENUMERATION;
  677. /*++
  678. Structure Description:
  679. This structure defines a function pointer type.
  680. Members:
  681. SizeInBytes - Stores the size of the type (the size of an address in the
  682. target).
  683. --*/
  684. typedef struct _DATA_TYPE_FUNCTION_POINTER {
  685. ULONG SizeInBytes;
  686. } DATA_TYPE_FUNCTION_POINTER, *PDATA_TYPE_FUNCTION_POINTER;
  687. /*++
  688. Structure Description:
  689. This structure defines a new type (such as a bool, int, structure, or enum).
  690. Members:
  691. ListEntry - Stores links to the next and previous types in the owning source
  692. file.
  693. ParentSource - Stores a link to the source file this type was defined in.
  694. This is necessary because types are defined with a type index and
  695. potentially an include file index. This could be an include file.
  696. TypeNumber - Stores the type number, which can be referred to by other
  697. types.
  698. Name - Stores the name of the type. This buffer will need to be freed
  699. explicitly upon destruction.
  700. ParentFunction - Stores a link to the function where this type was defined.
  701. Type - Stores the type of this type, such as whether it is a basic type,
  702. structure, enum, etc.
  703. U - Stores the union of type information. Which structure to reach through
  704. can be determined by the type member above.
  705. --*/
  706. struct _TYPE_SYMBOL {
  707. LIST_ENTRY ListEntry;
  708. PSOURCE_FILE_SYMBOL ParentSource;
  709. LONG TypeNumber;
  710. PSTR Name;
  711. PFUNCTION_SYMBOL ParentFunction;
  712. DATA_TYPE_TYPE Type;
  713. union {
  714. DATA_TYPE_RELATION Relation;
  715. DATA_TYPE_NUMERIC Numeric;
  716. DATA_TYPE_STRUCTURE Structure;
  717. DATA_TYPE_ENUMERATION Enumeration;
  718. DATA_TYPE_FUNCTION_POINTER FunctionPointer;
  719. } U;
  720. };
  721. /*++
  722. Structure Description:
  723. This structure defines a data address that is a register plus an offset.
  724. Members:
  725. Register - Stores the register number.
  726. Offset - Stores the offset in bytes to add to the value at the register.
  727. --*/
  728. typedef struct _DATA_LOCATION_REGISTER_OFFSET {
  729. ULONG Register;
  730. LONGLONG Offset;
  731. } DATA_LOCATION_REGISTER_OFFSET, *PDATA_LOCATION_REGISTER_OFFSET;
  732. /*++
  733. Structure Description:
  734. This union defines the various forms a data symbol location can take.
  735. Members:
  736. Address - Stores the memory address of the symbol.
  737. Register - Stores the register number of the symbol.
  738. Indirect - Stores the register plus offset address of the symbol.
  739. Complex - Stores a context pointer that the symbol library can interpret
  740. to evaluate a more complicated location.
  741. --*/
  742. typedef union _DATA_LOCATION_UNION {
  743. ULONGLONG Address;
  744. ULONG Register;
  745. DATA_LOCATION_REGISTER_OFFSET Indirect;
  746. PVOID Complex;
  747. } DATA_LOCATION_UNION, *PDATA_LOCATION_UNION;
  748. /*++
  749. Structure Description:
  750. This structure defines a general data symbol for a global or local variable
  751. located in a register, stack, or at an absolute address.
  752. Members:
  753. ParentSource - Stores a link to the source file where this symbol was
  754. defined.
  755. ParentFunction - Stores a link to the function where this (potentially
  756. local) variable was defined. Can be NULL.
  757. ListEntry - Stores a link to the next and previous variable in the function
  758. or source file.
  759. Name - Stores a pointer to the name of this variable. This buffer will need
  760. to be explicitly freed upon destruction.
  761. LocationType - Stores a value that indicates the form the location union
  762. should be accessed through.
  763. Location - Stores the location of the symbol.
  764. MinimumValidExecutionAddress - Stores the point in the execution flow when
  765. this variable becomes active. For globals, this will probably be 0. For
  766. stack variables and register variables, this will be somewhere around
  767. where the variable gets initialized.
  768. TypeOwner - Stores a link to the source file where the type of the variable
  769. can be found.
  770. TypeNumber - Stores the type number of this variable.
  771. --*/
  772. struct _DATA_SYMBOL {
  773. PSOURCE_FILE_SYMBOL ParentSource;
  774. PFUNCTION_SYMBOL ParentFunction;
  775. LIST_ENTRY ListEntry;
  776. PSTR Name;
  777. DATA_SYMBOL_LOCATION_TYPE LocationType;
  778. DATA_LOCATION_UNION Location;
  779. ULONGLONG MinimumValidExecutionAddress;
  780. PSOURCE_FILE_SYMBOL TypeOwner;
  781. LONG TypeNumber;
  782. };
  783. /*++
  784. Structure Description:
  785. This structure defines a member in a structure type definition.
  786. Members:
  787. Name - Stores a pointer to the name of this member. This buffer *will* need
  788. to be freed explicitly on destruction.
  789. TypeFile - Stores a pointer to the file where the type of this member is
  790. defined.
  791. TypeNumber - Stores the type number for this structure member.
  792. BitOffset - Stores the offset from the beginning of the structure where this
  793. member begins, in bits. For unions, many members will have the same
  794. value here.
  795. BitSize - Stores the size of this member in bits.
  796. NextMember - Stores a pointer to the next structure member, or NULL if this
  797. is the last structure member.
  798. --*/
  799. struct _STRUCTURE_MEMBER {
  800. PSTR Name;
  801. PSOURCE_FILE_SYMBOL TypeFile;
  802. LONG TypeNumber;
  803. ULONG BitOffset;
  804. ULONG BitSize;
  805. PSTRUCTURE_MEMBER NextMember;
  806. };
  807. /*++
  808. Structure Description:
  809. This structure defines a member in an enumeration type definition.
  810. Members:
  811. Name - Stores a pointer to the name of this enumeration. This buffer *will*
  812. need to be explicitly freed on destruction.
  813. Value - Stores the value that Name enumerates to. On a normal enumeration,
  814. this value will start at 0 and work its way up in subsequent members.
  815. NextMember - Stores a pointer to the next enumeration member, or NULL if
  816. this is the last enumeration.
  817. --*/
  818. struct _ENUMERATION_MEMBER {
  819. PSTR Name;
  820. LONGLONG Value;
  821. PENUMERATION_MEMBER NextMember;
  822. };
  823. /*++
  824. Structure Description:
  825. This structure defines an individual result of searching for a symbol.
  826. Members:
  827. Variety - Stores which member of the union of the union is valid,
  828. depending on the type of symbol returned from the query.
  829. FunctionResult - Stores a pointer to the function symbol,
  830. provided that the variety specifies a function.
  831. TypeResult - Stores a pointer to the data type symbol, provided that
  832. the variety specifies a type.
  833. DataResult - Stores a pointer to the data symbol, provided that the variety
  834. specifies a data result.
  835. --*/
  836. typedef struct _SYMBOL_SEARCH_RESULT {
  837. SYMBOL_RESULT_TYPE Variety;
  838. union {
  839. PFUNCTION_SYMBOL FunctionResult;
  840. PTYPE_SYMBOL TypeResult;
  841. PDATA_SYMBOL DataResult;
  842. } U;
  843. } SYMBOL_SEARCH_RESULT, *PSYMBOL_SEARCH_RESULT;
  844. /*++
  845. Structure Description:
  846. This structure stores a loaded module in the debugger.
  847. Members:
  848. ListEntry - Stores pointers to the next and previous loaded modules in the
  849. list of all loaded modules.
  850. Filename - Stores the name of the file these symbols were loaded from.
  851. ModuleName - Stores the friendly name of the module.
  852. Timestamp - Stores the modification date of this module in seconds since
  853. 2001.
  854. BaseDifference - Supplies the difference between the preferred load
  855. address of the module and the actual load address of the module.
  856. LowestAddress - Stores the lowest address of the image actually in use,
  857. since this can be lower than the base address.
  858. Size - Stores the lize of the loaded image in memory.
  859. Process - Stores the ID of the process the image is specific to.
  860. Symbols - Stores a pointer to the debug symbols associated with this
  861. module.
  862. Loaded - Stores a boolean indicating if this module is still loaded.
  863. --*/
  864. typedef struct _DEBUGGER_MODULE {
  865. LIST_ENTRY ListEntry;
  866. PSTR Filename;
  867. PSTR ModuleName;
  868. ULONGLONG Timestamp;
  869. ULONGLONG BaseDifference;
  870. ULONGLONG LowestAddress;
  871. ULONGLONG Size;
  872. ULONG Process;
  873. PDEBUG_SYMBOLS Symbols;
  874. BOOL Loaded;
  875. } DEBUGGER_MODULE, *PDEBUGGER_MODULE;
  876. /*++
  877. Structure Description:
  878. This structure stores a list of loaded modules.
  879. Members:
  880. ModuleCount - Stores the number of modules in the list.
  881. Signature - Stores the total of all timestamps and loaded addresses in the
  882. module list.
  883. ModulesHead - Stores the head of the list of DEBUGGER_MODULE structures.
  884. --*/
  885. typedef struct _DEBUGGER_MODULE_LIST {
  886. ULONG ModuleCount;
  887. ULONGLONG Signature;
  888. LIST_ENTRY ModulesHead;
  889. } DEBUGGER_MODULE_LIST, *PDEBUGGER_MODULE_LIST;
  890. //
  891. // -------------------------------------------------------------------- Globals
  892. //
  893. //
  894. // -------------------------------------------------------- Function Prototypes
  895. //
  896. INT
  897. DbgLoadSymbols (
  898. PSTR Filename,
  899. IMAGE_MACHINE_TYPE MachineType,
  900. PVOID HostContext,
  901. PDEBUG_SYMBOLS *Symbols
  902. );
  903. /*++
  904. Routine Description:
  905. This routine loads debugging symbol information from the specified file.
  906. Arguments:
  907. Filename - Supplies the name of the binary to load symbols from.
  908. MachineType - Supplies the required machine type of the image. Set to
  909. unknown to allow the symbol library to load a file with any machine
  910. type.
  911. HostContext - Supplies the value to store in the host context field of the
  912. debug symbols.
  913. Symbols - Supplies an optional pointer where a pointer to the symbols will
  914. be returned on success.
  915. Return Value:
  916. 0 on success.
  917. Returns an error number on failure.
  918. --*/
  919. VOID
  920. DbgUnloadSymbols (
  921. PDEBUG_SYMBOLS Symbols
  922. );
  923. /*++
  924. Routine Description:
  925. This routine frees all memory associated with an instance of debugging
  926. symbols. Once called, the pointer passed in should not be dereferenced
  927. again by the caller.
  928. Arguments:
  929. Symbols - Supplies a pointer to the debugging symbols.
  930. Return Value:
  931. None.
  932. --*/
  933. VOID
  934. DbgPrintFunctionPrototype (
  935. PFUNCTION_SYMBOL Function,
  936. PSTR ModuleName,
  937. ULONGLONG Address
  938. );
  939. /*++
  940. Routine Description:
  941. This routine prints a C function prototype directly to the screen.
  942. Arguments:
  943. Function - Supplies a pointer to the function symbol to print.
  944. ModuleName - Supplies an optional string containing the module name.
  945. Address - Supplies the final address of the function.
  946. Return Value:
  947. None (information is printed directly to the standard output).
  948. --*/
  949. VOID
  950. DbgPrintTypeName (
  951. PTYPE_SYMBOL Type
  952. );
  953. /*++
  954. Routine Description:
  955. This routine prints a type name, formatted with any array an pointer
  956. decorations.
  957. Arguments:
  958. Type - Supplies a pointer to the type to print information about.
  959. Return Value:
  960. None (information is printed directly to the standard output).
  961. --*/
  962. ULONG
  963. DbgGetTypeSize (
  964. PTYPE_SYMBOL Type,
  965. ULONG RecursionDepth
  966. );
  967. /*++
  968. Routine Description:
  969. This routine determines the size in bytes of a given type.
  970. Arguments:
  971. Type - Supplies a pointer to the type to get the size of.
  972. RecursionDepth - Supplies the function recursion depth. Supply zero here.
  973. Return Value:
  974. Returns the size of the type in bytes. On error or on querying a void type,
  975. 0 is returned.
  976. --*/
  977. VOID
  978. DbgPrintTypeDescription (
  979. PTYPE_SYMBOL Type,
  980. ULONG SpaceLevel,
  981. ULONG RecursionDepth
  982. );
  983. /*++
  984. Routine Description:
  985. This routine prints a description of the structure of a given type.
  986. Arguments:
  987. Type - Supplies a pointer to the type to print information about.
  988. SpaceLevel - Supplies the number of spaces to print after every newline.
  989. Used for nesting types.
  990. RecursionDepth - Supplies how many times this should recurse on structure
  991. members. If 0, only the name of the type is printed.
  992. Return Value:
  993. None (information is printed directly to the standard output).
  994. --*/
  995. PTYPE_SYMBOL
  996. DbgSkipTypedefs (
  997. PTYPE_SYMBOL Type
  998. );
  999. /*++
  1000. Routine Description:
  1001. This routine skips all relation types that aren't pointers or arrays.
  1002. Arguments:
  1003. Type - Supplies a pointer to the type to get to the bottom of.
  1004. Return Value:
  1005. NULL if the type ended up being void or not found.
  1006. Returns a pointer to the root type on success.
  1007. --*/
  1008. PTYPE_SYMBOL
  1009. DbgGetType (
  1010. PSOURCE_FILE_SYMBOL SourceFile,
  1011. LONG TypeNumber
  1012. );
  1013. /*++
  1014. Routine Description:
  1015. This routine looks up a type symbol based on the type number and the source
  1016. file the type is in.
  1017. Arguments:
  1018. SourceFile - Supplies a pointer to the source file containing the type.
  1019. TypeNumber - Supplies the type number to look up.
  1020. Return Value:
  1021. Returns a pointer to the type on success, or NULL on error.
  1022. --*/
  1023. PSOURCE_LINE_SYMBOL
  1024. DbgLookupSourceLine (
  1025. PDEBUG_SYMBOLS Module,
  1026. ULONGLONG Address
  1027. );
  1028. /*++
  1029. Routine Description:
  1030. This routine looks up a source line in a given module based on the address.
  1031. Arguments:
  1032. Module - Supplies a pointer to the module which contains the symbols to
  1033. search through.
  1034. Address - Supplies the query address to search the source line symbols for.
  1035. Return Value:
  1036. If a successful match is found, returns a pointer to the source line symbol.
  1037. If a source line matching the address could not be found or an error
  1038. occured, returns NULL.
  1039. --*/
  1040. PSYMBOL_SEARCH_RESULT
  1041. DbgLookupSymbol (
  1042. PDEBUG_SYMBOLS Module,
  1043. ULONGLONG Address,
  1044. PSYMBOL_SEARCH_RESULT Input
  1045. );
  1046. /*++
  1047. Routine Description:
  1048. This routine looks up a symbol in a module based on the given address. It
  1049. first searches through data symbols, then functions.
  1050. Arguments:
  1051. Module - Supplies a pointer to the module which contains the symbols to
  1052. search through.
  1053. Address - Supplies the address of the symbol to look up.
  1054. Input - Supplies a pointer to the search result structure. On input, the
  1055. parameter contains the search result to start the search from. On
  1056. output, contains the new found search result. To signify that the search
  1057. should start from the beginning, set the Type member to ResultInvalid.
  1058. Return Value:
  1059. If a successful match is found, returns Input with the search results filled
  1060. into the structure. If no result was found or an error occurred, NULL is
  1061. returned.
  1062. --*/
  1063. PSYMBOL_SEARCH_RESULT
  1064. DbgpFindSymbolInModule (
  1065. PDEBUG_SYMBOLS Module,
  1066. PSTR Query,
  1067. PSYMBOL_SEARCH_RESULT Input
  1068. );
  1069. /*++
  1070. Routine Description:
  1071. This routine searches for a symbol in a module. It first searches through
  1072. types, then data symbols, then functions.
  1073. Arguments:
  1074. Module - Supplies a pointer to the module which contains the symbols to
  1075. search through.
  1076. Query - Supplies the search string.
  1077. Input - Supplies a pointer to the search result structure. On input, the
  1078. parameter contains the search result to start the search from. On
  1079. output, contains the new found search result. To signify that the search
  1080. should start from the beginning, set the Type member to ResultInvalid.
  1081. Return Value:
  1082. If a successful match is found, returns Input with the search results filled
  1083. into the structure. If no result was found or an error occurred, NULL is
  1084. returned.
  1085. --*/
  1086. PSYMBOL_SEARCH_RESULT
  1087. DbgFindTypeSymbol (
  1088. PDEBUG_SYMBOLS Module,
  1089. PSTR Query,
  1090. PSYMBOL_SEARCH_RESULT Input
  1091. );
  1092. /*++
  1093. Routine Description:
  1094. This routine searches for a type symbol in a module.
  1095. Arguments:
  1096. Module - Supplies a pointer to the module which contains the symbols to
  1097. search through.
  1098. Query - Supplies the search string.
  1099. Input - Supplies a pointer to the search result structure. On input, the
  1100. parameter contains the search result to start the search from. On
  1101. output, contains the new found search result. To signify that the search
  1102. should start from the beginning, set the Type member to ResultInvalid.
  1103. Return Value:
  1104. If a successful match is found, returns Input with the search results filled
  1105. into the structure. If no result was found or an error occurred, NULL is
  1106. returned.
  1107. --*/
  1108. PSYMBOL_SEARCH_RESULT
  1109. DbgFindDataSymbol (
  1110. PDEBUG_SYMBOLS Module,
  1111. PSTR Query,
  1112. ULONGLONG Address,
  1113. PSYMBOL_SEARCH_RESULT Input
  1114. );
  1115. /*++
  1116. Routine Description:
  1117. This routine searches for a data symbol in a module based on a query string
  1118. or address.
  1119. Arguments:
  1120. Module - Supplies a pointer to the module which contains the symbols to
  1121. search through.
  1122. Query - Supplies the search string. This parameter can be NULL if searching
  1123. by address.
  1124. Address - Supplies the address of the symbol. Can be NULL if search by
  1125. query string is desired.
  1126. Input - Supplies a pointer to the search result structure. On input, the
  1127. parameter contains the search result to start the search from. On
  1128. output, contains the new found search result. To signify that the search
  1129. should start from the beginning, set the Type member to ResultInvalid.
  1130. Return Value:
  1131. If a successful match is found, returns Input with the search results filled
  1132. into the structure. If no result was found or an error occurred, NULL is
  1133. returned.
  1134. --*/
  1135. PSYMBOL_SEARCH_RESULT
  1136. DbgFindFunctionSymbol (
  1137. PDEBUG_SYMBOLS Module,
  1138. PSTR Query,
  1139. ULONGLONG Address,
  1140. PSYMBOL_SEARCH_RESULT Input
  1141. );
  1142. /*++
  1143. Routine Description:
  1144. This routine searches for a function symbol in a module based on a search
  1145. string or an address.
  1146. Arguments:
  1147. Module - Supplies a pointer to the module which contains the symbols to
  1148. search through.
  1149. Query - Supplies the search string. This parameter can be NULL if searching
  1150. by address.
  1151. Address - Supplies the search address. This parameter can be NULL if
  1152. searching by query string.
  1153. Input - Supplies a pointer to the search result structure. On input, the
  1154. parameter contains the search result to start the search from. On
  1155. output, contains the new found search result. To signify that the search
  1156. should start from the beginning, set the Type member to ResultInvalid.
  1157. Return Value:
  1158. If a successful match is found, returns Input with the search results filled
  1159. into the structure. If no result was found or an error occurred, NULL is
  1160. returned.
  1161. --*/
  1162. PSTR
  1163. DbgGetRegisterName (
  1164. IMAGE_MACHINE_TYPE MachineType,
  1165. ULONG Register
  1166. );
  1167. /*++
  1168. Routine Description:
  1169. This routine returns a string containing the name of the given register.
  1170. Arguments:
  1171. MachineType - Supplies the machine type.
  1172. Register - Supplies the register number.
  1173. Return Value:
  1174. Returns a pointer to a constant string containing the name of the register.
  1175. --*/