mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
Fix handling of # chars in cg_diff.
Rust v0 symbols can have `#` chars in them, things like this:
```
core::panic::unwind_safe::AssertUnwindSafe<<proc_macro::bridge::server::Dispat
cher<proc_macro::bridge::server::MarkedTypes<rustc_expand::proc_macro_server::Rustc>> as proc_macro::bridge::server::DispatcherTrait>::dispatch::{closure#14}>, ()>
```
`cg_diff` currently messes these up in two ways.
- It treats anything after a `#` in the input file as a comment. In
comparison, `cg_annotate` only treats a `#` as starting a comment at
the start of a line.
- It uses `#` to temporarily join file names and function names while
processing.
This commit adjusts the parsing to fix the first problem, and changes
the joiner sequence to `###` to fix the second problem.
This commit is contained in:
parent
521e469009
commit
1cf2cf91e7
@ -191,15 +191,17 @@ sub read_input_file($)
|
||||
my $currFileName;
|
||||
my $currFileFuncName;
|
||||
|
||||
my %CCs; # hash("$filename#$funcname" => CC array)
|
||||
my %CCs; # hash("$filename###$funcname" => CC array)
|
||||
my $currCC = undef; # CC array
|
||||
|
||||
my $summaryCC;
|
||||
|
||||
# Read body of input file.
|
||||
while (<INPUTFILE>) {
|
||||
s/#.*$//; # remove comments
|
||||
if (s/^(\d+)\s+//) {
|
||||
# Skip comments and empty lines.
|
||||
next if /^\s*$/ || /^\#/;
|
||||
|
||||
if (s/^(-?\d+)\s+//) {
|
||||
my $CC = line_to_CC($_, $numEvents);
|
||||
defined($currCC) || die;
|
||||
add_array_a_to_b($CC, $currCC);
|
||||
@ -210,7 +212,7 @@ sub read_input_file($)
|
||||
if (defined $mod_funcname) {
|
||||
eval "\$tmpFuncName =~ $mod_funcname";
|
||||
}
|
||||
$currFileFuncName = "$currFileName#$tmpFuncName";
|
||||
$currFileFuncName = "$currFileName###$tmpFuncName";
|
||||
$currCC = $CCs{$currFileFuncName};
|
||||
if (not defined $currCC) {
|
||||
$currCC = [];
|
||||
@ -225,9 +227,6 @@ sub read_input_file($)
|
||||
# Assume that a "fn=" line is followed by a "fl=" line.
|
||||
$currFileFuncName = undef;
|
||||
|
||||
} elsif (s/^\s*$//) {
|
||||
# blank, do nothing
|
||||
|
||||
} elsif (s/^summary:\s+//) {
|
||||
$summaryCC = line_to_CC($_, $numEvents);
|
||||
(scalar(@$summaryCC) == @events)
|
||||
@ -260,7 +259,7 @@ my $events1;
|
||||
my $events2;
|
||||
|
||||
# Individual CCs, organised by filename/funcname/line_num.
|
||||
# hashref("$filename#$funcname", CC array)
|
||||
# hashref("$filename###$funcname", CC array)
|
||||
my $CCs1;
|
||||
my $CCs2;
|
||||
|
||||
@ -313,7 +312,7 @@ print("\n");
|
||||
|
||||
while (my ($filefuncname, $CC) = each(%$CCs2)) {
|
||||
|
||||
my @x = split(/#/, $filefuncname);
|
||||
my @x = split(/###/, $filefuncname);
|
||||
(scalar @x == 2) || die;
|
||||
|
||||
print("fl=$x[0]\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user