diff --git a/androscalpel/src/code_analysis/method_cfg.rs b/androscalpel/src/code_analysis/method_cfg.rs index 0794316..e97ca50 100644 --- a/androscalpel/src/code_analysis/method_cfg.rs +++ b/androscalpel/src/code_analysis/method_cfg.rs @@ -232,13 +232,26 @@ impl<'a> MethodCFG<'a> { dot_string } + /// Compute a sanitized version of the method name + pub(crate) fn dot_sanitized_method_dscr(&self) -> String { + self.method + .descriptor + .__str__() + .replace("/", "_") + .replace(";", "") + .replace(">", "") + .replace("-", "_") + .replace("(", "_") + .replace(")", "_") + } + // method call: cluster_{mth}:node_{i}:i{j}:e -> cluster_{mth2}:n ? /// Serialize the graph to dot format. pub fn to_dot_subgraph(&self) -> String { let mut dot_string = format!( "subgraph \"cluster_{}\" {{\n", - self.method.descriptor.__str__() + self.dot_sanitized_method_dscr() ); dot_string += " style=\"dashed\";\n"; dot_string += " color=\"black\";\n"; diff --git a/androscalpel/src/code_analysis/register_type.rs b/androscalpel/src/code_analysis/register_type.rs index a23d649..a98c56b 100644 --- a/androscalpel/src/code_analysis/register_type.rs +++ b/androscalpel/src/code_analysis/register_type.rs @@ -102,7 +102,7 @@ impl MethodCFG<'_> { let types = self.get_reg_types(); let mut dot_string = format!( "subgraph \"cluster_reg_types_{}\" {{\n", - self.method.descriptor.__str__() + self.dot_sanitized_method_dscr() ); dot_string += " style=\"dashed\";\n"; dot_string += " color=\"black\";\n"; @@ -129,9 +129,9 @@ impl MethodCFG<'_> { dot_string += &format!( " cluster_{}:node_{}:s -> cluster_reg_types_{}:node_{}:n \ [style=\"solid,bold\",color=grey,weight=10,constraint=true];\n", - self.method.descriptor.__str__(), + self.dot_sanitized_method_dscr(), i, - self.method.descriptor.__str__(), + self.dot_sanitized_method_dscr(), name ); }