Changeset 3579 for trunk/kStuff/kLdr
- Timestamp:
- Sep 2, 2007, 11:40:41 PM (18 years ago)
- Location:
- trunk/kStuff/kLdr
- Files:
-
- 1 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kStuff/kLdr/Makefile.kmk
r3578 r3579 120 120 kLdrDyldOS.c \ 121 121 kLdrDyLdSem.c \ 122 kLdrErr.c \123 122 kLdrMisc.c \ 124 123 kLdrMod.c \ … … 136 135 kLdr_LIBS += \ 137 136 $(PATH_LIB)/kRdrStatic$(SUFF_LIB) \ 138 $(PATH_LIB)/kHlpBareStatic$(SUFF_LIB) 139 140 kLdrErr.c_DEPS = $(PATH_TARGET)/kldrErrConsts.h 141 kLdrErr.c_INCS = $(PATH_TARGET) 137 $(PATH_LIB)/kHlpBareStatic$(SUFF_LIB) \ 138 $(PATH_LIB)/kErrStatic$(SUFF_LIB) 142 139 143 140 # … … 222 219 223 220 224 # 225 # Generate case statements for kLdrErrStr(). 226 # 227 $(PATH_TARGET)/kldrErrConsts.h: ../include/k/kLdr.h Makefile.kmk | $(call DIRDEP,$(PATH_TARGET)) 228 $(RM) -f $@ 229 $(SED) \ 230 -e '/^#define *\(KLDR_ERR_[^ ()]*\) .*$$/!d' \ 231 -e 's/^#define *\(KLDR_ERR_[^ ()]*\) .*$$/ERR_CONST(\1)/' \ 232 -e '/KLDR_ERR_BASE/d' \ 233 -e '/KLDR_ERR_[^_]*_BASE/d' \ 234 ../include/k/kLdr.h > $@ 235 221 -
trunk/kStuff/kLdr/kLdr-os2.def
r3578 r3579 108 108 109 109 ; Error APIs: 110 _k LdrErrStr110 _kErrStr 111 111 112 112 -
trunk/kStuff/kLdr/kLdr-win.def
r3578 r3579 107 107 108 108 ; Error APIs: 109 k LdrErrStr109 kErrName 110 110 -
trunk/kStuff/kLdr/kLdrDyld.c
r3576 r3579 253 253 | KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT 254 254 | KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE)) 255 kldrDyldFailure(K LDR_ERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags);255 kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags); 256 256 if ( pArgs->enmSearch <= KLDRDYLD_SEARCH_INVALID 257 257 || pArgs->enmSearch >= KLDRDYLD_SEARCH_END) 258 kldrDyldFailure(K LDR_ERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch);258 kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch); 259 259 260 260 /* … … 461 461 * 462 462 * @returns 0 on success and pszName filled with the name. 463 * @returns K LDR_ERR_INVALID_HANDLE or KLDR_ERR_BUFFER_OVERFLOW on failure.463 * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure. 464 464 * @param hMod The module handle. 465 465 * @param pszName Where to put the name. … … 492 492 * 493 493 * @returns 0 on success and pszFilename filled with the name. 494 * @returns K LDR_ERR_INVALID_HANDLE or KLDR_ERR_BUFFER_OVERFLOW on failure.494 * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure. 495 495 * @param hMod The module handle. 496 496 * @param pszFilename Where to put the filename. … … 523 523 * 524 524 * @returns 0 on success and pValue and pfKind set. 525 * @returns K LDR_ERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure.525 * @returns KERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure. 526 526 * @param hMod The module handle. 527 527 * @param uSymbolOrdinal The symbol ordinal. This is ignored if pszSymbolName is non-zero. … … 542 542 *pValue = 0; 543 543 if (!pfKind && !pValue) 544 return K LDR_ERR_INVALID_PARAMETER;544 return KERR_INVALID_PARAMETER; 545 545 KLDRDYLD_VALIDATE_HKLDRMOD(hMod); 546 546 K_VALIDATE_OPTIONAL_STRING(pszSymbolName); … … 1073 1073 * Records the module. 1074 1074 * 1075 * @return 0 on success, K LDR_ERR_NO_MEMORY if we can't expand the table.1075 * @return 0 on success, KERR_NO_MEMORY if we can't expand the table. 1076 1076 * @param pMod The module to record. 1077 1077 */ … … 1087 1087 void *pvNew = kHlpAlloc(cNew * sizeof(g_papStackMods[0])); 1088 1088 if (!pvNew) 1089 return K LDR_ERR_NO_MEMORY;1089 return KERR_NO_MEMORY; 1090 1090 kHlpMemCopy(pvNew, pvOld, g_cStackMods * sizeof(g_papStackMods[0])); 1091 1091 g_papStackMods = (PPKLDRDYLDMOD)pvNew; -
trunk/kStuff/kLdr/kLdrDyldFind.c
r3578 r3579 620 620 return 0; 621 621 /** @todo deal with return codes properly. */ 622 if (rc >= K LDR_ERR_BASE && rc <= KLDR_ERR_END)622 if (rc >= KERR_BASE && rc <= KERR_END) 623 623 return rc; 624 624 … … 772 772 * Resolve default search method, prefix and suffix. 773 773 * 774 * @returns 0 on success, K LDR_ERR_INVALID_PARAMETER on failure.774 * @returns 0 on success, KERR_INVALID_PARAMETER on failure. 775 775 * @param penmSearch The search method. In/Out. 776 776 * @param ppszPrefix The prefix. In/Out. … … 828 828 default: 829 829 KLDRDYLDFIND_ASSERT(!"invalid search method"); 830 return K LDR_ERR_INVALID_PARAMETER;830 return KERR_INVALID_PARAMETER; 831 831 } 832 832 -
trunk/kStuff/kLdr/kLdrDyldMod.c
r3578 r3579 182 182 { 183 183 kLdrModClose(pRawMod); 184 rc = K LDR_ERR_NO_MEMORY;184 rc = KERR_NO_MEMORY; 185 185 } 186 186 return rc; … … 762 762 pMod->papPrereqs = (PPKLDRDYLDMOD)kHlpAllocZ(sizeof(pMod->papPrereqs[0]) * cPrereqs); 763 763 if (!pMod->papPrereqs) 764 return K LDR_ERR_NO_MEMORY;764 return KERR_NO_MEMORY; 765 765 pMod->cPrereqs = cPrereqs; 766 766 } … … 1224 1224 * Gets the module name. 1225 1225 * 1226 * @returns 0 on success, K LDR_ERR_BUFFER_OVERFLOW on failure.1226 * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure. 1227 1227 * @param pMod The module. 1228 1228 * @param pszName Where to store the name. … … 1237 1237 pszName[cch - 1] = '\0'; 1238 1238 } 1239 return cchName <= pMod->pMod->cchName ? K LDR_ERR_BUFFER_OVERFLOW : 0;1239 return cchName <= pMod->pMod->cchName ? KERR_BUFFER_OVERFLOW : 0; 1240 1240 } 1241 1241 … … 1244 1244 * Gets the module filename. 1245 1245 * 1246 * @returns 0 on success, K LDR_ERR_BUFFER_OVERFLOW on failure.1246 * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure. 1247 1247 * @param pMod The module. 1248 1248 * @param pszFilename Where to store the filename. … … 1257 1257 pszFilename[cch - 1] = '\0'; 1258 1258 } 1259 return cchFilename <= pMod->pMod->cchFilename ? K LDR_ERR_BUFFER_OVERFLOW : 0;1259 return cchFilename <= pMod->pMod->cchFilename ? KERR_BUFFER_OVERFLOW : 0; 1260 1260 } 1261 1261 -
trunk/kStuff/kLdr/kLdrInternal.h
r3578 r3579 329 329 || (hMod)->u32MagicTail != KLDRDYMOD_MAGIC) \ 330 330 { \ 331 return K LDR_ERR_INVALID_HANDLE; \331 return KERR_INVALID_HANDLE; \ 332 332 } \ 333 333 } while (0) -
trunk/kStuff/kLdr/kLdrMisc.c
r3573 r3579 59 59 case KLDRARCH_X86_16: 60 60 if (enmCpu < KLDRCPU_FIRST_X86_16 || enmCpu > KLDRCPU_LAST_X86_16) 61 return K LDR_ERR_INVALID_PARAMETER;61 return KERR_INVALID_PARAMETER; 62 62 63 63 /* intel? */ … … 83 83 case KLDRARCH_X86_32: 84 84 if (enmCpu < KLDRCPU_FIRST_X86_32 || enmCpu > KLDRCPU_LAST_X86_32) 85 return K LDR_ERR_INVALID_PARAMETER;85 return KERR_INVALID_PARAMETER; 86 86 87 87 /* blend? */ … … 111 111 case KLDRARCH_AMD64: 112 112 if (enmCpu < KLDRCPU_FIRST_AMD64 || enmCpu > KLDRCPU_LAST_AMD64) 113 return K LDR_ERR_INVALID_PARAMETER;113 return KERR_INVALID_PARAMETER; 114 114 115 115 /* blend? */ -
trunk/kStuff/kLdr/kLdrMod.c
r3578 r3579 70 70 /** Return / crash validation of a module argument. */ 71 71 #define KLDRMOD_VALIDATE(pMod) \ 72 KLDRMOD_VALIDATE_EX(pMod, K LDR_ERR_INVALID_PARAMETER)72 KLDRMOD_VALIDATE_EX(pMod, KERR_INVALID_PARAMETER) 73 73 74 74 /** Return / crash validation of a module argument. */ … … 263 263 KLDRMOD_VALIDATE(pMod); 264 264 if (!puValue && !pfKind) 265 return K LDR_ERR_INVALID_PARAMETER;265 return KERR_INVALID_PARAMETER; 266 266 if (puValue) 267 267 *puValue = 0; … … 300 300 * 301 301 * @returns 0 and name in pszName on success. 302 * On buffer overruns K LDR_ERR_BUFFER_OVERFLOW will be returned.302 * On buffer overruns KERR_BUFFER_OVERFLOW will be returned. 303 303 * On other failures and appropriate error code is returned. 304 304 * @param pMod The module. … … 421 421 KLDRMOD_VALIDATE(pMod); 422 422 if (!pAddrRsrc && !pcbRsrc) 423 return K LDR_ERR_INVALID_PARAMETER;423 return KERR_INVALID_PARAMETER; 424 424 if (pAddrRsrc) 425 425 *pAddrRsrc = NIL_KLDRADDR; -
trunk/kStuff/kLdr/kLdrModLX.c
r3578 r3579 273 273 pModLX = (PKLDRMODLX)kHlpAlloc(cb); 274 274 if (!pModLX) 275 return K LDR_ERR_NO_MEMORY;275 return KERR_NO_MEMORY; 276 276 *ppModLX = pModLX; 277 277 … … 938 938 pv = kHlpAlloc(pModLX->Hdr.e32_fixupsize); 939 939 if (!pv) 940 return K LDR_ERR_NO_MEMORY;940 return KERR_NO_MEMORY; 941 941 942 942 off = pModLX->Hdr.e32_objtab + pModLX->Hdr.e32_ldrsize; … … 1216 1216 if (cchName) 1217 1217 pszName[cchName - 1] = '\0'; 1218 rc = K LDR_ERR_BUFFER_OVERFLOW;1218 rc = KERR_BUFFER_OVERFLOW; 1219 1219 } 1220 1220 -
trunk/kStuff/kLdr/kLdrModMachO.c
r3578 r3579 280 280 pbLoadCommands = kHlpAlloc(s.Hdr32.sizeofcmds); 281 281 if (!pbLoadCommands) 282 return K LDR_ERR_NO_MEMORY;282 return KERR_NO_MEMORY; 283 283 rc = kRdrRead(pRdr, pbLoadCommands, s.Hdr32.sizeofcmds, 284 284 s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE … … 305 305 pModMachO = (PKLDRMODMACHO)kHlpAlloc(cb); 306 306 if (!pModMachO) 307 return K LDR_ERR_NO_MEMORY;307 return KERR_NO_MEMORY; 308 308 *ppModMachO = pModMachO; 309 309 pModMachO->pbLoadCommands = pbLoadCommands; … … 639 639 640 640 default: 641 return K LDR_ERR_INVALID_PARAMETER;641 return KERR_INVALID_PARAMETER; 642 642 } 643 643 … … 925 925 926 926 default: 927 return K LDR_ERR_INVALID_PARAMETER;927 return KERR_INVALID_PARAMETER; 928 928 } 929 929 … … 2140 2140 if (cbSyms / cbSym != pModMachO->cSymbols) 2141 2141 return KLDR_ERR_SIZE_OVERFLOW; 2142 rc = K LDR_ERR_NO_MEMORY;2142 rc = KERR_NO_MEMORY; 2143 2143 pvSyms = kHlpAlloc(cbSyms); 2144 2144 if (pvSyms) … … 2221 2221 paFixups = (macho_relocation_info_t *)kHlpAlloc(cbFixups); 2222 2222 if (!paFixups) 2223 return K LDR_ERR_NO_MEMORY;2223 return KERR_NO_MEMORY; 2224 2224 2225 2225 /* read the fixups. */ -
trunk/kStuff/kLdr/kLdrModNative.c
r3578 r3579 305 305 pModNative = (PKLDRMODNATIVE)kHlpAlloc(cb); 306 306 if (!pModNative) 307 return K LDR_ERR_NO_MEMORY;307 return KERR_NO_MEMORY; 308 308 309 309 /* KLDRMOD */ … … 766 766 if (cchName) 767 767 pszName[cchName - 1] = '\0'; 768 rc = K LDR_ERR_BUFFER_OVERFLOW;768 rc = KERR_BUFFER_OVERFLOW; 769 769 } 770 770 -
trunk/kStuff/kLdr/kLdrModPE.c
r3578 r3579 205 205 pModPE = (PKLDRMODPE)kHlpAlloc(cb); 206 206 if (!pModPE) 207 return K LDR_ERR_NO_MEMORY;207 return KERR_NO_MEMORY; 208 208 *ppModPE = pModPE; 209 209 … … 1050 1050 if (cchName) 1051 1051 pszName[cchName - 1] = '\0'; 1052 rc = K LDR_ERR_BUFFER_OVERFLOW;1052 rc = KERR_BUFFER_OVERFLOW; 1053 1053 } 1054 1054 -
trunk/kStuff/kLdr/testcase/tst-3-driver.c
r2967 r3579 120 120 rc = kLdrModOpen(pszFile, &pMod); 121 121 if (rc) 122 return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, k LdrErrStr(rc));122 return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, kErrName(rc)); 123 123 124 124 /* get bits. */ … … 163 163 } 164 164 else 165 Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, k LdrErrStr(rc));165 Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, kErrName(rc)); 166 166 } 167 167 else 168 Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, k LdrErrStr(rc));168 Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, kErrName(rc)); 169 169 } 170 170 else … … 172 172 } 173 173 else 174 Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, k LdrErrStr(rc));174 Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, kErrName(rc)); 175 175 } 176 176 else 177 Failure("kLdrModGetBits -> %#x (%s)\n", rc, k LdrErrStr(rc));177 Failure("kLdrModGetBits -> %#x (%s)\n", rc, kErrName(rc)); 178 178 free(pvBits); 179 179 } … … 184 184 rc = kLdrModClose(pMod); 185 185 if (rc) 186 Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, k LdrErrStr(rc));186 Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, kErrName(rc)); 187 187 return 0; 188 188 } -
trunk/kStuff/kLdr/tstkLdrMod.c
r3571 r3579 30 30 *******************************************************************************/ 31 31 #include <k/kLdr.h> 32 #include <k/kErr.h> 33 #include <k/kErrors.h> 34 32 35 #include <stdarg.h> 33 36 #include <stdio.h> … … 116 119 rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL); 117 120 if (rc) 118 return Failure("failed to get image bits, rc=%d (%s) (a)", rc, k LdrErrStr(rc));121 return Failure("failed to get image bits, rc=%d (%s) (a)", rc, kErrName(rc)); 119 122 if (TestMemComp(pvBits2, pvBits, cbImage)) 120 123 return Failure("relocation test failed, mismatching bits (a)"); … … 125 128 rc = kLdrModRelocateBits(pMod, pvBits2, 0x1000, (KUPTR)pvBits, BasicTestsGetImport, NULL); 126 129 if (rc) 127 return Failure("failed to relocate, rc=%d (%s) (b1)", rc, k LdrErrStr(rc));130 return Failure("failed to relocate, rc=%d (%s) (b1)", rc, kErrName(rc)); 128 131 rc = kLdrModRelocateBits(pMod, pvBits2, (KUPTR)pvBits, 0x1000, BasicTestsGetImport, NULL); 129 132 if (rc) 130 return Failure("failed to relocate, rc=%d (%s) (b2)", rc, k LdrErrStr(rc));133 return Failure("failed to relocate, rc=%d (%s) (b2)", rc, kErrName(rc)); 131 134 if (TestMemComp(pvBits2, pvBits, cbImage)) 132 135 return Failure("relocation test failed, mismatching bits (b)"); … … 138 141 rc = kLdrModRelocateBits(pMod, pvBits, 0x1000000, (KUPTR)pvBits, BasicTestsGetImport, NULL); 139 142 if (rc) 140 return Failure("failed to relocate, rc=%d (%s) (c1)", rc, k LdrErrStr(rc));143 return Failure("failed to relocate, rc=%d (%s) (c1)", rc, kErrName(rc)); 141 144 memset(pvBits2, 0xfe, cbImage); 142 145 rc = kLdrModGetBits(pMod, pvBits2, 0x1000000, BasicTestsGetImport, NULL); 143 146 if (rc) 144 return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, k LdrErrStr(rc));147 return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, kErrName(rc)); 145 148 if (TestMemComp(pvBits2, pvBits, cbImage)) 146 149 return Failure("relocation test failed, mismatching bits (c1)"); … … 149 152 rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0x1010000, 0x1000000, BasicTestsGetImport, NULL); 150 153 if (rc) 151 return Failure("failed to relocate, rc=%d (%s) (c2)", rc, k LdrErrStr(rc));154 return Failure("failed to relocate, rc=%d (%s) (c2)", rc, kErrName(rc)); 152 155 memset(pvBits2, 0xef, cbImage); 153 156 rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL); 154 157 if (rc) 155 return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, k LdrErrStr(rc));158 return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, kErrName(rc)); 156 159 if (TestMemComp(pvBits2, pvBits, cbImage)) 157 160 return Failure("relocation test failed, mismatching bits (c2)"); … … 160 163 rc = kLdrModRelocateBits(pMod, pvBits, MY_BASEADDRESS, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL); 161 164 if (rc) 162 return Failure("failed to relocate, rc=%d (%s) (c3)", rc, k LdrErrStr(rc));165 return Failure("failed to relocate, rc=%d (%s) (c3)", rc, kErrName(rc)); 163 166 memset(pvBits2, 0xef, cbImage); 164 167 rc = kLdrModGetBits(pMod, pvBits2, MY_BASEADDRESS, BasicTestsGetImport, NULL); 165 168 if (rc) 166 return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, k LdrErrStr(rc));169 return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, kErrName(rc)); 167 170 if (TestMemComp(pvBits2, pvBits, cbImage)) 168 171 return Failure("relocation test failed, mismatching bits (c3)"); … … 171 174 rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0 / 2 - 0x10000, MY_BASEADDRESS, BasicTestsGetImport, NULL); 172 175 if (rc) 173 return Failure("failed to relocate, rc=%d %(s) (c4)", rc, k LdrErrStr(rc));176 return Failure("failed to relocate, rc=%d %(s) (c4)", rc, kErrName(rc)); 174 177 memset(pvBits2, 0xdc, cbImage); 175 178 rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL); 176 179 if (rc) 177 return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, k LdrErrStr(rc));180 return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, kErrName(rc)); 178 181 if (TestMemComp(pvBits2, pvBits, cbImage)) 179 182 return Failure("relocation test failed, mismatching bits (c4)"); … … 182 185 rc = kLdrModRelocateBits(pMod, pvBits, (KUPTR)pvBits, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL); 183 186 if (rc) 184 return Failure("failed to relocate, rc=%d (%s) (c5)", rc, k LdrErrStr(rc));187 return Failure("failed to relocate, rc=%d (%s) (c5)", rc, kErrName(rc)); 185 188 memset(pvBits2, 0xcd, cbImage); 186 189 rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL); 187 190 if (rc) 188 return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, k LdrErrStr(rc));191 return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, kErrName(rc)); 189 192 if (TestMemComp(pvBits2, pvBits, cbImage)) 190 193 return Failure("relocation test failed, mismatching bits (c5)"); … … 217 220 &uValue2, &fKind2); 218 221 if (rc) 219 return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, k LdrErrStr(rc));222 return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc)); 220 223 if (uValue != uValue2) 221 224 return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/ord) pvBits=%p", … … 233 236 NULL, NULL, &uValue2, &fKind2); 234 237 if (rc) 235 return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, k LdrErrStr(rc));238 return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc)); 236 239 if (uValue != uValue2) 237 240 return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/name) pvBits=%p", … … 294 297 rc = kLdrModGetImport(pMod, pvBits, i, szImportModule, sizeof(szImportModule)); 295 298 if (rc) 296 return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, k LdrErrStr(rc), szImportModule);299 return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, kErrName(rc), szImportModule); 297 300 printf("import #%d: '%s'\n", i, szImportModule); 298 301 } … … 307 310 rc = kLdrModGetStackInfo(pMod, pvBits, MY_BASEADDRESS, &StackInfo); 308 311 if (rc) 309 return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, k LdrErrStr(rc));312 return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, kErrName(rc)); 310 313 printf("Stack: Address=%016" PRI_KLDRADDR " LinkAddress=%016" PRI_KLDRADDR "\n" 311 314 " cbStack=%016" PRI_KLDRSIZE " cbStackThread=%016" PRI_KLDRSIZE "\n", … … 326 329 rc = kLdrModQueryMainEntrypoint(pMod, pvBits, MY_BASEADDRESS, &MainEPAddress); 327 330 if (rc) 328 return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, k LdrErrStr(rc));331 return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, kErrName(rc)); 329 332 printf("Entrypoint: %016" PRI_KLDRADDR "\n", MainEPAddress); 330 333 if (MainEPAddress == ~(KLDRADDR)42) … … 344 347 printf("NO Debugger Information\n"); 345 348 else 346 return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, k LdrErrStr(rc));349 return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, kErrName(rc)); 347 350 rc = kLdrModEnumDbgInfo(pMod, pvBits, BasicTestEnumDbgInfoCallback, NULL); 348 351 if (rc) 349 return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, k LdrErrStr(rc));352 return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, kErrName(rc)); 350 353 351 354 … … 379 382 rc = kLdrModEnumSymbols(pMod, pvBits, MY_BASEADDRESS, 0, BasicTestsEnumSymCallback, pvBits); 380 383 if (rc) 381 return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, k LdrErrStr(rc));384 return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, kErrName(rc)); 382 385 383 386 … … 488 491 rc = kLdrModGetBits(pMod, pvBits, (KUPTR)pvBits, BasicTestsGetImport, NULL); 489 492 if (rc) 490 return Failure("failed to get image bits, rc=%d (%s)", rc, k LdrErrStr(rc));493 return Failure("failed to get image bits, rc=%d (%s)", rc, kErrName(rc)); 491 494 492 495 /* … … 523 526 rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL); 524 527 if (rc) 525 return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, k LdrErrStr(rc));528 return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, kErrName(rc)); 526 529 527 530 rc = kLdrModReload(pMod); 528 531 if (rc) 529 return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, k LdrErrStr(rc));532 return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, kErrName(rc)); 530 533 531 534 rc = kLdrModReload(pMod); 532 535 if (rc) 533 return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, k LdrErrStr(rc));536 return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, kErrName(rc)); 534 537 535 538 rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL); 536 539 if (rc) 537 return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, k LdrErrStr(rc));540 return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, kErrName(rc)); 538 541 539 542 rc = kLdrModAllocTLS(pMod); 540 543 if (rc) 541 return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, k LdrErrStr(rc));544 return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, kErrName(rc)); 542 545 kLdrModFreeTLS(pMod); 543 546 544 547 rc = kLdrModAllocTLS(pMod); 545 548 if (rc) 546 return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, k LdrErrStr(rc));549 return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, kErrName(rc)); 547 550 kLdrModFreeTLS(pMod); 548 551 … … 553 556 rc = BasicTestsSub2(pMod, NULL); 554 557 if (rc) 555 return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, k LdrErrStr(rc));558 return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, kErrName(rc)); 556 559 return 0; 557 560 } … … 568 571 rc = kLdrModMap(pMod); 569 572 if (rc) 570 return Failure("kLdrModMap failed, rc=%d (%s)", rc, k LdrErrStr(rc));573 return Failure("kLdrModMap failed, rc=%d (%s)", rc, kErrName(rc)); 571 574 rc = BasicTestsSubMap2(pMod); 572 575 rc2 = kLdrModUnmap(pMod); 573 576 if (rc2) 574 577 { 575 Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, k LdrErrStr(rc2));578 Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, kErrName(rc2)); 576 579 rc = rc ? rc : rc2; 577 580 } … … 601 604 rc2 = kLdrModClose(pMod); 602 605 if (rc2) 603 Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, k LdrErrStr(rc));606 Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc)); 604 607 if (rc2 && !rc) 605 608 rc = rc2; 606 609 } 607 610 else 608 Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, k LdrErrStr(rc));611 Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc)); 609 612 return rc ? 1 : 0; 610 613 }
Note:
See TracChangeset
for help on using the changeset viewer.