Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f10562b authored by Colin Cross's avatar Colin Cross
Browse files

Add ABI to leak report

Add the ABI to the leak report so that it can be piped through
development/scripts/stack.

Bug: 27208635
Change-Id: I2e050a377305d48d2f904f34ea921f64e13dd00e
(cherry picked from commit 11185af9)
parent c1228c7f
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -468,11 +468,30 @@ std::string Leak::ToString(bool log_contents) const {
  return oss.str();
  return oss.str();
}
}


// Figure out the abi based on defined macros.
#if defined(__arm__)
#define ABI_STRING "arm"
#elif defined(__aarch64__)
#define ABI_STRING "arm64"
#elif defined(__mips__) && !defined(__LP64__)
#define ABI_STRING "mips"
#elif defined(__mips__) && defined(__LP64__)
#define ABI_STRING "mips64"
#elif defined(__i386__)
#define ABI_STRING "x86"
#elif defined(__x86_64__)
#define ABI_STRING "x86_64"
#else
#error "Unsupported ABI"
#endif

std::string UnreachableMemoryInfo::ToString(bool log_contents) const {
std::string UnreachableMemoryInfo::ToString(bool log_contents) const {
  std::ostringstream oss;
  std::ostringstream oss;
  oss << "  " << leak_bytes << " bytes in ";
  oss << "  " << leak_bytes << " bytes in ";
  oss << num_leaks << " unreachable allocation" << plural(num_leaks);
  oss << num_leaks << " unreachable allocation" << plural(num_leaks);
  oss << std::endl;
  oss << std::endl;
  oss << "  ABI: '" ABI_STRING "'" << std::endl;
  oss << std::endl;


  for (auto it = leaks.begin(); it != leaks.end(); it++) {
  for (auto it = leaks.begin(); it != leaks.end(); it++) {
      oss << it->ToString(log_contents);
      oss << it->ToString(log_contents);