message: Support special $Position.* positions for --input-type dexdump
  Summary: This produces something pretty and readable, but certainly outside of the typical dexdump format.
diff: @@ -43,16 +43,39 @@ class DexdumpSymbolicator(object):
  )
  return "L%s;" % m
  + def decode_positions_at(self, idx):
  + positions = self.symbol_maps.line_map.get_stack(idx)
  + results = []
  + for pos in positions:
  + if pos.method == "redex.$Position.pattern":
  + pattern_id = pos.line
  + results.append("pattern %d" % pattern_id)
  + elif pos.method == "redex.$Position.switch":
  + start = pos.line
  + count_positions = self.symbol_maps.line_map.get_stack(start)
  + assert len(count_positions) == 1
  + assert count_positions[0].method == "redex.$Position.count"
  + count = count_positions[0].line
  + switch_results = []
  + for i in range(count):
  + switch_results.append(
  + "{%s}" % (", ".join(self.decode_positions_at(start + 1 + i)))
  + )
  + results.append("switch {%s}" % (", ".join(switch_results)))
  + elif pos.method == "redex.$Position.case":
  + pattern_id = pos.line
  + results.append("case(pattern %d)" % pattern_id)
  + else:
  + results.append("%s:%d" % (pos.file, pos.line))
  + return results
  +
  def line_replacer(self, matchobj):
  lineno = int(matchobj.group("lineno"))
  - positions = map(
  - lambda p: "%s:%d" % (p.file, p.line),
  - self.symbol_maps.line_map.get_stack(lineno - 1),
  - )
  + decoded_positions = self.decode_positions_at(lineno - 1)
  if self.all_line_info:
  - line_info = str(lineno) + " (" + ", ".join(positions) + ")"
  + line_info = str(lineno) + " (" + ", ".join(decoded_positions) + ")"
  else:
  - line_info = ", ".join(positions)
  + line_info = ", ".join(decoded_positions)
  return matchobj.group("prefix") + line_info
  @@ -121,15 +144,16 @@ class DexdumpSymbolicator(object):
  # Don't emit duplicate line entries
  return None
  self.last_lineno = mapped_line
  - positions = map(
  - lambda p: "%s:%d" % (p.file, p.line),
  - self.symbol_maps.line_map.get_stack(mapped_line - 1),
  + decoded_positions = self.decode_positions_at(
  + mapped_line - 1
  )
  if self.all_line_info:
  - line_info = lineno + " (" + ", ".join(positions) + ")"
  + line_info = (
  + lineno + " (" + ", ".join(decoded_positions) + ")"
  + )
  else:
  - line_info = ", ".join(positions)
  + line_info = ", ".join(decoded_positions)
  return " " + match.group("prefix") + line_info + "\n"
  no_debug_info = (
  @@ -146,9 +170,8 @@ class DexdumpSymbolicator(object):
  return line
  result = ""
  for i, (pc, mapped_line) in enumerate(mappings):
  - positions = map(
  - lambda p: "%s:%d" % (p.file, p.line),
  - self.symbol_maps.line_map.get_stack(mapped_line - 1),
  + decoded_positions = self.decode_positions_at(
  + mapped_line - 1
  )
  if i == 0:
  pc = 0
  @@ -156,7 +179,7 @@ class DexdumpSymbolicator(object):
  " "
  + "{0:#0{1}x}".format(pc, 6)
  + " line="
  - + ", ".join(positions)
  + + ", ".join(decoded_positions)
  + "\n"
  )
  return result + line
  