Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
gopprof: regexp fixes
Browse files Browse the repository at this point in the history
Extract Windows filenames correctly.
Don't remove receivers from method names.

Fixes #2227.

R=rsc
CC=golang-dev
https://golang.org/cl/4969059
  • Loading branch information
hectorchu authored and rsc committed Sep 7, 2011
1 parent ec3dc34 commit 7b2f214
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cmd/prof/gopprof
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ sub Disassemble {
while (<OBJDUMP>) {
s/\r//g; # turn windows-looking lines into unix-looking lines
chop;
if (m|\s*([^:\s]+):(\d+)\s*$|) {
if (m|\s*(.+):(\d+)\s*$|) {
# Location line of the form:
# <filename>:<linenumber>
$filename = $1;
Expand Down Expand Up @@ -4485,7 +4485,7 @@ sub MapSymbolsWithNM {

sub ShortFunctionName {
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
$function =~ s/^.*\s+(\w+::)/$1/; # Remove leading type
return $function;
Expand All @@ -4494,7 +4494,7 @@ sub ShortFunctionName {
# Trim overly long symbols found in disassembler output
sub CleanDisassembly {
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
return $d;
}
Expand Down

0 comments on commit 7b2f214

Please sign in to comment.