diff --git a/CrashLogger/dllmain.cpp b/CrashLogger/dllmain.cpp index a5d53de..62c97c6 100644 --- a/CrashLogger/dllmain.cpp +++ b/CrashLogger/dllmain.cpp @@ -45,7 +45,7 @@ BOOL APIENTRY DllMain( HMODULE hModule, } if (!InitDaemonProcess()) return FALSE; - printf("[CrashLogger] CrashLogger loaded.\n"); + // printf("[CrashLogger] CrashLogger loaded.\n"); break; case DLL_THREAD_ATTACH: break; diff --git a/CrashLogger_Daemon/Debugger.cpp b/CrashLogger_Daemon/Debugger.cpp index e4c8dc1..00f3ab6 100644 --- a/CrashLogger_Daemon/Debugger.cpp +++ b/CrashLogger_Daemon/Debugger.cpp @@ -41,7 +41,7 @@ bool LoadSymbolFiles() { wstring symbolPath{ L"srv*C:\\Windows\\symbols*http://msdl.microsoft.com/download/symbols" }; FindSymbols(symbolPath,".",false); - FindSymbols(symbolPath,".\\plugins", true); + FindSymbols(symbolPath,".\\pdb", true); if (!SymInitializeW(hProcess_Debug, symbolPath.c_str(), TRUE)) { diff --git a/CrashLogger_Daemon/main.cpp b/CrashLogger_Daemon/main.cpp index e53459d..b2cac08 100644 --- a/CrashLogger_Daemon/main.cpp +++ b/CrashLogger_Daemon/main.cpp @@ -25,7 +25,7 @@ int main(int argc,char **argv) return -1; } - //printf("[CrashLogger] CrashLogger Daemon Process attached.\n"); + // printf("[CrashLogger] CrashLogger Daemon Process attached.\n"); DebuggerMain(hProcess); return 0; } \ No newline at end of file diff --git a/README.md b/README.md index b652698..cb814b5 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,37 @@ # CrashLogger -> A dll injected into process to dump stack when crashing. +> Provide crash listener for any process, and dump stack when the process is crashed. -Support me at [https://www.minebbs.com/resources/crashlogger-pro.2645/](https://www.minebbs.com/resources/crashlogger-pro.2645/) +## Usage +### Use as a single daemon process -### At Crash +1. Start the program you want to listen to, and get its ProcessID +2. Execute in terminal: `CrashLogger_Daemon.exe ` +3. **Finished.** When the target process crashed, the daemon will dump its stack and output stacktrace to console. + +### Work along with your program + +1. Use `LoadLibrary` to load `CrashLogger.dll`. +2. `CrashLogger.dll` will start `CrashLogger_Daemon.exe` in background and start daemon. +3. **Finished.** When your process crashed, the daemon will dump its stack and output stacktrace to console. + + +## At Crash - Result of stack walk will output both at console and file `.\logs\Crash\TrackBack_xxxxxxxx_xx-xx-xx.log` - Dumpbin database will generate at file `.\logs\Crash\CrashDump_xxxxxxxx_xx-xx-xx.dmp` ![image-20210716124312591](asserts/image-20210716124312591.png) + +![](asserts/files.png) + - Stack walk can give you a general view of possible problems. -Using CrashDump, Dump files and WinDbg or Visual Studio, you can get more infomation about the crash. \ No newline at end of file +Using CrashDump, Dump files and WinDbg or Visual Studio, you can get more infomation about the crash. + +## PDB Files + +CrashLogger will find PDB files in target process's directory, which contains significant symbol information for stacktrace. So you can put PDBs of your program or the libraries you used into `.\PDB` directory. It will helps a lot. + +## Tips + +CrashLogger attach to the target program as a debugger to catch unhandled exception and crash. So if another debugger is attached before (like Visual Studio Debugger), CrashLogger will not work. \ No newline at end of file diff --git a/asserts/files.png b/asserts/files.png new file mode 100644 index 0000000..c7a2841 Binary files /dev/null and b/asserts/files.png differ diff --git a/include/LoggerShareData.h b/include/LoggerShareData.h index 3be31d1..72bb622 100644 --- a/include/LoggerShareData.h +++ b/include/LoggerShareData.h @@ -1,7 +1,7 @@ #pragma once #define MACHINE_TYPE IMAGE_FILE_MACHINE_AMD64 -#define DAEMON_PROCESS_PATH L"plugins\\CrashLogger\\CrashLogger_Daemon.exe" +#define DAEMON_PROCESS_PATH L".\\CrashLogger_Daemon.exe" #define TRACKBACK_OUTPUT_PATH "logs\\Crash\\TrackBack_" #define DUMP_OUTPUT_PATH "logs\\Crash\\CrashDump_"