Commit 6d946cdae0b5ba6b45499a124263b57ca5bffe68

Authored by aurel32
1 parent afec1122

User qemu profiling

- Makefile.target:  re-enable profiling for user qemu.  It seems
  profiling was (accidently?) removed by commit 3937

- syscall.c:
    * add an include to get _mcleanup prototype
    * add a call to _mcleanup for exit_group in a way
      similar to what is done for exit

(Laurent Desnogues)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5642 c046a42c-6fe2-441c-8c8c-71466251a162
Makefile.target
@@ -397,6 +397,12 @@ LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld @@ -397,6 +397,12 @@ LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
397 endif 397 endif
398 endif 398 endif
399 399
  400 +# profiling code
  401 +ifdef TARGET_GPROF
  402 +LDFLAGS+=-p
  403 +CFLAGS+=-p
  404 +endif
  405 +
400 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ 406 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
401 elfload.o linuxload.o uaccess.o 407 elfload.o linuxload.o uaccess.o
402 LIBS+= $(AIOLIBS) 408 LIBS+= $(AIOLIBS)
linux-user/syscall.c
@@ -54,6 +54,9 @@ @@ -54,6 +54,9 @@
54 #include <netinet/ip.h> 54 #include <netinet/ip.h>
55 #include <netinet/tcp.h> 55 #include <netinet/tcp.h>
56 #include <qemu-common.h> 56 #include <qemu-common.h>
  57 +#ifdef HAVE_GPROF
  58 +#include <sys/gmon.h>
  59 +#endif
57 60
58 #define termios host_termios 61 #define termios host_termios
59 #define winsize host_winsize 62 #define winsize host_winsize
@@ -4864,6 +4867,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, @@ -4864,6 +4867,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
4864 #ifdef __NR_exit_group 4867 #ifdef __NR_exit_group
4865 /* new thread calls */ 4868 /* new thread calls */
4866 case TARGET_NR_exit_group: 4869 case TARGET_NR_exit_group:
  4870 +#ifdef HAVE_GPROF
  4871 + _mcleanup();
  4872 +#endif
4867 gdb_exit(cpu_env, arg1); 4873 gdb_exit(cpu_env, arg1);
4868 ret = get_errno(exit_group(arg1)); 4874 ret = get_errno(exit_group(arg1));
4869 break; 4875 break;