Changeset 22116 in vbox
- Timestamp:
- Aug 10, 2009 12:10:30 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/dbg.h
r22114 r22116 442 442 443 443 /** 444 * Information about a mapping. 445 * 446 * This is used by RTDbgAsModuleGetMapByIndex. 447 */ 448 typedef struct RTDBGASMAPINFO 449 { 450 /** The mapping address. */ 451 RTUINTPTR Address; 452 /** The segment mapped there. 453 * This is NIL_RTDBGSEGIDX if the entire module image is mapped here. */ 454 RTDBGSEGIDX iSeg; 455 } RTDBGASMAPINFO; 456 /** Pointer to info about an address space mapping. */ 457 typedef RTDBGASMAPINFO *PRTDBGASMAPINFO; 458 /** Pointer to const info about an address space mapping. */ 459 typedef RTDBGASMAPINFO const *PCRTDBGASMAPINFO; 460 461 /** 462 * Queries mapping information for a module given by index. 463 * 464 * @returns IRPT status code. 465 * @retval VERR_INVALID_HANDLE if hDbgAs is invalid. 466 * @retval VERR_OUT_OF_RANGE if the name index was out of range. 467 * @retval VINF_BUFFER_OVERFLOW if the array is too small and the returned 468 * information is incomplete. 469 * 470 * @param hDbgAs The address space handle. 471 * @param iModule The index of the module to get. 472 * @param paMappings Where to return the mapping information. The buffer 473 * size is given by *pcMappings. 474 * @param pcMappings IN: Size of the paMappings array. OUT: The number of 475 * entries returned. 476 * @param fFlags Flags for reserved for future use. MBZ. 477 * 478 * @remarks See remarks for RTDbgAsModuleByIndex regarding the volatility of the 479 * iModule parameter. 480 */ 481 RTDECL(int) RTDbgAsModuleQueryMapByIndex(RTDBGAS hDbgAs, uint32_t iModule, PRTDBGASMAPINFO paMappings, uint32_t *pcMappings, uint32_t fFlags); 482 483 /** 444 484 * Adds a symbol to a module in the address space. 445 485 * -
trunk/src/VBox/Runtime/common/dbg/dbgas.cpp
r22113 r22116 1071 1071 1072 1072 /** 1073 * Queries mapping information for a module given by index. 1074 * 1075 * @returns IRPT status code. 1076 * @retval VERR_INVALID_HANDLE if hDbgAs is invalid. 1077 * @retval VERR_OUT_OF_RANGE if the name index was out of range. 1078 * @retval VINF_BUFFER_OVERFLOW if the array is too small and the returned 1079 * information is incomplete. 1080 * 1081 * @param hDbgAs The address space handle. 1082 * @param iModule The index of the module to get. 1083 * @param paMappings Where to return the mapping information. The buffer 1084 * size is given by *pcMappings. 1085 * @param pcMappings IN: Size of the paMappings array. OUT: The number of 1086 * entries returned. 1087 * @param fFlags Flags for reserved for future use. MBZ. 1088 * 1089 * @remarks See remarks for RTDbgAsModuleByIndex regarding the volatility of the 1090 * iModule parameter. 1091 */ 1092 RTDECL(int) RTDbgAsModuleQueryMapByIndex(RTDBGAS hDbgAs, uint32_t iModule, PRTDBGASMAPINFO paMappings, uint32_t *pcMappings, uint32_t fFlags) 1093 { 1094 /* 1095 * Validate input. 1096 */ 1097 uint32_t const cMappings = *pcMappings; 1098 PRTDBGASINT pDbgAs = hDbgAs; 1099 RTDBGAS_VALID_RETURN_RC(pDbgAs, VERR_INVALID_HANDLE); 1100 AssertReturn(!fFlags, VERR_INVALID_PARAMETER); 1101 1102 RTDBGAS_LOCK_READ(pDbgAs); 1103 if (iModule >= pDbgAs->cModules) 1104 { 1105 RTDBGAS_UNLOCK_READ(pDbgAs); 1106 return VERR_OUT_OF_RANGE; 1107 } 1108 1109 /* 1110 * Copy the mapping information about the module. 1111 */ 1112 int rc = VINF_SUCCESS; 1113 PRTDBGASMAP pMap = pDbgAs->papModules[iModule]->pMapHead; 1114 uint32_t cMaps = 0; 1115 while (pMap) 1116 { 1117 if (cMaps >= cMappings) 1118 { 1119 rc = VINF_BUFFER_OVERFLOW; 1120 break; 1121 } 1122 paMappings[cMaps].Address = pMap->Core.Key; 1123 paMappings[cMaps].iSeg = pMap->iSeg; 1124 cMaps++; 1125 pMap = pMap->pNext; 1126 } 1127 1128 RTDBGAS_UNLOCK_READ(pDbgAs); 1129 *pcMappings = cMaps; 1130 return rc; 1131 } 1132 RT_EXPORT_SYMBOL(RTDbgAsModuleQueryMapByIndex); 1133 1134 1135 /** 1073 1136 * Internal worker that looks up and retains a module. 1074 1137 *
Note:
See TracChangeset
for help on using the changeset viewer.