[PATCH] strace: ARM syscall updates

Anderson Lizardo anderson.lizardo at gmail.com
Fri Jan 25 12:35:47 UTC 2008


strace has syscalls list outdated for ARM platform:
* it cannot trace socket calls (with "-e trace=network")
* architecture specific syscalls are shown incorrectly (as "syscall_nnnn")

This patch updates the syscalls list for ARM and adds support for ARM specific
syscalls in strace.

Changelog:

2008-01-25  Bruna Moreira <bruna.moreira at indt.org>
	* defs.h [ARM]: Define SUPPORTED_PERSONALITIES to 2.
	* syscall.c (get_scno) [ARM]: Add support for architecture specific
	syscalls.
	* linux/arm/syscallent.h: Update network syscalls list.
	* linux/arm/syscallent1.h: New file. Add new architecture specific
	syscalls.
	* linux/arm/errnoent1.h: New file.
	* linux/arm/ioctlent1.h: New file.
	* linux/arm/signalent1.h: New file.

Signed-off-by: Anderson Lizardo <anderson.lizardo at indt.org.br>
Signed-off-by: Bruna Moreira <bruna.moreira at indt.org.br>

Index: strace/linux/arm/syscallent.h
===================================================================
--- strace.orig/linux/arm/syscallent.h	2008-01-25 08:19:38.000000000 -0400
+++ strace/linux/arm/syscallent.h	2008-01-25 08:21:06.000000000 -0400
@@ -311,23 +311,23 @@
 	{ 2,	0,	sys_mq_notify,		"mq_notify"	}, /* 278 */
 	{ 3,	0,	sys_mq_getsetattr,	"mq_getsetattr"	}, /* 279 */
 	{ 5,	TP,	sys_waitid,		"waitid"	}, /* 280 */
-	{ 5,	0,	printargs,		"SYS_281"	}, /* 281 */
-	{ 5,	0,	printargs,		"SYS_282"	}, /* 282 */
-	{ 5,	0,	printargs,		"SYS_283"	}, /* 283 */
-	{ 5,	0,	printargs,		"SYS_284"	}, /* 284 */
-	{ 5,	0,	printargs,		"SYS_285"	}, /* 285 */
-	{ 5,	0,	printargs,		"SYS_286"	}, /* 286 */
-	{ 5,	0,	printargs,		"SYS_287"	}, /* 287 */
-	{ 5,	0,	printargs,		"SYS_288"	}, /* 288 */
-	{ 5,	0,	printargs,		"SYS_289"	}, /* 289 */
-	{ 5,	0,	printargs,		"SYS_290"	}, /* 290 */
-	{ 5,	0,	printargs,		"SYS_291"	}, /* 291 */
-	{ 5,	0,	printargs,		"SYS_292"	}, /* 292 */
-	{ 5,	0,	printargs,		"SYS_293"	}, /* 293 */
-	{ 5,	0,	printargs,		"SYS_294"	}, /* 294 */
-	{ 5,	0,	printargs,		"SYS_295"	}, /* 295 */
-	{ 5,	0,	printargs,		"SYS_296"	}, /* 296 */
-	{ 5,	0,	printargs,		"SYS_297"	}, /* 297 */
+	{ 3,	TN,	sys_socket,		"socket"	}, /* 281 */
+	{ 3,	TN,	sys_bind,		"bind"		}, /* 282 */
+	{ 3,	TN,	sys_connect,		"connect"	}, /* 283 */
+	{ 2,	TN,	sys_listen,		"listen"	}, /* 284 */
+	{ 3,	TN,	sys_accept,		"accept"	}, /* 285 */
+	{ 3,	TN,	sys_getsockname,	"getsockname"	}, /* 286 */
+	{ 3,	TN,	sys_getpeername,	"getpeername"	}, /* 287 */
+	{ 4,	TN,	sys_socketpair,		"socketpair"	}, /* 288 */
+	{ 4,	TN,	sys_send,		"send"		}, /* 289 */
+	{ 6,	TN,	sys_sendto,		"sendto"	}, /* 290 */
+	{ 4,	TN,	sys_recv,		"recv"		}, /* 291 */
+	{ 6,	TN,	sys_recvfrom,		"recvfrom"	}, /* 292 */
+	{ 2,	TN,	sys_shutdown,		"shutdown"	}, /* 293 */
+	{ 5,	TN,	sys_setsockopt,		"setsockopt"	}, /* 294 */
+	{ 5,	TN,	sys_getsockopt,		"getsockopt"	}, /* 295 */
+	{ 3,	TN,	sys_sendmsg,		"sendmsg"	}, /* 296 */
+	{ 3,	TN,	sys_recvmsg,		"recvmsg"	}, /* 297 */
 	{ 5,	0,	printargs,		"SYS_298"	}, /* 298 */
 	{ 5,	0,	printargs,		"SYS_299"	}, /* 299 */
 	{ 5,	0,	printargs,		"SYS_300"	}, /* 300 */
Index: strace/linux/arm/syscallent1.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace/linux/arm/syscallent1.h	2008-01-25 08:32:48.000000000 -0400
@@ -0,0 +1,7 @@
+/* ARM specific syscalls */
+	{ 5,	0,	printargs,		"SYS_0"			}, /* 0 */
+	{ 5,	0,	printargs,		"breakpoint"		}, /* 1 */
+	{ 5,	0,	printargs,		"cacheflush"		}, /* 2 */
+	{ 5,	0,	printargs,		"usr26"			}, /* 3 */
+	{ 5,	0,	printargs,		"usr32"			}, /* 4 */
+	{ 5,	0,	printargs,		"set_tls"		}, /* 5 */
Index: strace/defs.h
===================================================================
--- strace.orig/defs.h	2007-11-12 15:44:38.000000000 -0400
+++ strace/defs.h	2008-01-25 08:21:06.000000000 -0400
@@ -213,6 +213,13 @@ extern int ptrace();
 #define PERSONALITY1_WORDSIZE 4
 #endif

+#ifdef ARM
+#undef SUPPORTED_PERSONALITIES
+#define SUPPORTED_PERSONALITIES 2
+#define PERSONALITY0_WORDSIZE 4
+#define PERSONALITY1_WORDSIZE 4
+#endif
+
 #ifdef SVR4
 #ifdef HAVE_MP_PROCFS
 extern int mp_ioctl (int f, int c, void *a, int s);
Index: strace/syscall.c
===================================================================
--- strace.orig/syscall.c	2007-11-12 15:44:38.000000000 -0400
+++ strace/syscall.c	2008-01-25 08:30:41.000000000 -0400
@@ -1096,6 +1096,14 @@ struct tcb *tcp;
 				scno &= 0x000fffff;
 			}
 		}
+		if (scno & 0x0f0000) {
+			/*
+			 * Handle ARM specific syscall
+			 */
+			set_personality(1);
+			scno &= 0x0000ffff;
+		} else
+			set_personality(0);

 		if (tcp->flags & TCB_INSYSCALL) {
 			fprintf(stderr, "pid %d stray syscall entry\n", tcp->pid);
Index: strace/linux/arm/errnoent1.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace/linux/arm/errnoent1.h	2008-01-25 08:21:06.000000000 -0400
@@ -0,0 +1,2 @@
+/* Our second set comes from the i386 files.  */
+#include "../errnoent.h"
Index: strace/linux/arm/ioctlent1.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace/linux/arm/ioctlent1.h	2008-01-25 08:21:06.000000000 -0400
@@ -0,0 +1,2 @@
+/* Our second set comes from the i386 files.  */
+#include "../ioctlent.h"
Index: strace/linux/arm/signalent1.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ strace/linux/arm/signalent1.h	2008-01-25 08:21:06.000000000 -0400
@@ -0,0 +1,2 @@
+/* Our second set comes from the i386 files.  */
+#include "../signalent.h"

-- 
Anderson Lizardo
Instituto Nokia de Tecnologia
Manaus - Brazil




More information about the Strace-devel mailing list