message: Fix emitting a line entry for PC = 0
  Summary: ART doesn't take the initial PC of the DWARF program into account when symbolicating a given frame, so we need to explicitly say "hey PC 0 goes to line 0"
diff: @@ -1212,6 +1212,23 @@ int emit_debug_info(
  return size;
  }
  +// Returns a DexDebugInstruction corresponding to emitting a line entry
  +// with the given address offset and line offset. Asserts if invalid arguments.
  +inline std::unique_ptr<DexDebugInstruction> create_line_entry(int8_t line,
  + uint8_t addr) {
  + // These are limits imposed by
  + // https://source.android.com/devices/tech/dalvik/dex-format#opcodes
  + always_assert(line >= -4 && line <= 10);
  + always_assert(addr <= 17);
  + // Below is correct because adjusted_opcode = (addr * 15) + (line + 4), so
  + // line_offset = -4 + (adjusted_opcode % 15) = -4 + line + 4 = line
  + // addr_offset = adjusted_opcode / 15 = addr * 15 / 15 = addr since line + 4
  + // is bounded by 0 and 14 we know (line + 4) / 15 = 0
  + uint8_t opcode = 0xa + (addr * 15) + (line + 4);
  + return std::make_unique<DexDebugInstruction>(
  + static_cast<DexDebugItemOpcode>(opcode));
  +}
  +
  uint32_t emit_instruction_offset_debug_info(
  DexOutputIdx* dodx,
  bool per_arity,
  @@ -1271,9 +1288,14 @@ uint32_t emit_instruction_offset_debug_info(
  params.push_back(nullptr);
  }
  std::vector<std::unique_ptr<DexDebugInstruction>> dbgops;
  - for (size_t i = 0; i < insns_size; i++) {
  - dbgops.push_back(std::make_unique<DexDebugInstruction>(
  - static_cast<DexDebugItemOpcode>(0x1e)));
  + if (insns_size > 0) {
  + // First emit an entry for pc = 0 -> line = 0
  + dbgops.push_back(create_line_entry(0, 0));
  + // Now emit an entry for each pc thereafter
  + // (0x1e increments addr+line by 1)
  + for (size_t i = 1; i < insns_size; i++) {
  + dbgops.push_back(create_line_entry(1, 1));
  + }
  }
  offset += DexDebugItem::encode(nullptr, output + offset, 0, params, dbgops);
  *dbgcount += 1;
  