util/log: Support per-thread log files

Add a new log flag, tid, to turn this feature on.
Require the log filename to be set, and to contain %d.

Do not allow tid to be turned off once it is on, nor let
the filename be change thereafter.  This avoids the need
for signalling each thread to re-open on a name change.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220417183019.755276-40-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-04-17 11:30:19 -07:00
parent 30f5a73ac3
commit 4e51069d67
2 changed files with 128 additions and 36 deletions

View file

@ -34,6 +34,7 @@ bool qemu_log_separate(void);
#define CPU_LOG_PLUGIN (1 << 18)
/* LOG_STRACE is used for user-mode strace logging. */
#define LOG_STRACE (1 << 19)
#define LOG_PER_THREAD (1 << 20)
/* Lock/unlock output. */