summaryrefslogtreecommitdiffstats
path: root/ios/chrome/app/safe_mode_util.cc
blob: be448a450fae4b3a71a265c25558190a960d03a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ios/chrome/app/safe_mode_util.h"

#include <mach-o/dyld.h>

namespace safe_mode_util {

std::vector<std::string> GetLoadedImages(const char* path_filter) {
  std::vector<std::string> images;
  uint32_t image_count = _dyld_image_count();
  for (uint32_t i = 0; i < image_count; ++i) {
    const char* path = _dyld_get_image_name(i);
    if (path_filter && strncmp(path, path_filter, strlen(path_filter)) != 0)
      continue;
    images.push_back(path);
  }
  return images;
}

}  // namespace safe_mode_util