qemu-user option -strace -D <file> doesn't work

Bug #1748612 reported by mou
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

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

Revision history for this message
Peter Maydell (pmaydell) wrote :

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.

Revision history for this message
mou (arnaudalies-py) wrote :

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?

Revision history for this message
Peter Maydell (pmaydell) wrote :

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.

Revision history for this message
mou (arnaudalies-py) wrote :

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.

Revision history for this message
Thomas Huth (th-huth) wrote :
Changed in qemu:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.