ソースを参照

syscall tracing: tweak how PREAD is printed

It was not quite right and it was making Go debugging hard.

PREAD should only print the fd on entry, since it needs to print out lots
more info on exit that results from the system call.

Change-Id: I96e217331e7e36dfd232140322cc1791c28385c4
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 8 年 前
コミット
38dfb334fa
2 ファイル変更6 行追加11 行削除
  1. 4 9
      sys/src/9/port/syscallfmt.c
  2. 2 2
      sys/src/cmd/ratrace.c

+ 4 - 9
sys/src/9/port/syscallfmt.c

@@ -316,13 +316,7 @@ syscallfmt(int syscallno, ...)
 	case READ:					/* deprecated */
 	case PREAD:
 		i[0] = va_arg(list, int);
-		v = va_arg(list, void*);
-		l = va_arg(list, int32_t);
-		fmtprint(&fmt, "%d %#p %ld", i[0], v, l);
-		if(syscallno == PREAD){
-			vl = va_arg(list, int64_t);
-			fmtprint(&fmt, " %lld", vl);
-		}
+		fmtprint(&fmt, "%d", i[0]);
 		break;
 	case WRITE:					/* deprecated */
 	case PWRITE:
@@ -453,12 +447,13 @@ sysretfmt(int syscallno, Ar0* ar0, uint64_t start,
 		USED(i);
 		v = va_arg(list, void*);
 		l = va_arg(list, int32_t);
-		if(ar0->l > 0){
+		vl = va_arg(list, int64_t);
+		if(ar0->l >= 0){
 			len = MIN(ar0->l, 64);
 			fmtrwdata(&fmt, v, len, "");
 		}
 		else{
-			fmtprint(&fmt, "/\"\"");
+			fmtprint(&fmt, " %#p/\"\"", v);
 			errstr = up->errstr;
 		}
 		fmtprint(&fmt, " %ld", l);

+ 2 - 2
sys/src/cmd/ratrace.c

@@ -177,10 +177,10 @@ writer(void *v)
 			/* If we have not printed a result, and this is not a result,
 			 * we need to print a newline.
 			 */
-			if (s->buf[1] != '=' && ! printedresult)
+			if ((s->buf[1] != '=' && s->buf[0] != ' ') && ! printedresult)
 				fprint(2, "\n");
 			fprint(2, "%s", s->buf);
-			printedresult = s->buf[1] == '=';
+			printedresult = s->buf[1] == '=' || s->buf[0] == ' ';
 			free(s);
 			break;
 		case 2:			/* forkc */