Commit 12923e43 authored by Alex Brainman's avatar Alex Brainman Committed by Russ Cox

syscall: windows syscall trace to assist debugging

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/1383041
parent 0580deaf
...@@ -112,6 +112,7 @@ while(<>) { ...@@ -112,6 +112,7 @@ while(<>) {
# Prepare arguments to Syscall. # Prepare arguments to Syscall.
my @args = (); my @args = ();
my $n = 0; my $n = 0;
my @pin= ();
foreach my $p (@in) { foreach my $p (@in) {
my ($name, $type) = parseparam($p); my ($name, $type) = parseparam($p);
if($type =~ /^\*/) { if($type =~ /^\*/) {
...@@ -135,6 +136,7 @@ while(<>) { ...@@ -135,6 +136,7 @@ while(<>) {
} else { } else {
push @args, "uintptr($name)"; push @args, "uintptr($name)";
} }
push @pin, sprintf "\"%s=\", %s, ", $name, $name;
} }
# Determine which form to use; pad args with zeros. # Determine which form to use; pad args with zeros.
...@@ -165,6 +167,7 @@ while(<>) { ...@@ -165,6 +167,7 @@ while(<>) {
my $body = ""; my $body = "";
my $failexpr = ""; my $failexpr = "";
my @ret = ("_", "_", "_"); my @ret = ("_", "_", "_");
my @pout= ();
for(my $i=0; $i<@out; $i++) { for(my $i=0; $i<@out; $i++) {
my $p = $out[$i]; my $p = $out[$i];
my ($name, $type) = parseparam($p); my ($name, $type) = parseparam($p);
...@@ -209,6 +212,7 @@ while(<>) { ...@@ -209,6 +212,7 @@ while(<>) {
} else { } else {
$body .= "\t$name = $type($reg);\n"; $body .= "\t$name = $type($reg);\n";
} }
push @pout, sprintf "\"%s=\", %s(%s), ", $name, $type, $reg;
} }
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
$text .= "\t$call;\n"; $text .= "\t$call;\n";
...@@ -216,6 +220,9 @@ while(<>) { ...@@ -216,6 +220,9 @@ while(<>) {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call;\n"; $text .= "\t$ret[0], $ret[1], $ret[2] := $call;\n";
} }
$text .= $body; $text .= $body;
if(0) {
$text .= sprintf 'print("SYSCALL: %s(", %s") (", %s")\n")%s', $func, join('", ", ', @pin), join('", ", ', @pout), "\n";
}
$text .= "\treturn;\n"; $text .= "\treturn;\n";
$text .= "}\n\n"; $text .= "}\n\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment