ErrorHandler query
-
- Enthusiast
- Posts: 443
- Joined: Sun Apr 06, 2008 12:54 pm
- Location: Brisbane, Qld, Australia
- Contact:
ErrorHandler query
In my program I use OnErrorCall(@generalErrorHandler()) where generalErrorHandler() logs as much info as I find useful to track down the cause of the error. However, in log files recently sent me by a user, a memory error was detected in a short procedure that's called from many different parts of the program. What I would really like to know is where this procedure was called from, ie the calling procedure. Is there some way I can modify my generalErrorHandler procedure get that info for future instances? The program only runs under Windows, so if there's a Windows function that helps then that would be OK.
Re: ErrorHandler query
On ASM backend, you have the RSP register (x64 hardware), or ESP register (x86 hardware) which indicates the memory address of a call. This is hardly automatical.
Softly, you have the runtime system which gives you more inforlations.
More softly, you should insert you own process stack, on each procedure. This is a list, updated on every procedure executions, and available to the error handler.
Softly, you have the runtime system which gives you more inforlations.
More softly, you should insert you own process stack, on each procedure. This is a list, updated on every procedure executions, and available to the error handler.
Re: ErrorHandler query
Depending on how many functions your program has, you can offer some kind of extended log mode, which logs all calls plus the error message into a file. See #PB_Compiler_Procedure, create macro which automatically logs the current function.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD