Skip to content

Commit

Permalink
Fix for public usage
Browse files Browse the repository at this point in the history
  • Loading branch information
yqs112358 committed Apr 1, 2023
1 parent efdd721 commit c6e2244
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CrashLogger/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion CrashLogger_Daemon/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion CrashLogger_Daemon/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <ProcessID>`
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.
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.
Binary file added asserts/files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion include/LoggerShareData.h
Original file line number Diff line number Diff line change
@@ -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_"

Expand Down

0 comments on commit c6e2244

Please sign in to comment.