X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d5a6a2c1461df7e31f76639767be3996dafac3a4..955310e4fe48139407cabfd6cae815a287932291:/tools/stack-cleaner/clean-stack-filter diff --git a/tools/stack-cleaner/clean-stack-filter b/tools/stack-cleaner/clean-stack-filter index 90aa7c9895..8b15cd7c0f 100755 --- a/tools/stack-cleaner/clean-stack-filter +++ b/tools/stack-cleaner/clean-stack-filter @@ -1,9 +1,10 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Transform assembly in order to clean each stack frame for X86_64. use strict; -$SIG{__WARN__} = sub { die @_ }; +use warnings; +$SIG{__WARN__} = sub { die @_ }; # Whether we are still scanning the content of a function: our $scanproc = 0; @@ -14,7 +15,6 @@ our $lines = ""; # Size of the stack for this function: our $size = 0; - # Counter for assigning unique ids to labels: our $id=0; @@ -24,7 +24,7 @@ sub emit_code { if($size != 0) { # This is a crude hack to disable the stack cleaning on the main - # stack. It rellies on the fact that the main stack is high in + # stack. It relies on the fact that the main stack is high in # the address space and the other stacks are in the heap (lower). print("\tmovq \$0x7fff00000000, %r11\n"); print("\tcmpq %r11, %rsp\n"); @@ -51,14 +51,14 @@ while (<>) { if ($scanproc) { $lines = $lines . $_; if (m/^[ \t]*.cfi_endproc$/) { - emit_code(); + emit_code(); } elsif (m/^[ \t]*pushq/) { - $size += 8; + $size += 8; } elsif (m/^[ \t]*subq[\t *]\$([0-9]*),[ \t]*%rsp$/) { - my $val = $1; - $val = oct($val) if $val =~ /^0/; - $size += $val; - emit_code(); + my $val = $1; + $val = oct($val) if $val =~ /^0/; + $size += $val; + emit_code(); } } elsif (m/^[ \t]*.cfi_startproc$/) { print $_;