summaryrefslogtreecommitdiff
path: root/linux-user/strace.c
AgeCommit message (Collapse)Author
2016-09-21linux-user: report signals being taken in strace outputPeter Maydell
Native strace reports when the process being traced takes a signal: --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} --- Report something similar when QEMU is doing its internal strace of the guest process and is about to deliver it a signal. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-26linux-user: fix clone() straceLaurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: add socket() straceLaurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: add socketcall() straceLaurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: Support F_GETPIPE_SZ and F_SETPIPE_SZ fcntlsPeter Maydell
Support the F_GETPIPE_SZ and F_SETPIPE_SZ fcntl operations. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-16os-posix: include sys/mman.hPaolo Bonzini
qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous inclusion of sys/mman.h. Include it in sysemu/os-posix.h and remove it from everywhere else. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-06-08linux-user: Make target_strerror() return 'const char *'Peter Maydell
Make target_strerror() return 'const char *' rather than just 'char *'; this will allow us to return constant strings from it for some special cases. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
2016-01-29linux-user: Clean up includesPeter Maydell
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1453832250-766-10-git-send-email-peter.maydell@linaro.org
2013-04-05linux-user: Don't omit comma for strace of rt_sigaction()Peter Maydell
Pass the 'last' parameter of print_signal() through to print_raw_param(); this fixes a problem where we weren't printing the comma separator for strace of rt_sigaction() when the signal was an unnamed (ie realtime) one: 6856 rt_sigaction(230xf6fff870,0xf6fff8fc) = 0 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-11linux-user: fix futex strace of FUTEX_CLOCK_REALTIMEJohn Rigby
Handle same as existing FUTEX_PRIVATE_FLAG. Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2013-03-11linux-user: improve print_fcntl()Laurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2013-01-30linux-user: correct print_timeval() swap tv_sec and tv_usecLaurent Vivier
Signed-off-by: Laurent Vivier <Laurent@Vivier.EU> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2012-08-04linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATHRichard Henderson
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
2012-02-02linux-user/strace.c: Correct errno printing for mmap etcPeter Maydell
Correct the printing of errnos for syscalls which are handled via print_syscall_ret_addr (mmap, mmap2, brk, shmat): errnos are returned as negative returned values at this level, not via the host 'errno' variable. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: fix QEMU_STRACE=1 segfaultAlexander Graf
While debugging some issues with QEMU_STRACE I stumbled over segmentation faults that were pretty reproducible. Turns out we tried to treat a normal return value as errno, resulting in an access over array boundaries for the resolution. Fix this by allowing failure to resolve invalid errnos into strings. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2011-10-27linux-user: fix abi_(u)long, target_ulong mismatchMatthias Braun
abi_(u)long might be different from target_ulong, so don't use tswapl but introduce a new tswapal Signed-off-by: Matthias Braun <matze@braunis.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-05-02linux-user: Fix compilation for "old" linux versionsStefan Weil
Debian Lenny and other installations with older linux versions failed to compile linux-user because some CLONE_xxx macros are undefined. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-04-26linux-user: improve tracesLaurent Vivier
Add trace details for getpid(), kill(), _llseek(), rt_sigaction(), rt_sigprocmask(), clone(). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-02-17linux-user: in linux-user/strace.c, tswap() is uselessLaurent Vivier
Syscall parameters are already swapped by the caller. This patch removes useless tswap() from strace.c $ QEMU_STRACE=1 chroot /m68k mknod myramdisk b 1 1 with tswap() ... 29944 mknod("myramdisk",026630200000) = 0 ... without tswap() ... 30042 mknod("myramdisk",S_IFBLK|0666,makedev(1,1)) = 0 ... natively: $ strace touch mytouch ... open("mytouch", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3 ... $ QEMU_STRACE=1 chroot /m68k touch mytouch with tswap() ... 30368 open("/usr/share/locale/locale.alias",O_RDONLY) = 3 30368 fstat64(50331648,0x4080032c) = 0 ... 30368 open("mytouch",O_RDONLY|O_CREAT|O_LARGEFILE|O_NOCTTY|O_NONBLOCK|0x1) = 0 ... without tswap() ... 30572 open("/usr/share/locale/locale.alias",O_RDONLY) = 3 30572 fstat64(3,0x4080032c) = 0 ... 30572 open("mytouch",O_WRONLY|O_CREAT|O_LARGEFILE|O_NOCTTY|O_NONBLOCK,0666) = 0 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Fixes by Riku Voipio: add casts Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2011-02-17linux-user: add rmdir() straceLaurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2011-02-09linux-user: fix build errors for mmap2-only portsMike Frysinger
The current print_mmap func is only enabled when the target supports the mmap syscall, but both mmap and mmap2 syscalls use it. This leads to a build failure when the target supports mmap2 but not mmap. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2011-02-09linux-user: decode MAP_{UNINITIALIZED,EXECUTABLE} in straceMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-06-16Strace mprotect flags.Paul Brook
Teach strace code about linux specific mprotect flags. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-02-19Fix strace or FUTEX_PRIVATE_FLAGPaul Brook
FUTEX_PRIVATE_FLAG is a bit orred with an existing futex op, not a distinct value. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-19linux-user: strace now handles guest stringscorrectly [v2]Riku Voipio
On Tue, Jun 16, 2009 at 08:19:23PM -0500, Anthony Liguori wrote: > malc wrote: >> >> On my system the above line causes gcc to emit: >> >> In file included from /home/malc/x/rcs/git/qemu/linux-user/strace.c:12: >> /usr/include/linux/futex.h:48: error: field `__user' has incomplete type >> /usr/include/linux/futex.h:48: error: syntax error before '*' token >> /usr/include/linux/futex.h:63: error: field `list' has incomplete type >> /usr/include/linux/futex.h:83: error: field `__user' has incomplete type >> /usr/include/linux/futex.h:83: error: syntax error before '*' token >> make[1]: *** [strace.o] Error 1 > We had the same problem with usb-linux.c. It's broken system headers, > the __user stuff is supposed to get removed as part of the headers > installation. > It builds fine on my system (Fedora 10). Howabout something like this: commit eb8387cb0eda32a18880664eb5f0ca5c8bf05b45 Author: Riku Voipio <riku.voipio@iki.fi> Date: Thu Jun 18 22:44:31 2009 +0300 Subject: linux-user: include futex defines directly Since some common distributions have broken linux/futex.h, stop including it. Instead add the defines directly. Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: strace now handles guest strings correctly [v2]Mika Westerberg
- to not to break strace with GUEST_BASE is set: - Strace now can load and print guest strings correctly. - Added printing support for commonly used flags in some syscalls (e.g open, creat, mmap etc.) v2: - fix strace.c build on etch - add futex print to strace Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2008-12-22Use the ARRAY_SIZE() macro where appropriate.malc
Change from v1: Avoid changing the existing coding style in certain files. Signed-off-by: Stuart Brady <stuart.brady@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6120 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-13Remove unnecessary trailing newlinesblueswir1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6000 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-03Fix warning about unused functionblueswir1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5406 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-30Silence some warnings about uninitialized variablesblueswir1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5362 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-14Fix warnings that would be caused by gcc flag -Wwrite-stringsblueswir1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5206 c046a42c-6fe2-441c-8c8c-71466251a162
2008-05-29Strace fallback for unknown syscalls.pbrook
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4614 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-14printf format fixbellard
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3645 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-11hex numbers must have a leading 0xbellard
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3603 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-11use correct typesbellard
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3596 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-11Linux user memory access API change (initial patch by Thayne Harbaugh)bellard
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3583 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-03Fix some compiler warnings.ths
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3520 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-01Add new files fir strace support, missed in earlier commit.ths
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3504 c046a42c-6fe2-441c-8c8c-71466251a162