Commit Graph

38 Commits

Author SHA1 Message Date
AnyOldName3 1bdcb5d6d9 Share the dump directory for crash and freeze dumps
This means the shared memory struct is just 255 bytes longer than a few
commits ago instead of 32K.

Also introduce a function for putting path strings in the shared memory
as there was too much copied and pasted code and it was error-prone.

Also free some handles once we're done with them so they don't leak.
2023-07-11 22:22:26 +01:00
AnyOldName3 48368f79b6 Update Windows crash dump path once we know where we're logging
Manual rewrite of 5102f4b11d
2023-07-05 20:38:46 +01:00
AnyOldName3 72d99237e3 This would never have happened had clang format not tried making this function wrogn in the first place 2023-07-05 20:34:34 +01:00
AnyOldName3 1bcbc4f53f Undo clang format change because clang format in CI disagrees with clang format on my computer 2023-07-05 20:29:18 +01:00
AnyOldName3 3bb3f58c73 Don't put crash dumps in Temp on Windows
Well... unless we fail to get the user profile directory.

Also put freeze dumps in a more appropriately-named file.

Discussed in https://gitlab.com/OpenMW/openmw/-/issues/7455

Manual rewrite of c21695c951

As well as that, I found a bug where the crash dump path was being converted from a std::filesystem::path to a utf8-encoded std::string, then passed to the crash catcher, which converted it to a std::filesystem::path implicitly, but using the system eight-bit code page, which wouldn't usually be UTF-8. That's now fixed by passing the function that expects a path a path instead of a string.
2023-07-05 20:25:22 +01:00
Shi Han a90e3b8c3b Move from std::atoi to std::from_char 2023-03-18 09:30:48 +00:00
elsid c44bc5ade5
Setup logging with properly initialized configuration manager
Default constructed instance may provide different paths from initialized one.
2023-01-30 09:30:55 +01:00
elsid 007ad4e4d1
Write crash log to temporary directory
To make sure current user has rights to do so.
2023-01-30 09:30:55 +01:00
clang-format-bot 88ec8a9523
Apply clang-format 2022-09-25 18:23:43 +02:00
Project579 5cf2a958eb Make conversions between std::chrono time_point and string safer by not using "localtime" directly. 2022-09-24 21:47:27 +02:00
clang-format-bot ddb0522bbf
Apply clang-format to code base 2022-09-22 21:35:26 +03:00
Project579 a13709c510 Replace implicit convertions from std::filesystem::path to std::string with correctly converting functions. 2022-09-11 14:41:20 +02:00
Project579 e5c417c968 Make sure all paths are passed as std::filesystem::path instead of std::string where possible. 2022-09-11 14:41:15 +02:00
Project579 4bb07282c9 Replace all remaining occurrences of boost::filesystem with std::filesystem. 2022-09-11 02:19:00 +02:00
elsid d2ed62ec3a
Allow to disable crash catcher on Windows 2022-07-01 22:44:03 +02:00
ζeh Matt 14bf9af056
Move implementation details of debugging.hpp to cpp, reduce includes 2022-06-07 01:22:43 +03:00
jvoisin 4e4debb1cb Remove even more of boost::filesystem 2022-05-25 18:29:02 +00:00
Petr Mikheev cf49b46d64 Show logs in the debug window
Some part of UI code is written by @andrew-app
2022-05-16 20:50:44 +02:00
elsid 0dcb1f5aac
Fix build on Windows
Use wrapper header over Windows.h to undefine far and near in a single place.
2022-04-25 00:25:46 +02:00
elsid e777e35414
Use system_clock for time in logs
high_resolution_clock may not give real time. MSVC implements it as
steady_clock that is basically CPU time which is usually desynchronized with
real time.
2022-04-21 23:03:40 +02:00
elsid 2d5ccc804b
Exchange binary messages between navmeshtool and launcher 2022-03-30 19:24:54 +02:00
Petr Mikheev dd5ba5c57b Redirect log only after parsing configuration 2022-02-02 23:47:11 +01:00
fredzio 4058e117ca Don't clobber game log file when we collect a stack trace.
When the crash catcher catch a signal it forks to collect data about its
parent. In the process the child reinitialize the log file, which ends
up empty.
2021-04-17 13:14:01 +02:00
CedricMocquillon 112437cf28 Change crash file to dmp on window to avoid renaming it 2020-12-13 14:13:07 +01:00
CedricMocquillon 73afc55462 Fork the current process to monitor exe, generate minidump on crash 2020-12-12 20:17:26 +01:00
Petr Mikheev 49c6e50c31 Print '--version' and '--help' messages without timestamps 2020-12-08 23:14:49 +01:00
Petr Mikheev 5734551ff3 Add time to logs. Redirect OSG log to OpenMW log. 2020-12-05 13:46:02 +01:00
AnyOldName3 89d73c5fc7 Only reroute stdout etc. to new console if not already redirected
This should fix the issue where Windows Release builds (compiled as
/SUBSYSTEM:WINDOWS instead of /SUBSYSTEM:CONSOLE) can't have their
output redirected.

Basically, a console application creates a console if not given one, so
you get a console window behind OpenMW while it's running. It was
decided that this was ugly, so we set Release builds to be windows
applications, which don't get an automatic console and don't
automatically connect to a console if given one anyway.

Of course, we still wanted to actually be able to print to a console if
given one, so we manually attach to the parent process' console if it
exists, then reopen the standard streams connected to CON, the Windows
pseudo-file representing the current console.

This is a little like connecting a second wire into a dumb terminal in
that you're pumping characters into the display rather than onto a
pipeline, so output can't be redirected.

It turns out, though, that if a /SUBSYSTEM:WINDOWS application has its
standard streams redirected by the calling process, it still gets its
handles as normal, so everything starts off connected just how we want
it and we were clobbering this good setup with the straight-to-console
fix.

All we need to do to fix that is check if we've got valid standard
handles and that they go somewhere useful, and if so, avoid reopening
them once the console is attached. Simples.
2020-11-14 02:04:46 +00:00
elsid 29f262e514
Fix crash on destructed stream usage 2019-09-28 11:30:38 +02:00
Andrei Kortunov 14b756a692 Use a generic logging system for RecastNavigation 2019-04-08 20:31:21 +04:00
Stanislaw Halik c5c160870d fix accidental header namespace inclusion 2018-12-12 00:48:27 +01:00
Stanislaw Halik f6c8842457 move to debugging.[ch]pp 2018-12-12 00:41:53 +01:00
Stanislaw Halik 74955555b9 remove verbose comments and example 2018-12-12 00:02:09 +01:00
Stanislaw Halik 64e960aa22 enable win32 debug console when launching from console 2018-12-08 01:29:14 +01:00
Andrei Kortunov e06f0b797a Replace all NULLs to nullptr 2018-10-09 10:21:12 +04:00
Andrei Kortunov 9a5b016293 Move crashcatcher initialization to components 2018-08-14 11:17:05 +04:00
Andrei Kortunov 5e172ed831 Move cerr initialization out of 'try' block 2018-08-14 10:30:27 +04:00
Andrei Kortunov 7d6e3673e0 Implement advanced logging system (feature #4581) 2018-08-12 13:38:15 +04:00