uppsrc: Crash moved to archive

git-svn-id: svn://ultimatepp.org/upp/trunk@15310 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-10-27 08:34:09 +00:00
parent 4bc92b475f
commit ff1c426cac
12 changed files with 646 additions and 601 deletions

View file

@ -1,16 +1,16 @@
description "Utility to examine content of .crash and .map files\377"; description "Utility to examine content of .crash and .map files\377";
uses uses
CtrlLib; CtrlLib;
file file
imagehlp.dli, imagehlp.dli,
crash.cpp, crash.cpp,
crash.iml, crash.iml,
crash.rc, crash.rc,
Info readonly separator, Info readonly separator,
Copying; Copying;
mainconfig mainconfig
"" = "GUI"; "" = "GUI";

View file

@ -1,253 +1,253 @@
#include <CtrlLib/CtrlLib.h> #include <CtrlLib/CtrlLib.h>
#include <winver.h> #include <winver.h>
#include <imagehlp.h> #include <imagehlp.h>
using namespace Upp; using namespace Upp;
#define DLLFILENAME "imagehlp.dll" #define DLLFILENAME "imagehlp.dll"
#define DLIHEADER "imagehlp.dli" #define DLIHEADER "imagehlp.dli"
#define DLIMODULE Imagehlp #define DLIMODULE Imagehlp
#include <Core/dli.h> #include <Core/dli.h>
Vector<unsigned > address; Vector<unsigned > address;
Vector<String> name; Vector<String> name;
String mapname; String mapname;
void LoadMap(String fn) void LoadMap(String fn)
{ {
String fpos = GetFileName(fn); String fpos = GetFileName(fn);
int dp = fpos.Find('.'); int dp = fpos.Find('.');
if(dp >= 0) if(dp >= 0)
fpos.Trim(dp); fpos.Trim(dp);
fn = AppendFileName(GetFileDirectory(fn), fpos) + ".map"; fn = AppendFileName(GetFileDirectory(fn), fpos) + ".map";
if(mapname == fn) if(mapname == fn)
return; return;
mapname = fn; mapname = fn;
address.Clear(); address.Clear();
name.Clear(); name.Clear();
String map = LoadFile(fn); String map = LoadFile(fn);
if(IsNull(map)) if(IsNull(map))
return; return;
const char *p = map; const char *p = map;
while(*p) while(*p)
if(*p++ == '\n' && !memcmp(p, " 0001:", 6)) { if(*p++ == '\n' && !memcmp(p, " 0001:", 6)) {
p += 5; p += 5;
while(IsXDigit(*++p)) while(IsXDigit(*++p))
; ;
while(*p == ' ') while(*p == ' ')
p++; p++;
const char *b = p; const char *b = p;
while((byte)*p > ' ') while((byte)*p > ' ')
p++; p++;
const char *e = p; const char *e = p;
while(*p == ' ') while(*p == ' ')
p++; p++;
if(e > b && IsXDigit(*p)) { if(e > b && IsXDigit(*p)) {
unsigned addr = strtoul(p, 0, 16); unsigned addr = strtoul(p, 0, 16);
address.Add(addr); address.Add(addr);
name.Add(String(b, e)); name.Add(String(b, e));
} }
} }
IndexSort(address, name, StdLess<unsigned>()); IndexSort(address, name, StdLess<unsigned>());
} }
String Fname(dword addr, bool& recognized) { String Fname(dword addr, bool& recognized) {
int pos = BinFindIndex(address, addr + 1) - 1; int pos = BinFindIndex(address, addr + 1) - 1;
String s; String s;
s.Cat(Format("0x%08x", (int)addr)); s.Cat(Format("0x%08x", (int)addr));
if(pos >= 0) { if(pos >= 0) {
dword off = addr - address[pos]; dword off = addr - address[pos];
if(off < 8000) { if(off < 8000) {
s << ": "; s << ": ";
if(Imagehlp()) { if(Imagehlp()) {
char nm[1024]; char nm[1024];
Imagehlp().UnDecorateSymbolName(name[pos], nm, 1024, UNDNAME_NO_ACCESS_SPECIFIERS| Imagehlp().UnDecorateSymbolName(name[pos], nm, 1024, UNDNAME_NO_ACCESS_SPECIFIERS|
UNDNAME_NO_MEMBER_TYPE|UNDNAME_NO_MS_KEYWORDS); UNDNAME_NO_MEMBER_TYPE|UNDNAME_NO_MS_KEYWORDS);
s << nm; s << nm;
} }
else else
s << name[pos]; s << name[pos];
s << Format(" + 0x%x bytes", (int)off); s << Format(" + 0x%x bytes", (int)off);
recognized = true; recognized = true;
return s; return s;
} }
} }
s << " = " << Format("%d [%d, %d]", (int)addr, (int)LOWORD(addr), (int)HIWORD(addr)); s << " = " << Format("%d [%d, %d]", (int)addr, (int)LOWORD(addr), (int)HIWORD(addr));
recognized = false; recognized = false;
return s; return s;
} }
String LoadCrashFile(String filename) String LoadCrashFile(String filename)
{ {
LoadMap(filename); LoadMap(filename);
FileIn in(filename); FileIn in(filename);
String text; String text;
text << "Crash log " << GetFileName(filename) << "\n"; text << "Crash log " << GetFileName(filename) << "\n";
if(name.GetCount() == 0) if(name.GetCount() == 0)
text << "No mapfile found" << "\n"; text << "No mapfile found" << "\n";
dword version; dword version;
dword code, address; dword code, address;
int npar; int npar;
in % version; in % version;
in % code % address % npar; in % code % address % npar;
Vector<dword> info; Vector<dword> info;
Vector<dword> stack; Vector<dword> stack;
bool r; bool r;
int i; int i;
while(npar--) while(npar--)
in % info.Add(); in % info.Add();
switch(code) { switch(code) {
case EXCEPTION_ACCESS_VIOLATION: case EXCEPTION_ACCESS_VIOLATION:
text << "Access violation "; text << "Access violation ";
if(info.GetCount() >= 2) if(info.GetCount() >= 2)
text << (info[0] ? "writing" : "reading") << Format(" at 0x%08x", (int)info[1]); text << (info[0] ? "writing" : "reading") << Format(" at 0x%08x", (int)info[1]);
break; break;
#define MEX(id) case id: text << #id; break; #define MEX(id) case id: text << #id; break;
MEX(EXCEPTION_DATATYPE_MISALIGNMENT) MEX(EXCEPTION_DATATYPE_MISALIGNMENT)
MEX(EXCEPTION_BREAKPOINT) MEX(EXCEPTION_BREAKPOINT)
MEX(EXCEPTION_SINGLE_STEP) MEX(EXCEPTION_SINGLE_STEP)
MEX(EXCEPTION_ARRAY_BOUNDS_EXCEEDED) MEX(EXCEPTION_ARRAY_BOUNDS_EXCEEDED)
MEX(EXCEPTION_FLT_DENORMAL_OPERAND) MEX(EXCEPTION_FLT_DENORMAL_OPERAND)
MEX(EXCEPTION_FLT_DIVIDE_BY_ZERO) MEX(EXCEPTION_FLT_DIVIDE_BY_ZERO)
MEX(EXCEPTION_FLT_INEXACT_RESULT) MEX(EXCEPTION_FLT_INEXACT_RESULT)
MEX(EXCEPTION_FLT_INVALID_OPERATION) MEX(EXCEPTION_FLT_INVALID_OPERATION)
MEX(EXCEPTION_FLT_OVERFLOW) MEX(EXCEPTION_FLT_OVERFLOW)
MEX(EXCEPTION_FLT_STACK_CHECK) MEX(EXCEPTION_FLT_STACK_CHECK)
MEX(EXCEPTION_FLT_UNDERFLOW) MEX(EXCEPTION_FLT_UNDERFLOW)
MEX(EXCEPTION_INT_DIVIDE_BY_ZERO) MEX(EXCEPTION_INT_DIVIDE_BY_ZERO)
MEX(EXCEPTION_INT_OVERFLOW) MEX(EXCEPTION_INT_OVERFLOW)
MEX(EXCEPTION_PRIV_INSTRUCTION) MEX(EXCEPTION_PRIV_INSTRUCTION)
MEX(EXCEPTION_IN_PAGE_ERROR) MEX(EXCEPTION_IN_PAGE_ERROR)
MEX(EXCEPTION_ILLEGAL_INSTRUCTION) MEX(EXCEPTION_ILLEGAL_INSTRUCTION)
MEX(EXCEPTION_NONCONTINUABLE_EXCEPTION) MEX(EXCEPTION_NONCONTINUABLE_EXCEPTION)
MEX(EXCEPTION_STACK_OVERFLOW) MEX(EXCEPTION_STACK_OVERFLOW)
MEX(EXCEPTION_INVALID_DISPOSITION) MEX(EXCEPTION_INVALID_DISPOSITION)
MEX(EXCEPTION_GUARD_PAGE) MEX(EXCEPTION_GUARD_PAGE)
MEX(EXCEPTION_INVALID_HANDLE) MEX(EXCEPTION_INVALID_HANDLE)
default: default:
text << Format("Exception 0x%08x", (int)code); text << Format("Exception 0x%08x", (int)code);
} }
text << '\n' << Fname(address, r) << '\n'; text << '\n' << Fname(address, r) << '\n';
while(!in.IsEof()) while(!in.IsEof())
in % stack.Add(); in % stack.Add();
text << "\nRecognized stack dwords:\n"; text << "\nRecognized stack dwords:\n";
for(i = 0; i < stack.GetCount(); i++) { for(i = 0; i < stack.GetCount(); i++) {
String s = Fname(stack[i], r); String s = Fname(stack[i], r);
if(r) text << "\t" << s << '\n'; if(r) text << "\t" << s << '\n';
} }
text << "\nComplete stack:\n"; text << "\nComplete stack:\n";
for(i = 0; i < stack.GetCount(); i++) for(i = 0; i < stack.GetCount(); i++)
text << "\t" << Fname(stack[i], r) << '\n'; text << "\t" << Fname(stack[i], r) << '\n';
return text; return text;
} }
class CrashViewer : public TopWindow { class CrashViewer : public TopWindow {
public: public:
typedef CrashViewer CLASSNAME; typedef CrashViewer CLASSNAME;
CrashViewer(); CrashViewer();
void Run(); void Run();
bool OpenFile(); bool OpenFile();
virtual bool Key(dword key, int repcnt); virtual bool Key(dword key, int repcnt);
void LoadCrashFile(); void LoadCrashFile();
private: private:
Splitter splitter; Splitter splitter;
ArrayCtrl crashfiles; ArrayCtrl crashfiles;
LineEdit crashdump; LineEdit crashdump;
}; };
CrashViewer::CrashViewer() CrashViewer::CrashViewer()
{ {
Sizeable().Zoomable(); Sizeable().Zoomable();
splitter.Horz(crashfiles, crashdump); splitter.Horz(crashfiles, crashdump);
splitter.SetPos(3000); splitter.SetPos(3000);
Add(splitter.SizePos()); Add(splitter.SizePos());
crashfiles.AutoHideSb().NoHeader(); crashfiles.AutoHideSb().NoHeader();
crashfiles.AddColumn(); crashfiles.AddColumn();
crashfiles.WhenCursor = THISBACK(LoadCrashFile); crashfiles.WhenCursor = THISBACK(LoadCrashFile);
crashdump.SetFont(Courier(14)); crashdump.SetFont(Courier(14));
} }
void CrashViewer::Run() void CrashViewer::Run()
{ {
if(!OpenFile()) if(!OpenFile())
return; return;
LoadCrashFile(); LoadCrashFile();
TopWindow::Run(); TopWindow::Run();
} }
bool CrashViewer::Key(dword key, int repcnt) bool CrashViewer::Key(dword key, int repcnt)
{ {
if(key == K_CTRL_O) { if(key == K_CTRL_O) {
OpenFile(); OpenFile();
return true; return true;
} }
return TopWindow::Key(key, repcnt); return TopWindow::Key(key, repcnt);
} }
bool CrashViewer::OpenFile() bool CrashViewer::OpenFile()
{ {
FileSelector fs; FileSelector fs;
LoadFromFile(fs); LoadFromFile(fs);
fs.Type("Crash file", "*.crash"); fs.Type("Crash file", "*.crash");
fs.DefaultExt("crash"); fs.DefaultExt("crash");
fs.Multi(); fs.Multi();
if(!fs.ExecuteOpen()) return false; if(!fs.ExecuteOpen()) return false;
StoreToFile(fs); StoreToFile(fs);
int newln = -1; int newln = -1;
for(int i = 0; i < fs.GetCount(); i++) { for(int i = 0; i < fs.GetCount(); i++) {
String path = fs[i]; String path = fs[i];
int f = crashfiles.Find(path); int f = crashfiles.Find(path);
if(f < 0) { if(f < 0) {
newln = crashfiles.GetCount(); newln = crashfiles.GetCount();
crashfiles.Add(path); crashfiles.Add(path);
} }
} }
if(newln >= 0) if(newln >= 0)
crashfiles.SetCursor(newln); crashfiles.SetCursor(newln);
return true; return true;
} }
void CrashViewer::LoadCrashFile() void CrashViewer::LoadCrashFile()
{ {
String fn = Null; String fn = Null;
if(crashfiles.IsCursor()) if(crashfiles.IsCursor())
fn = crashfiles.Get(0); fn = crashfiles.Get(0);
String title = fn; String title = fn;
if(!IsNull(title)) if(!IsNull(title))
title << " - crash analyzer"; title << " - crash analyzer";
else else
title << "Crash analyzer"; title << "Crash analyzer";
Title(title); Title(title);
if(IsNull(fn)) if(IsNull(fn))
crashdump <<= Null; crashdump <<= Null;
else else
crashdump <<= ::LoadCrashFile(fn); crashdump <<= ::LoadCrashFile(fn);
} }
GUI_APP_MAIN GUI_APP_MAIN
{ {
SetDefaultCharset(CHARSET_WIN1250); SetDefaultCharset(CHARSET_WIN1250);
CrashViewer viewer; CrashViewer viewer;
viewer.Run(); viewer.Run();
/* /*
FileSelector fs; FileSelector fs;
LoadFromFile(fs); LoadFromFile(fs);
fs.Type("Crash file", "*.crash"); fs.Type("Crash file", "*.crash");
if(!fs.ExecuteOpen()) return; if(!fs.ExecuteOpen()) return;
String text = LoadCrashFile(~fs); String text = LoadCrashFile(~fs);
TopWindow win; TopWindow win;
win.Title("Crash analyzer - " + ~fs).Sizeable().Zoomable(); win.Title("Crash analyzer - " + ~fs).Sizeable().Zoomable();
win.Icon(Image::Icon(100, true), Image::Icon(100, false)); win.Icon(Image::Icon(100, true), Image::Icon(100, false));
LineEdit edit; LineEdit edit;
edit.SetFont(Courier(14)); edit.SetFont(Courier(14));
edit <<= text; edit <<= text;
win.Add(edit.SizePos()); win.Add(edit.SizePos());
win.Run(); win.Run();
*/ */
// StoreToFile(fs); // StoreToFile(fs);
} }

View file

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 974 B

Before After
Before After

View file

@ -1,14 +1,14 @@
PREMULTIPLIED PREMULTIPLIED
IMAGE_ID(app_large) IMAGE_ID(app_large)
IMAGE_ID(app_small) IMAGE_ID(app_small)
IMAGE_BEGIN_DATA IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,229,150,91,14,132,48,8,69,89,194,44,193,165,186,115,102,162,153,153,22,41,143,66,91,19,49,124,244,193,61) IMAGE_DATA(120,156,229,150,91,14,132,48,8,69,89,194,44,193,165,186,115,102,162,153,153,22,41,143,66,91,19,49,124,244,193,61)
IMAGE_DATA(183,24,83,97,131,13,162,177,3,96,153,97,65,39,79,203,85,220,76,31,81,118,175,135,44,110,143,143,81,108,171,135) IMAGE_DATA(183,24,83,97,131,13,162,177,3,96,153,97,65,39,79,203,85,220,76,31,81,118,175,135,44,110,143,143,81,108,171,135)
IMAGE_DATA(149,252,209,108,201,195,44,118,203,195,74,254,108,54,245,240,100,126,57,70,60,147,142,203,57,109,141,211,224,106,189,115) IMAGE_DATA(149,252,209,108,201,195,44,118,203,195,74,254,108,54,245,240,100,126,57,70,60,147,142,203,57,109,141,211,224,106,189,115)
IMAGE_DATA(146,230,119,156,197,178,156,81,242,57,227,252,52,91,181,220,222,81,253,143,188,19,173,119,214,247,239,237,63,192,179,191) IMAGE_DATA(146,230,119,156,197,178,156,81,242,57,227,252,52,91,181,220,222,81,253,143,188,19,173,119,214,247,239,237,63,192,179,191)
IMAGE_DATA(255,59,240,87,120,0,18,171,249,51,61,112,236,89,30,36,246,29,248,35,61,88,216,35,124,120,185,153,30,34,236,136) IMAGE_DATA(255,59,240,87,120,0,18,171,249,51,61,112,236,89,30,36,246,29,248,35,61,88,216,35,124,120,185,153,30,34,236,136)
IMAGE_DATA(143,44,174,213,79,183,208,235,243,40,17,61,76,70,125,175,198,113,217,58,234,233,190,223,133,78,214,208,144,103,61,179) IMAGE_DATA(143,44,174,213,79,183,208,235,243,40,17,61,76,70,125,175,198,113,217,58,234,233,190,223,133,78,214,208,144,103,61,179)
IMAGE_DATA(70,52,43,93,186,118,140,1,46,63,80,194,153,254,251,160,145,214,122,100,180,116,15,151,61,149,134,163,190,234,35,214) IMAGE_DATA(70,52,43,93,186,118,140,1,46,63,80,194,153,254,251,160,145,214,122,100,180,116,15,151,61,149,134,163,190,234,35,214)
IMAGE_DATA(222,53,141,86,95,105,111,133,122,147,47,134,37,133,135,231,169,247,106,176,241,6,223,11,189,79,0,0,0,0,0,0) IMAGE_DATA(222,53,141,86,95,105,111,133,122,147,47,134,37,133,135,231,169,247,106,176,241,6,223,11,189,79,0,0,0,0,0,0)
IMAGE_END_DATA(256, 2) IMAGE_END_DATA(256, 2)

View file

@ -1,313 +1,313 @@
# Microsoft Developer Studio Generated NMAKE File, Based on crash.dsp # Microsoft Developer Studio Generated NMAKE File, Based on crash.dsp
!IF "$(CFG)" == "" !IF "$(CFG)" == ""
CFG=crash - Win32 Debug CFG=crash - Win32 Debug
!MESSAGE No configuration specified. Defaulting to crash - Win32 Debug. !MESSAGE No configuration specified. Defaulting to crash - Win32 Debug.
!ENDIF !ENDIF
!IF "$(CFG)" != "crash - Win32 Release" && "$(CFG)" != "crash - Win32 Debug" !IF "$(CFG)" != "crash - Win32 Release" && "$(CFG)" != "crash - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified. !MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "crash.mak" CFG="crash - Win32 Debug" !MESSAGE NMAKE /f "crash.mak" CFG="crash - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "crash - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "crash - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "crash - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE "crash - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE !MESSAGE
!ERROR An invalid configuration is specified. !ERROR An invalid configuration is specified.
!ENDIF !ENDIF
!IF "$(OS)" == "Windows_NT" !IF "$(OS)" == "Windows_NT"
NULL= NULL=
!ELSE !ELSE
NULL=nul NULL=nul
!ENDIF !ENDIF
CPP=cl.exe CPP=cl.exe
MTL=midl.exe MTL=midl.exe
RSC=rc.exe RSC=rc.exe
!IF "$(CFG)" == "crash - Win32 Release" !IF "$(CFG)" == "crash - Win32 Release"
OUTDIR=.\Release OUTDIR=.\Release
INTDIR=.\Release INTDIR=.\Release
!IF "$(RECURSE)" == "0" !IF "$(RECURSE)" == "0"
ALL : "c:\tools\crash.exe" ALL : "c:\tools\crash.exe"
!ELSE !ELSE
ALL : "VLib - Win32 Release" "tlib - Win32 Release" "tgui - Win32 Release" "CtrlLib - Win32 Release" "c:\tools\crash.exe" ALL : "VLib - Win32 Release" "tlib - Win32 Release" "tgui - Win32 Release" "CtrlLib - Win32 Release" "c:\tools\crash.exe"
!ENDIF !ENDIF
!IF "$(RECURSE)" == "1" !IF "$(RECURSE)" == "1"
CLEAN :"CtrlLib - Win32 ReleaseCLEAN" "tgui - Win32 ReleaseCLEAN" "tlib - Win32 ReleaseCLEAN" "VLib - Win32 ReleaseCLEAN" CLEAN :"CtrlLib - Win32 ReleaseCLEAN" "tgui - Win32 ReleaseCLEAN" "tlib - Win32 ReleaseCLEAN" "VLib - Win32 ReleaseCLEAN"
!ELSE !ELSE
CLEAN : CLEAN :
!ENDIF !ENDIF
-@erase "$(INTDIR)\crash.obj" -@erase "$(INTDIR)\crash.obj"
-@erase "$(INTDIR)\crash.res" -@erase "$(INTDIR)\crash.res"
-@erase "$(INTDIR)\vc60.idb" -@erase "$(INTDIR)\vc60.idb"
-@erase "c:\tools\crash.exe" -@erase "c:\tools\crash.exe"
"$(OUTDIR)" : "$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MT /W3 /GR /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\crash.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c CPP_PROJ=/nologo /MT /W3 /GR /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\crash.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC_PROJ=/l 0x405 /fo"$(INTDIR)\crash.res" /d "NDEBUG" RSC_PROJ=/l 0x405 /fo"$(INTDIR)\crash.res" /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\crash.bsc" BSC32_FLAGS=/nologo /o"$(OUTDIR)\crash.bsc"
BSC32_SBRS= \ BSC32_SBRS= \
LINK32=link.exe LINK32=link.exe
LINK32_FLAGS=/nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\crash.pdb" /machine:I386 /out:"c:/tools/crash.exe" LINK32_FLAGS=/nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\crash.pdb" /machine:I386 /out:"c:/tools/crash.exe"
LINK32_OBJS= \ LINK32_OBJS= \
"$(INTDIR)\crash.obj" \ "$(INTDIR)\crash.obj" \
"$(INTDIR)\crash.res" \ "$(INTDIR)\crash.res" \
"..\CtrlLib\Release\CtrlLib.lib" \ "..\CtrlLib\Release\CtrlLib.lib" \
"E:\build\tgui\Release\tgui.lib" \ "E:\build\tgui\Release\tgui.lib" \
"E:\build\tlib\Release\tlib.lib" \ "E:\build\tlib\Release\tlib.lib" \
"..\VLib\Release\VLib.lib" "..\VLib\Release\VLib.lib"
"c:\tools\crash.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) "c:\tools\crash.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<< $(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS) $(LINK32_FLAGS) $(LINK32_OBJS)
<< <<
!ELSEIF "$(CFG)" == "crash - Win32 Debug" !ELSEIF "$(CFG)" == "crash - Win32 Debug"
OUTDIR=.\Debug OUTDIR=.\Debug
INTDIR=.\Debug INTDIR=.\Debug
# Begin Custom Macros # Begin Custom Macros
OutDir=.\Debug OutDir=.\Debug
# End Custom Macros # End Custom Macros
!IF "$(RECURSE)" == "0" !IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\crash.exe" ALL : "$(OUTDIR)\crash.exe"
!ELSE !ELSE
ALL : "VLib - Win32 Debug" "tlib - Win32 Debug" "tgui - Win32 Debug" "CtrlLib - Win32 Debug" "$(OUTDIR)\crash.exe" ALL : "VLib - Win32 Debug" "tlib - Win32 Debug" "tgui - Win32 Debug" "CtrlLib - Win32 Debug" "$(OUTDIR)\crash.exe"
!ENDIF !ENDIF
!IF "$(RECURSE)" == "1" !IF "$(RECURSE)" == "1"
CLEAN :"CtrlLib - Win32 DebugCLEAN" "tgui - Win32 DebugCLEAN" "tlib - Win32 DebugCLEAN" "VLib - Win32 DebugCLEAN" CLEAN :"CtrlLib - Win32 DebugCLEAN" "tgui - Win32 DebugCLEAN" "tlib - Win32 DebugCLEAN" "VLib - Win32 DebugCLEAN"
!ELSE !ELSE
CLEAN : CLEAN :
!ENDIF !ENDIF
-@erase "$(INTDIR)\crash.obj" -@erase "$(INTDIR)\crash.obj"
-@erase "$(INTDIR)\crash.res" -@erase "$(INTDIR)\crash.res"
-@erase "$(INTDIR)\vc60.idb" -@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb" -@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\crash.exe" -@erase "$(OUTDIR)\crash.exe"
-@erase "$(OUTDIR)\crash.ilk" -@erase "$(OUTDIR)\crash.ilk"
-@erase "$(OUTDIR)\crash.pdb" -@erase "$(OUTDIR)\crash.pdb"
"$(OUTDIR)" : "$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MTd /W3 /Gm /GR /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\crash.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c CPP_PROJ=/nologo /MTd /W3 /Gm /GR /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\crash.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC_PROJ=/l 0x405 /fo"$(INTDIR)\crash.res" /d "_DEBUG" RSC_PROJ=/l 0x405 /fo"$(INTDIR)\crash.res" /d "_DEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\crash.bsc" BSC32_FLAGS=/nologo /o"$(OUTDIR)\crash.bsc"
BSC32_SBRS= \ BSC32_SBRS= \
LINK32=link.exe LINK32=link.exe
LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\crash.pdb" /debug /machine:I386 /out:"$(OUTDIR)\crash.exe" /pdbtype:sept LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\crash.pdb" /debug /machine:I386 /out:"$(OUTDIR)\crash.exe" /pdbtype:sept
LINK32_OBJS= \ LINK32_OBJS= \
"$(INTDIR)\crash.obj" \ "$(INTDIR)\crash.obj" \
"$(INTDIR)\crash.res" \ "$(INTDIR)\crash.res" \
"..\CtrlLib\Debug\CtrlLib.lib" \ "..\CtrlLib\Debug\CtrlLib.lib" \
"E:\build\tgui\Debug\tgui.lib" \ "E:\build\tgui\Debug\tgui.lib" \
"E:\build\tlib\Debug\tlib.lib" \ "E:\build\tlib\Debug\tlib.lib" \
"..\VLib\Debug\VLib.lib" "..\VLib\Debug\VLib.lib"
"$(OUTDIR)\crash.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) "$(OUTDIR)\crash.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<< $(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS) $(LINK32_FLAGS) $(LINK32_OBJS)
<< <<
!ENDIF !ENDIF
.c{$(INTDIR)}.obj:: .c{$(INTDIR)}.obj::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.cpp{$(INTDIR)}.obj:: .cpp{$(INTDIR)}.obj::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.cxx{$(INTDIR)}.obj:: .cxx{$(INTDIR)}.obj::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.c{$(INTDIR)}.sbr:: .c{$(INTDIR)}.sbr::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.cpp{$(INTDIR)}.sbr:: .cpp{$(INTDIR)}.sbr::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.cxx{$(INTDIR)}.sbr:: .cxx{$(INTDIR)}.sbr::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
!IF "$(NO_EXTERNAL_DEPS)" != "1" !IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("crash.dep") !IF EXISTS("crash.dep")
!INCLUDE "crash.dep" !INCLUDE "crash.dep"
!ELSE !ELSE
!MESSAGE Warning: cannot find "crash.dep" !MESSAGE Warning: cannot find "crash.dep"
!ENDIF !ENDIF
!ENDIF !ENDIF
!IF "$(CFG)" == "crash - Win32 Release" || "$(CFG)" == "crash - Win32 Debug" !IF "$(CFG)" == "crash - Win32 Release" || "$(CFG)" == "crash - Win32 Debug"
SOURCE=.\crash.cpp SOURCE=.\crash.cpp
"$(INTDIR)\crash.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\crash.obj" : $(SOURCE) "$(INTDIR)"
SOURCE=.\crash.rc SOURCE=.\crash.rc
"$(INTDIR)\crash.res" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\crash.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE) $(RSC) $(RSC_PROJ) $(SOURCE)
!IF "$(CFG)" == "crash - Win32 Release" !IF "$(CFG)" == "crash - Win32 Release"
"CtrlLib - Win32 Release" : "CtrlLib - Win32 Release" :
cd "\SOURCE\CtrlLib" cd "\SOURCE\CtrlLib"
$(MAKE) /$(MAKEFLAGS) /F .\CtrlLib.mak CFG="CtrlLib - Win32 Release" $(MAKE) /$(MAKEFLAGS) /F .\CtrlLib.mak CFG="CtrlLib - Win32 Release"
cd "..\crash" cd "..\crash"
"CtrlLib - Win32 ReleaseCLEAN" : "CtrlLib - Win32 ReleaseCLEAN" :
cd "\SOURCE\CtrlLib" cd "\SOURCE\CtrlLib"
$(MAKE) /$(MAKEFLAGS) /F .\CtrlLib.mak CFG="CtrlLib - Win32 Release" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F .\CtrlLib.mak CFG="CtrlLib - Win32 Release" RECURSE=1 CLEAN
cd "..\crash" cd "..\crash"
!ELSEIF "$(CFG)" == "crash - Win32 Debug" !ELSEIF "$(CFG)" == "crash - Win32 Debug"
"CtrlLib - Win32 Debug" : "CtrlLib - Win32 Debug" :
cd "\SOURCE\CtrlLib" cd "\SOURCE\CtrlLib"
$(MAKE) /$(MAKEFLAGS) /F .\CtrlLib.mak CFG="CtrlLib - Win32 Debug" $(MAKE) /$(MAKEFLAGS) /F .\CtrlLib.mak CFG="CtrlLib - Win32 Debug"
cd "..\crash" cd "..\crash"
"CtrlLib - Win32 DebugCLEAN" : "CtrlLib - Win32 DebugCLEAN" :
cd "\SOURCE\CtrlLib" cd "\SOURCE\CtrlLib"
$(MAKE) /$(MAKEFLAGS) /F .\CtrlLib.mak CFG="CtrlLib - Win32 Debug" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F .\CtrlLib.mak CFG="CtrlLib - Win32 Debug" RECURSE=1 CLEAN
cd "..\crash" cd "..\crash"
!ENDIF !ENDIF
!IF "$(CFG)" == "crash - Win32 Release" !IF "$(CFG)" == "crash - Win32 Release"
"tgui - Win32 Release" : "tgui - Win32 Release" :
E: E:
cd "E:\V\TLIB" cd "E:\V\TLIB"
$(MAKE) /$(MAKEFLAGS) /F .\tgui.mak CFG="tgui - Win32 Release" $(MAKE) /$(MAKEFLAGS) /F .\tgui.mak CFG="tgui - Win32 Release"
F: F:
cd "F:\SOURCE\crash" cd "F:\SOURCE\crash"
"tgui - Win32 ReleaseCLEAN" : "tgui - Win32 ReleaseCLEAN" :
E: E:
cd "E:\V\TLIB" cd "E:\V\TLIB"
$(MAKE) /$(MAKEFLAGS) /F .\tgui.mak CFG="tgui - Win32 Release" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F .\tgui.mak CFG="tgui - Win32 Release" RECURSE=1 CLEAN
F: F:
cd "F:\SOURCE\crash" cd "F:\SOURCE\crash"
!ELSEIF "$(CFG)" == "crash - Win32 Debug" !ELSEIF "$(CFG)" == "crash - Win32 Debug"
"tgui - Win32 Debug" : "tgui - Win32 Debug" :
E: E:
cd "E:\V\TLIB" cd "E:\V\TLIB"
$(MAKE) /$(MAKEFLAGS) /F .\tgui.mak CFG="tgui - Win32 Debug" $(MAKE) /$(MAKEFLAGS) /F .\tgui.mak CFG="tgui - Win32 Debug"
F: F:
cd "F:\SOURCE\crash" cd "F:\SOURCE\crash"
"tgui - Win32 DebugCLEAN" : "tgui - Win32 DebugCLEAN" :
E: E:
cd "E:\V\TLIB" cd "E:\V\TLIB"
$(MAKE) /$(MAKEFLAGS) /F .\tgui.mak CFG="tgui - Win32 Debug" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F .\tgui.mak CFG="tgui - Win32 Debug" RECURSE=1 CLEAN
F: F:
cd "F:\SOURCE\crash" cd "F:\SOURCE\crash"
!ENDIF !ENDIF
!IF "$(CFG)" == "crash - Win32 Release" !IF "$(CFG)" == "crash - Win32 Release"
"tlib - Win32 Release" : "tlib - Win32 Release" :
E: E:
cd "E:\V\TLIB" cd "E:\V\TLIB"
$(MAKE) /$(MAKEFLAGS) /F .\tlib.mak CFG="tlib - Win32 Release" $(MAKE) /$(MAKEFLAGS) /F .\tlib.mak CFG="tlib - Win32 Release"
F: F:
cd "F:\SOURCE\crash" cd "F:\SOURCE\crash"
"tlib - Win32 ReleaseCLEAN" : "tlib - Win32 ReleaseCLEAN" :
E: E:
cd "E:\V\TLIB" cd "E:\V\TLIB"
$(MAKE) /$(MAKEFLAGS) /F .\tlib.mak CFG="tlib - Win32 Release" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F .\tlib.mak CFG="tlib - Win32 Release" RECURSE=1 CLEAN
F: F:
cd "F:\SOURCE\crash" cd "F:\SOURCE\crash"
!ELSEIF "$(CFG)" == "crash - Win32 Debug" !ELSEIF "$(CFG)" == "crash - Win32 Debug"
"tlib - Win32 Debug" : "tlib - Win32 Debug" :
E: E:
cd "E:\V\TLIB" cd "E:\V\TLIB"
$(MAKE) /$(MAKEFLAGS) /F .\tlib.mak CFG="tlib - Win32 Debug" $(MAKE) /$(MAKEFLAGS) /F .\tlib.mak CFG="tlib - Win32 Debug"
F: F:
cd "F:\SOURCE\crash" cd "F:\SOURCE\crash"
"tlib - Win32 DebugCLEAN" : "tlib - Win32 DebugCLEAN" :
E: E:
cd "E:\V\TLIB" cd "E:\V\TLIB"
$(MAKE) /$(MAKEFLAGS) /F .\tlib.mak CFG="tlib - Win32 Debug" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F .\tlib.mak CFG="tlib - Win32 Debug" RECURSE=1 CLEAN
F: F:
cd "F:\SOURCE\crash" cd "F:\SOURCE\crash"
!ENDIF !ENDIF
!IF "$(CFG)" == "crash - Win32 Release" !IF "$(CFG)" == "crash - Win32 Release"
"VLib - Win32 Release" : "VLib - Win32 Release" :
cd "\SOURCE\VLib" cd "\SOURCE\VLib"
$(MAKE) /$(MAKEFLAGS) /F .\VLib.mak CFG="VLib - Win32 Release" $(MAKE) /$(MAKEFLAGS) /F .\VLib.mak CFG="VLib - Win32 Release"
cd "..\crash" cd "..\crash"
"VLib - Win32 ReleaseCLEAN" : "VLib - Win32 ReleaseCLEAN" :
cd "\SOURCE\VLib" cd "\SOURCE\VLib"
$(MAKE) /$(MAKEFLAGS) /F .\VLib.mak CFG="VLib - Win32 Release" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F .\VLib.mak CFG="VLib - Win32 Release" RECURSE=1 CLEAN
cd "..\crash" cd "..\crash"
!ELSEIF "$(CFG)" == "crash - Win32 Debug" !ELSEIF "$(CFG)" == "crash - Win32 Debug"
"VLib - Win32 Debug" : "VLib - Win32 Debug" :
cd "\SOURCE\VLib" cd "\SOURCE\VLib"
$(MAKE) /$(MAKEFLAGS) /F .\VLib.mak CFG="VLib - Win32 Debug" $(MAKE) /$(MAKEFLAGS) /F .\VLib.mak CFG="VLib - Win32 Debug"
cd "..\crash" cd "..\crash"
"VLib - Win32 DebugCLEAN" : "VLib - Win32 DebugCLEAN" :
cd "\SOURCE\VLib" cd "\SOURCE\VLib"
$(MAKE) /$(MAKEFLAGS) /F .\VLib.mak CFG="VLib - Win32 Debug" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F .\VLib.mak CFG="VLib - Win32 Debug" RECURSE=1 CLEAN
cd "..\crash" cd "..\crash"
!ENDIF !ENDIF
!ENDIF !ENDIF

View file

@ -1 +1 @@
100 ICON DISCARDABLE "crash.ico" 100 ICON DISCARDABLE "crash.ico"

View file

@ -1 +1 @@
FN_C(DWORD, __stdcall, UnDecorateSymbolName, (PCSTR dn, PSTR udn, DWORD len, DWORD Flags)) FN_C(DWORD, __stdcall, UnDecorateSymbolName, (PCSTR dn, PSTR udn, DWORD len, DWORD Flags))

View file

@ -49,12 +49,12 @@ CONSOLE_APP_MAIN
{ {
std::vector<std::string> d = c; std::vector<std::string> d = c;
RTIMING("CoSort<string>"); RTIMING("CoSort<string>");
CoSort(d.begin(), d.end(), StdLess<std::string>()); CoSort(SubRange(d.begin(), d.end()), StdLess<std::string>());
} }
{ {
std::vector<std::string> d = c; std::vector<std::string> d = c;
RTIMING("Sort<string>"); RTIMING("Sort<string>");
Sort(d.begin(), d.end(), StdLess<std::string>()); Sort(SubRange(d.begin(), d.end()), StdLess<std::string>());
} }
} }
} }

View file

@ -0,0 +1,35 @@
#include <Core/Core.h>
using namespace Upp;
int EtalonCompare(const String& sa, const String& sb)
{
int q = memcmp(~sa, ~sb, min(sa.GetLength(), sb.GetLength()));
return q ? q : SgnCompare(sa.GetLength(), sb.GetLength());
}
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
int less = 0, equal = 0;
for(int pass = 0; pass < 4; pass++) {
LOG("======= Pass " << pass);
for(int q = 0; q < 10000000; q++) {
String x[2];
for(int ii = 0; ii < 2; ii++) {
int n = Random(pass & 1 ? 40 : 14);
for(int i = 0; i < n; i++)
x[ii].Cat(Random(pass & 2 ? Random(26) + 'A' : 2));
}
int r1 = EtalonCompare(x[0], x[1]);
int r2 = x[0].Compare(x[1]);
ASSERT(r1 == r2);
if(r1 < 0)
less++;
if(r1 == 0)
equal++;
}
LOG("Less: " << less << ", Equal: " << equal);
}
}

View file

@ -0,0 +1,9 @@
uses
Core;
file
StringCompare3.cpp;
mainconfig
"" = "";

View file

@ -3,7 +3,8 @@
using namespace Upp; using namespace Upp;
// http://isocpp.org/blog/2014/12/myths-3 6.1 // http://isocpp.org/blog/2014/12/myths-3
// section 6.1
CONSOLE_APP_MAIN CONSOLE_APP_MAIN
{ {