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

Commit 24016570 authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge "libdebuggerd: fix tombstone tests." am: 8eada2a9

am: 877747f1

Change-Id: I6e593eeb02dc580316339e9cd6bede2889e0ce13
parents 75374ba1 877747f1
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line Diff line number Diff line
@@ -113,7 +113,7 @@ TEST_F(TombstoneTest, single_map) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump = \
  const char* expected_dump = \
"\nmemory map:\n"
"\nmemory map (1 entry):\n"
#if defined(__LP64__)
#if defined(__LP64__)
"    12345678'9abcd000-12345678'9abdefff ---         0     12000\n";
"    12345678'9abcd000-12345678'9abdefff ---         0     12000\n";
#else
#else
@@ -148,7 +148,7 @@ TEST_F(TombstoneTest, single_map_elf_build_id) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump = \
  const char* expected_dump = \
"\nmemory map:\n"
"\nmemory map (1 entry):\n"
#if defined(__LP64__)
#if defined(__LP64__)
"    12345678'9abcd000-12345678'9abdefff r--         0     12000  /system/lib/libfake.so (BuildId: abcdef1234567890abcdef1234567890)\n";
"    12345678'9abcd000-12345678'9abdefff r--         0     12000  /system/lib/libfake.so (BuildId: abcdef1234567890abcdef1234567890)\n";
#else
#else
@@ -187,7 +187,7 @@ TEST_F(TombstoneTest, single_map_no_build_id) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump = \
  const char* expected_dump = \
"\nmemory map:\n"
"\nmemory map (2 entries):\n"
#if defined(__LP64__)
#if defined(__LP64__)
"    12345678'9abcd000-12345678'9abdefff -w-         0     12000\n"
"    12345678'9abcd000-12345678'9abdefff -w-         0     12000\n"
"    12345678'9abcd000-12345678'9abdefff -w-         0     12000  /system/lib/libfake.so\n";
"    12345678'9abcd000-12345678'9abdefff -w-         0     12000  /system/lib/libfake.so\n";
@@ -245,7 +245,7 @@ TEST_F(TombstoneTest, multiple_maps) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump =
  const char* expected_dump =
      "\nmemory map:\n"
      "\nmemory map (5 entries):\n"
#if defined(__LP64__)
#if defined(__LP64__)
      "    00000000'0a234000-00000000'0a234fff ---         0      1000\n"
      "    00000000'0a234000-00000000'0a234fff ---         0      1000\n"
      "    00000000'0a334000-00000000'0a334fff r--      f000      1000\n"
      "    00000000'0a334000-00000000'0a334fff r--      f000      1000\n"
@@ -305,7 +305,7 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_before) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump =
  const char* expected_dump =
      "\nmemory map: (fault address prefixed with --->)\n"
      "\nmemory map (3 entries):\n"
#if defined(__LP64__)
#if defined(__LP64__)
      "--->Fault address falls at 00000000'00001000 before any mapped regions\n"
      "--->Fault address falls at 00000000'00001000 before any mapped regions\n"
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n"
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n"
@@ -363,7 +363,7 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_between) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump =
  const char* expected_dump =
      "\nmemory map: (fault address prefixed with --->)\n"
      "\nmemory map (3 entries): (fault address prefixed with --->)\n"
#if defined(__LP64__)
#if defined(__LP64__)
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n"
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n"
      "--->Fault address falls at 00000000'0a533000 between mapped regions\n"
      "--->Fault address falls at 00000000'0a533000 between mapped regions\n"
@@ -421,7 +421,7 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_in_map) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump =
  const char* expected_dump =
      "\nmemory map: (fault address prefixed with --->)\n"
      "\nmemory map (3 entries): (fault address prefixed with --->)\n"
#if defined(__LP64__)
#if defined(__LP64__)
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n"
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n"
      "--->00000000'0a534000-00000000'0a534fff --x      3000      1000  (load bias 0x2000)\n"
      "--->00000000'0a534000-00000000'0a534fff --x      3000      1000  (load bias 0x2000)\n"
@@ -481,7 +481,7 @@ TEST_F(TombstoneTest, multiple_maps_fault_address_after) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump =
  const char* expected_dump =
      "\nmemory map: (fault address prefixed with --->)\n"
      "\nmemory map (3 entries): (fault address prefixed with --->)\n"
#if defined(__LP64__)
#if defined(__LP64__)
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n"
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n"
      "    00000000'0a534000-00000000'0a534fff --x      3000      1000  (load bias 0x2000)\n"
      "    00000000'0a534000-00000000'0a534fff --x      3000      1000  (load bias 0x2000)\n"
@@ -521,7 +521,7 @@ TEST_F(TombstoneTest, multiple_maps_getsiginfo_fail) {
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
  const char* expected_dump =
  const char* expected_dump =
      "\nmemory map:\n"
      "\nmemory map (1 entry):\n"
#if defined(__LP64__)
#if defined(__LP64__)
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n";
      "    00000000'0a434000-00000000'0a434fff -w-      1000      1000  (load bias 0xd000)\n";
#else
#else
@@ -571,7 +571,7 @@ TEST_F(TombstoneTest, multiple_maps_check_signal_has_si_addr) {
    }
    }


    const char* expected_addr_dump = \
    const char* expected_addr_dump = \
"\nmemory map: (fault address prefixed with --->)\n"
"\nmemory map (1 entry):\n"
#if defined(__LP64__)
#if defined(__LP64__)
"--->Fault address falls at 00000000'00001000 before any mapped regions\n"
"--->Fault address falls at 00000000'00001000 before any mapped regions\n"
"    00000000'0a434000-00000000'0a434fff -w-         0      1000\n";
"    00000000'0a434000-00000000'0a434fff -w-         0      1000\n";
@@ -580,7 +580,7 @@ TEST_F(TombstoneTest, multiple_maps_check_signal_has_si_addr) {
"    0a434000-0a434fff -w-         0      1000\n";
"    0a434000-0a434fff -w-         0      1000\n";
#endif
#endif
    const char* expected_dump = \
    const char* expected_dump = \
"\nmemory map:\n"
"\nmemory map (1 entry):\n"
#if defined(__LP64__)
#if defined(__LP64__)
"    00000000'0a434000-00000000'0a434fff -w-         0      1000\n";
"    00000000'0a434000-00000000'0a434fff -w-         0      1000\n";
#else
#else
+6 −4
Original line number Original line Diff line number Diff line
@@ -415,16 +415,18 @@ static void dump_all_maps(Backtrace* backtrace, BacktraceMap* map, log_t* log, p
  ScopedBacktraceMapIteratorLock lock(map);
  ScopedBacktraceMapIteratorLock lock(map);
  _LOG(log, logtype::MAPS,
  _LOG(log, logtype::MAPS,
       "\n"
       "\n"
       "memory map (%zu entries):\n",
       "memory map (%zu entr%s):",
       map->size());
       map->size(), map->size() == 1 ? "y" : "ies");
  if (print_fault_address_marker) {
  if (print_fault_address_marker) {
    if (map->begin() != map->end() && addr < map->begin()->start) {
    if (map->begin() != map->end() && addr < map->begin()->start) {
      _LOG(log, logtype::MAPS, "--->Fault address falls at %s before any mapped regions\n",
      _LOG(log, logtype::MAPS, "\n--->Fault address falls at %s before any mapped regions\n",
           get_addr_string(addr).c_str());
           get_addr_string(addr).c_str());
      print_fault_address_marker = false;
      print_fault_address_marker = false;
    } else {
    } else {
      _LOG(log, logtype::MAPS, " (fault address prefixed with --->)\n");
      _LOG(log, logtype::MAPS, " (fault address prefixed with --->)\n");
    }
    }
  } else {
    _LOG(log, logtype::MAPS, "\n");
  }
  }


  std::string line;
  std::string line;