]> Cypherpunks repositories - gostls13.git/commitdiff
gopprof: regexp fixes
authorHector Chu <hectorchu@gmail.com>
Wed, 7 Sep 2011 17:53:29 +0000 (13:53 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 7 Sep 2011 17:53:29 +0000 (13:53 -0400)
Extract Windows filenames correctly.
Don't remove receivers from method names.

Fixes #2227.

R=rsc
CC=golang-dev
https://golang.org/cl/4969059

src/cmd/prof/gopprof

index be5f84e9e466f81f96a8022a31fce3ec63d40767..83438b7cd6e6f10dfb2580deb9f684ed2a0f09b4 100755 (executable)
@@ -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;
@@ -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;
@@ -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;
 }