diff options
author | Lukas Larsson <[email protected]> | 2014-12-04 11:09:06 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2014-12-19 10:39:52 +0100 |
commit | ffd0153e6dffcc29cf79d0191860047dba0438bb (patch) | |
tree | 31a0ced512b5b243caa5933c73aa4dc70d6c0c87 /erts/emulator/sys/win32 | |
parent | e2a600341324d2ce3689119f8fd61b248702d79f (diff) | |
download | otp-ffd0153e6dffcc29cf79d0191860047dba0438bb.tar.gz otp-ffd0153e6dffcc29cf79d0191860047dba0438bb.tar.bz2 otp-ffd0153e6dffcc29cf79d0191860047dba0438bb.zip |
erts: Improve crash dumps
This commit improves crash dumps in several ways:
* Suspends schedulers to get a current snapshot
* Dumps information about scheduler
* Dumps stack trace of current running process
(including Garbing processes)
Diffstat (limited to 'erts/emulator/sys/win32')
-rw-r--r-- | erts/emulator/sys/win32/erl_win_sys.h | 12 | ||||
-rw-r--r-- | erts/emulator/sys/win32/sys.c | 21 |
2 files changed, 33 insertions, 0 deletions
diff --git a/erts/emulator/sys/win32/erl_win_sys.h b/erts/emulator/sys/win32/erl_win_sys.h index 838f0c61eb..fde32c8684 100644 --- a/erts/emulator/sys/win32/erl_win_sys.h +++ b/erts/emulator/sys/win32/erl_win_sys.h @@ -236,4 +236,16 @@ typedef long ssize_t; int init_async(int); int exit_async(void); #endif + +#define ERTS_HAVE_TRY_CATCH 1 + +#define ERTS_SYS_TRY_CATCH(EXPR,CATCH) \ + __try { \ + EXPR; \ + } \ + __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) \ + { \ + CATCH; \ + } + #endif diff --git a/erts/emulator/sys/win32/sys.c b/erts/emulator/sys/win32/sys.c index 164ef95629..5d51659b4e 100644 --- a/erts/emulator/sys/win32/sys.c +++ b/erts/emulator/sys/win32/sys.c @@ -247,6 +247,27 @@ void erl_sys_args(int* argc, char** argv) #endif } +/* + * Function returns 1 if we can read from all values in between + * start and stop. + */ +int +erts_sys_is_area_readable(char *start, char *stop) { + volatile char tmp; + __try + { + while(start < stop) { + tmp = *start; + start++; + } + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + return 0; + } + return 1; +} + int erts_sys_prepare_crash_dump(int secs) { Port *heart_port; |