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

Commit d3ef8f41 authored by Elliott Hughes's avatar Elliott Hughes Committed by Android Git Automerger
Browse files

am 2520f1eb: am 37d7fdbb: Merge "Maps output now marks the fault address location."

* commit '2520f1eb':
  Maps output now marks the fault address location.
parents aab0d57d 2520f1eb
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -343,8 +343,9 @@ static void dump_backtrace_and_stack(Backtrace* backtrace, log_t* log) {
  }
}

static void dump_map(log_t* log, const backtrace_map_t* map) {
  _LOG(log, logtype::MAPS, "    %" PRIPTR "-%" PRIPTR " %c%c%c %s\n", map->start, map->end,
static void dump_map(log_t* log, const backtrace_map_t* map, bool fault_addr) {
  _LOG(log, logtype::MAPS, "%s%" PRIPTR "-%" PRIPTR " %c%c%c %s\n",
         (fault_addr? "--->" : "    "), map->start, map->end,
         (map->flags & PROT_READ) ? 'r' : '-', (map->flags & PROT_WRITE) ? 'w' : '-',
         (map->flags & PROT_EXEC) ? 'x' : '-', map->name.c_str());
}
@@ -366,10 +367,18 @@ static void dump_nearby_maps(BacktraceMap* map, log_t* log, pid_t tid) {
    return;
  }

  _LOG(log, logtype::MAPS, "\nmemory map:\n");
  _LOG(log, logtype::MAPS, "\nmemory map: (fault address prefixed with --->)\n");

  bool found_map = false;
  for (BacktraceMap::const_iterator it = map->begin(); it != map->end(); ++it) {
    dump_map(log, &*it);
    bool in_map = addr >= (*it).start && addr < (*it).end;
    dump_map(log, &*it, in_map);
    if(in_map) {
      found_map = true;
    }
  }
  if(!found_map) {
    _LOG(log, logtype::ERROR, "\nFault address was not in any map!");
  }
}