1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
qemu-user option -strace -D <file> doesn't work
I have been trying to access qemu -strace output from a script
The main problem was it was on stderr, the strace output was merged with my program's stderr output.
Then I tried to use the -D option, to log the output to a file.
This didn't work even if the log file was created, but it was empty.
I have looked at the source code and found the print function was not qemu_log with -strace but gemu_log (to be clear it was GEMU NOT QEMU)
I have then replaced all gemu_log by qemu_log removed declaration of gemu_log and recompiled, it seems to works just fine right now.
removed declaration here and here:
https://github.com/qemu/qemu/blob/master/linux-user/main.c#L108
https://github.com/qemu/qemu/blob/master/linux-user/qemu.h#L203
This is intentional, more or less. The -D logfile is for the debug logs enabled with -d, not for strace. I think if we wanted to support redirecting strace output to a file we might need to have an extra argument, to avoid breaking existing users.
If this is not for strace, then why when I launch qemu as subprocess (example: from a python script)
with option -strace -D <file> it creates a log file called <file>-strace? Seems like a bug to me.
Anyway, I understand you don't want to break the current behavior, is there any chance this gets added in the near future?
If you use -D <file> it will create a file named <file>, which will contain any logs created via the qemu_log subsystem (which might be nothing at all, depending on what the guest does). I don't know where the "-strace" part would come from unless you specified it as part of the filename.
I will check that again, pretty sure I saw that.
Anyway any chance there is an option/fix for that?
Today it is impossible to differentiate strace output with program's stderr output, and it is causing trouble while used in scripts.
I think this has been fixed here:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=4b25a50674de41e72f6b3003
|