Skip to content

Commit c6e2244

Browse files
committed
Fix for public usage
1 parent efdd721 commit c6e2244

File tree

6 files changed

+31
-8
lines changed

6 files changed

+31
-8
lines changed

CrashLogger/dllmain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
4545
}
4646
if (!InitDaemonProcess())
4747
return FALSE;
48-
printf("[CrashLogger] CrashLogger loaded.\n");
48+
// printf("[CrashLogger] CrashLogger loaded.\n");
4949
break;
5050
case DLL_THREAD_ATTACH:
5151
break;

CrashLogger_Daemon/Debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bool LoadSymbolFiles()
4141
{
4242
wstring symbolPath{ L"srv*C:\\Windows\\symbols*http://msdl.microsoft.com/download/symbols" };
4343
FindSymbols(symbolPath,".",false);
44-
FindSymbols(symbolPath,".\\plugins", true);
44+
FindSymbols(symbolPath,".\\pdb", true);
4545

4646
if (!SymInitializeW(hProcess_Debug, symbolPath.c_str(), TRUE))
4747
{

CrashLogger_Daemon/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int main(int argc,char **argv)
2525
return -1;
2626
}
2727

28-
//printf("[CrashLogger] CrashLogger Daemon Process attached.\n");
28+
// printf("[CrashLogger] CrashLogger Daemon Process attached.\n");
2929
DebuggerMain(hProcess);
3030
return 0;
3131
}

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
# CrashLogger
2-
> A dll injected into process to dump stack when crashing.
2+
> Provide crash listener for any process, and dump stack when the process is crashed.
33
4-
Support me at [https://www.minebbs.com/resources/crashlogger-pro.2645/](https://www.minebbs.com/resources/crashlogger-pro.2645/)
4+
## Usage
55

6+
### Use as a single daemon process
67

7-
### At Crash
8+
1. Start the program you want to listen to, and get its ProcessID
9+
2. Execute in terminal: `CrashLogger_Daemon.exe <ProcessID>`
10+
3. **Finished.** When the target process crashed, the daemon will dump its stack and output stacktrace to console.
11+
12+
### Work along with your program
13+
14+
1. Use `LoadLibrary` to load `CrashLogger.dll`.
15+
2. `CrashLogger.dll` will start `CrashLogger_Daemon.exe` in background and start daemon.
16+
3. **Finished.** When your process crashed, the daemon will dump its stack and output stacktrace to console.
17+
18+
19+
## At Crash
820
- Result of stack walk will output both at console and file `.\logs\Crash\TrackBack_xxxxxxxx_xx-xx-xx.log`
921
- Dumpbin database will generate at file `.\logs\Crash\CrashDump_xxxxxxxx_xx-xx-xx.dmp`
1022

1123
![image-20210716124312591](asserts/image-20210716124312591.png)
24+
25+
![](asserts/files.png)
26+
1227
- Stack walk can give you a general view of possible problems.
1328

14-
Using CrashDump, Dump files and WinDbg or Visual Studio, you can get more infomation about the crash.
29+
Using CrashDump, Dump files and WinDbg or Visual Studio, you can get more infomation about the crash.
30+
31+
## PDB Files
32+
33+
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.
34+
35+
## Tips
36+
37+
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.

asserts/files.png

18.1 KB
Loading

include/LoggerShareData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#define MACHINE_TYPE IMAGE_FILE_MACHINE_AMD64
4-
#define DAEMON_PROCESS_PATH L"plugins\\CrashLogger\\CrashLogger_Daemon.exe"
4+
#define DAEMON_PROCESS_PATH L".\\CrashLogger_Daemon.exe"
55
#define TRACKBACK_OUTPUT_PATH "logs\\Crash\\TrackBack_"
66
#define DUMP_OUTPUT_PATH "logs\\Crash\\CrashDump_"
77

0 commit comments

Comments
 (0)