Commit 7b2f214b authored by Hector Chu's avatar Hector Chu Committed by Russ Cox

gopprof: regexp fixes

Extract Windows filenames correctly.
Don't remove receivers from method names.

Fixes #2227.

R=rsc
CC=golang-dev
https://golang.org/cl/4969059
parent ec3dc34d
...@@ -1241,7 +1241,7 @@ sub Disassemble { ...@@ -1241,7 +1241,7 @@ sub Disassemble {
while (<OBJDUMP>) { while (<OBJDUMP>) {
s/\r//g; # turn windows-looking lines into unix-looking lines s/\r//g; # turn windows-looking lines into unix-looking lines
chop; chop;
if (m|\s*([^:\s]+):(\d+)\s*$|) { if (m|\s*(.+):(\d+)\s*$|) {
# Location line of the form: # Location line of the form:
# <filename>:<linenumber> # <filename>:<linenumber>
$filename = $1; $filename = $1;
...@@ -4485,7 +4485,7 @@ sub MapSymbolsWithNM { ...@@ -4485,7 +4485,7 @@ sub MapSymbolsWithNM {
sub ShortFunctionName { sub ShortFunctionName {
my $function = shift; my $function = shift;
while ($function =~ s/\([^()]*\)(\s*const)?//g) { } # Argument types while ($function =~ s/(?<!\.)\([^()]*\)(\s*const)?//g) { } # Argument types
while ($function =~ s/<[^<>]*>//g) { } # Remove template arguments while ($function =~ s/<[^<>]*>//g) { } # Remove template arguments
$function =~ s/^.*\s+(\w+::)/$1/; # Remove leading type $function =~ s/^.*\s+(\w+::)/$1/; # Remove leading type
return $function; return $function;
...@@ -4494,7 +4494,7 @@ sub ShortFunctionName { ...@@ -4494,7 +4494,7 @@ sub ShortFunctionName {
# Trim overly long symbols found in disassembler output # Trim overly long symbols found in disassembler output
sub CleanDisassembly { sub CleanDisassembly {
my $d = shift; my $d = shift;
while ($d =~ s/\([^()%]*\)(\s*const)?//g) { } # Argument types, not (%rax) while ($d =~ s/(?<!\.)\([^()%]*\)(\s*const)?//g) { } # Argument types, not (%rax)
while ($d =~ s/(\w+)<[^<>]*>/$1/g) { } # Remove template arguments while ($d =~ s/(\w+)<[^<>]*>/$1/g) { } # Remove template arguments
return $d; return $d;
} }
......
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