MCPcopy Create free account
hub / github.com/cuberite/cuberite / LoadModules

Method LoadModules

src/StackWalker.cpp:884–996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

882}
883
884BOOL StackWalker::LoadModules()
885{
886 if (this->m_sw == NULL)
887 {
888 SetLastError(ERROR_DLL_INIT_FAILED);
889 return FALSE;
890 }
891 if (m_modulesLoaded != FALSE)
892 return TRUE;
893
894 // Build the sym-path:
895 char *szSymPath = NULL;
896 if ( (this->m_options & SymBuildPath) != 0)
897 {
898 const size_t nSymPathLen = 4096;
899 szSymPath = (char*) malloc(nSymPathLen);
900 if (szSymPath == NULL)
901 {
902 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
903 return FALSE;
904 }
905 szSymPath[0] = 0;
906 // Now first add the (optional) provided sympath:
907 if (this->m_szSymPath != NULL)
908 {
909 strcat_s(szSymPath, nSymPathLen, this->m_szSymPath);
910 strcat_s(szSymPath, nSymPathLen, ";");
911 }
912
913 strcat_s(szSymPath, nSymPathLen, ".;");
914
915 const size_t nTempLen = 1024;
916 char szTemp[nTempLen];
917 // Now add the current directory:
918 if (GetCurrentDirectoryA(nTempLen, szTemp) > 0)
919 {
920 szTemp[nTempLen-1] = 0;
921 strcat_s(szSymPath, nSymPathLen, szTemp);
922 strcat_s(szSymPath, nSymPathLen, ";");
923 }
924
925 // Now add the path for the main-module:
926 if (GetModuleFileNameA(NULL, szTemp, nTempLen) > 0)
927 {
928 szTemp[nTempLen-1] = 0;
929 for (char *p = (szTemp+strlen(szTemp)-1); p >= szTemp; --p)
930 {
931 // locate the rightmost path separator
932 if ( (*p == '\\') || (*p == '/') || (*p == ':') )
933 {
934 *p = 0;
935 break;
936 }
937 } // for (search for path separator...)
938 if (strlen(szTemp) > 0)
939 {
940 strcat_s(szSymPath, nSymPathLen, szTemp);
941 strcat_s(szSymPath, nSymPathLen, ";");

Callers 2

ShowCallstackMethod · 0.95
DumpUsedMemoryFunction · 0.45

Calls 2

OnDbgHelpErrMethod · 0.95
InitMethod · 0.45

Tested by

no test coverage detected