aboutsummaryrefslogtreecommitdiff
path: root/bsd-user/main.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-20 12:47:15 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-04-20 12:47:15 -0700
commit27a985159a80430a0a43161797ca14ef946962b8 (patch)
tree54708343e87dc25dd9abf5230f43482ab5662ad5 /bsd-user/main.c
parent2d20a57453f6a206938cbbf77bed0b378c806c1f (diff)
parent4e51069d679348d2617512e56e28cdc7bb34c833 (diff)
Merge tag 'pull-log-20220420' of https://gitlab.com/rth7680/qemu into staging
Clean up log locking. Use the FILE* from qemu_log_trylock more often. Support per-thread log files with -d tid. # -----BEGIN PGP SIGNATURE----- # # iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmJgStUdHHJpY2hhcmQu # aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV+c9Af/ZXnKe6bz5yjXy1mS # mNIBJUPKrz1RXFfJxuCfEDWrtNc/gvQyvc3weZG5X0cXpiczeWA5V/9xbE9hu5gV # 4rePiIHWmOrais6GZlqEu2F8P3/XyqdPHtcdBfa1hDneixtpqMHCqnh36nQjHyiU # ogFxEJ/M9tTwhuWZrXe/JSYAiALEDYMK9bk4RUMOP1c4v37rXqUNOAM1IPhfxLL/ # bK9DQMpz5oUNsWWaqBQ2wQWHkNTOpUEkKGQv0xcQF5SdpYwaxakW9B7/h4QSeOUn # oY6MFTmkJ4BPrLnkcubn+3PICc9LW0OFuzNnUdMCbeqVbjAUQrdMDalKpy4uNFv9 # U1VqHg== # =Mt5s # -----END PGP SIGNATURE----- # gpg: Signature made Wed 20 Apr 2022 11:03:01 AM PDT # gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F # gpg: issuer "richard.henderson@linaro.org" # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate] * tag 'pull-log-20220420' of https://gitlab.com/rth7680/qemu: (39 commits) util/log: Support per-thread log files util/log: Limit RCUCloseFILE to file closing util/log: Rename QemuLogFile to RCUCloseFILE util/log: Combine two logfile closes util/log: Hoist the eval of is_daemonized in qemu_set_log_internal util/log: Rename qemu_logfile_mutex to global_mutex util/log: Rename qemu_logfile to global_file util/log: Rename logfilename to global_filename util/log: Remove qemu_log_close softmmu: Use qemu_set_log_filename_flags linux-user: Use qemu_set_log_filename_flags bsd-user: Use qemu_set_log_filename_flags util/log: Introduce qemu_set_log_filename_flags sysemu/os-win32: Test for and use _lock_file/_unlock_file include/qemu/log: Move entire implementation out-of-line include/exec/log: Do not reference QemuLogFile directly tests/unit: Do not reference QemuLogFile directly linux-user: Expand log_page_dump inline bsd-user: Expand log_page_dump inline util/log: Drop call to setvbuf ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'bsd-user/main.c')
-rw-r--r--bsd-user/main.c56
1 files changed, 32 insertions, 24 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 88d347d05e..aa13eae7f3 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -405,17 +405,16 @@ int main(int argc, char **argv)
}
/* init debug */
- qemu_log_needs_buffers();
- qemu_set_log_filename(log_file, &error_fatal);
- if (log_mask) {
- int mask;
-
- mask = qemu_str_to_log_mask(log_mask);
- if (!mask) {
- qemu_print_log_usage(stdout);
- exit(1);
+ {
+ int mask = 0;
+ if (log_mask) {
+ mask = qemu_str_to_log_mask(log_mask);
+ if (!mask) {
+ qemu_print_log_usage(stdout);
+ exit(1);
+ }
}
- qemu_set_log(mask);
+ qemu_set_log_filename_flags(log_file, mask, &error_fatal);
}
if (optind >= argc) {
@@ -504,20 +503,29 @@ int main(int argc, char **argv)
g_free(target_environ);
if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
- qemu_log("guest_base %p\n", (void *)guest_base);
- log_page_dump("binary load");
-
- qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
- qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code);
- qemu_log("start_code 0x" TARGET_ABI_FMT_lx "\n",
- info->start_code);
- qemu_log("start_data 0x" TARGET_ABI_FMT_lx "\n",
- info->start_data);
- qemu_log("end_data 0x" TARGET_ABI_FMT_lx "\n", info->end_data);
- qemu_log("start_stack 0x" TARGET_ABI_FMT_lx "\n",
- info->start_stack);
- qemu_log("brk 0x" TARGET_ABI_FMT_lx "\n", info->brk);
- qemu_log("entry 0x" TARGET_ABI_FMT_lx "\n", info->entry);
+ FILE *f = qemu_log_trylock();
+ if (f) {
+ fprintf(f, "guest_base %p\n", (void *)guest_base);
+ fprintf(f, "page layout changed following binary load\n");
+ page_dump(f);
+
+ fprintf(f, "start_brk 0x" TARGET_ABI_FMT_lx "\n",
+ info->start_brk);
+ fprintf(f, "end_code 0x" TARGET_ABI_FMT_lx "\n",
+ info->end_code);
+ fprintf(f, "start_code 0x" TARGET_ABI_FMT_lx "\n",
+ info->start_code);
+ fprintf(f, "start_data 0x" TARGET_ABI_FMT_lx "\n",
+ info->start_data);
+ fprintf(f, "end_data 0x" TARGET_ABI_FMT_lx "\n",
+ info->end_data);
+ fprintf(f, "start_stack 0x" TARGET_ABI_FMT_lx "\n",
+ info->start_stack);
+ fprintf(f, "brk 0x" TARGET_ABI_FMT_lx "\n", info->brk);
+ fprintf(f, "entry 0x" TARGET_ABI_FMT_lx "\n", info->entry);
+
+ qemu_log_unlock(f);
+ }
}
/* build Task State */