public override string ToString() { if (blocks == null) { return("Empty"); } string new_line_separator = DecompilerContext.GetNewLineSeparator(); StringBuilder buf = new StringBuilder(); foreach (BasicBlock block in blocks) { buf.Append("----- Block ").Append(block.id).Append(" -----").Append(new_line_separator ); buf.Append(block.ToString()); buf.Append("----- Edges -----").Append(new_line_separator); List <BasicBlock> suc = block.GetSuccs(); foreach (BasicBlock aSuc in suc) { buf.Append(">>>>>>>>(regular) Block ").Append(aSuc.id).Append(new_line_separator); } suc = block.GetSuccExceptions(); foreach (BasicBlock handler in suc) { ExceptionRangeCFG range = GetExceptionRange(handler, block); if (range == null) { buf.Append(">>>>>>>>(exception) Block ").Append(handler.id).Append("\t").Append("ERROR: range not found!" ).Append(new_line_separator); } else { List <string> exceptionTypes = range.GetExceptionTypes(); if (exceptionTypes == null) { buf.Append(">>>>>>>>(exception) Block ").Append(handler.id).Append("\t").Append("NULL" ).Append(new_line_separator); } else { foreach (string exceptionType in exceptionTypes) { buf.Append(">>>>>>>>(exception) Block ").Append(handler.id).Append("\t").Append(exceptionType ).Append(new_line_separator); } } } } buf.Append("----- ----- -----").Append(new_line_separator); } return(buf.ToString()); }
private void SplitJsrExceptionRanges(HashSet <BasicBlock> common_blocks, IDictionary <int, BasicBlock> mapNewNodes) { for (int i = exceptions.Count - 1; i >= 0; i--) { ExceptionRangeCFG range = exceptions[i]; List <BasicBlock> lstRange = range.GetProtectedRange(); HashSet <BasicBlock> setBoth = new HashSet <BasicBlock>(common_blocks); setBoth.IntersectWith(lstRange); if (setBoth.Count > 0) { List <BasicBlock> lstNewRange; if (setBoth.Count == lstRange.Count) { lstNewRange = new List <BasicBlock>(); ExceptionRangeCFG newRange = new ExceptionRangeCFG(lstNewRange, mapNewNodes.GetOrNull (range.GetHandler().id), range.GetExceptionTypes()); exceptions.Add(newRange); } else { lstNewRange = lstRange; } foreach (BasicBlock block in setBoth) { lstNewRange.Add(mapNewNodes.GetOrNull(block.id)); } } } }