From: Stephen Hemminger <shemminger@vyatta.com>
To: Michal Marek <mmarek@suse.cz>
Cc: akpm@linux-foundation.org, linux-kbuild@vger.kernel.org,
amwang@redhat.com, arjan@infradead.org
Subject: Re: [patch 1/1] markup_oops: fix perlcritic warnings
Date: Wed, 28 Apr 2010 16:17:31 -0700 [thread overview]
Message-ID: <20100428161731.054fbd19@nehalam> (raw)
In-Reply-To: <4BD7F4C8.4080107@suse.cz>
More complete patch, fixes all the warnings from perlcritic as
well as perl compiler with stictures enabled.
Compile tested, does some one have an actual oops output
to recheck it on?
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/scripts/markup_oops.pl 2010-04-28 16:05:20.794776102 -0700
+++ b/scripts/markup_oops.pl 2010-04-28 16:15:24.894377031 -0700
@@ -1,5 +1,7 @@
#!/usr/bin/perl
+use strict;
+
use File::Basename;
use Math::BigInt;
@@ -79,9 +81,9 @@ sub parse_x86_regs
sub reg_name
{
my ($reg) = @_;
- $reg =~ s/r(.)x/e\1x/;
- $reg =~ s/r(.)i/e\1i/;
- $reg =~ s/r(.)p/e\1p/;
+ $reg =~ s/r(.)x/e$1x/;
+ $reg =~ s/r(.)i/e$1i/;
+ $reg =~ s/r(.)p/e$1p/;
return $reg;
}
@@ -94,17 +96,15 @@ sub process_x86_regs
}
# find the arguments to the instruction
- if ($line =~ /([0-9a-zA-Z\,\%\(\)\-\+]+)$/) {
- $lastword = $1;
- } else {
- return "";
- }
+ return "" unless ($line =~ /([0-9a-zA-Z\,\%\(\)\-\+]+)$/);
+
+ my $lastword = $1;
# we need to find the registers that get clobbered,
# since their value is no longer relevant for previous
# instructions in the stream.
- $clobber = $lastword;
+ my $clobber = $lastword;
# first, remove all memory operands, they're read only
$clobber =~ s/\([a-z0-9\%\,]+\)//g;
# then, remove everything before the comma, thats the read part
@@ -116,7 +116,7 @@ sub process_x86_regs
$clobber = "";
}
- foreach $reg (keys(%regs)) {
+ foreach my $reg (keys(%regs)) {
my $clobberprime = reg_name($clobber);
my $lastwordprime = reg_name($lastword);
my $val = $regs{$reg};
@@ -192,14 +192,15 @@ if ($module ne "") {
exit;
}
# ok so we found the module, now we need to calculate the vma offset
- open(FILE, "objdump -dS $filename |") || die "Cannot start objdump";
- while (<FILE>) {
+ open(my $obj, '-|', "objdump -dS $filename")
+ || die "Cannot start objdump: $!";
+ while (<$obj>) {
if ($_ =~ /^([0-9a-f]+) \<$function\>\:/) {
my $fu = $1;
$vmaoffset = hex($target) - hex($fu) - hex($func_offset);
}
}
- close(FILE);
+ close($obj);
}
my $counter = 0;
@@ -225,9 +226,11 @@ sub InRange {
# first, parse the input into the lines array, but to keep size down,
# we only do this for 4Kb around the sweet spot
-open(FILE, "objdump -dS --adjust-vma=$vmaoffset --start-address=$decodestart --stop-address=$decodestop $filename |") || die "Cannot start objdump";
+open(my $objdump, '-|',
+ "objdump -dS --adjust-vma=$vmaoffset --start-address=$decodestart --stop-address=$decodestop $filename")
+ or die "Cannot start objdump: $!";
-while (<FILE>) {
+while (<$objdump>) {
my $line = $_;
chomp($line);
if ($state == 0) {
@@ -252,7 +255,7 @@ while (<FILE>) {
}
}
-close(FILE);
+close($objdump);
if ($counter == 0) {
print "No matching code found \n";
next prev parent reply other threads:[~2010-04-28 23:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-27 21:12 [patch 1/1] markup_oops: fix perlcritic warnings akpm
2010-04-28 8:41 ` Michal Marek
2010-04-28 23:17 ` Stephen Hemminger [this message]
2010-05-06 16:20 ` Michal Marek
2010-05-10 18:09 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100428161731.054fbd19@nehalam \
--to=shemminger@vyatta.com \
--cc=akpm@linux-foundation.org \
--cc=amwang@redhat.com \
--cc=arjan@infradead.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=mmarek@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox