Improve art::CodeInfo dumping.
- Refactor existing dumping code into a set of new routines.
- Use art::Indenter to properly indent in the output.
- Add an additional argument to art::CodeInfo::Dump to
enable or disable the dumping of stack maps and Dex
register maps.
Change-Id: I52814095ff465522302d5d69d416726369ca5258
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index 69e57ff..eefdaa7 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -356,6 +356,8 @@
return region_.size();
}
+ void Dump(std::ostream& os, const CodeInfo& code_info);
+
// Special (invalid) Dex register location catalog entry index meaning
// that there is no location for a given Dex register (i.e., it is
// mapped to a DexRegisterLocation::Kind::kNone location).
@@ -1046,7 +1048,15 @@
return StackMap();
}
- void Dump(std::ostream& os, uint16_t number_of_dex_registers) const;
+ // Dump this CodeInfo object on `os`. If `dump_stack_maps` is true,
+ // also dump the stack maps and the associated Dex register maps.
+ void Dump(std::ostream& os, uint16_t number_of_dex_registers, bool dump_stack_maps) const;
+
+ // Dump stack map number `stack_map_num` as well as associated data on `os`,
+ // such as Dex register locations.
+ void DumpStackMap(std::ostream& os, size_t stack_map_num, uint16_t number_of_dex_registers) const;
+ // Dump the header of stack map number `stack_map_num` on `os`, without
+ // associated data.
void DumpStackMapHeader(std::ostream& os, size_t stack_map_num) const;
private: