| // Copyright 2020 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef SRC_DEVELOPER_DEBUG_DEBUG_AGENT_ELF_UTILS_H_ |
| #define SRC_DEVELOPER_DEBUG_DEBUG_AGENT_ELF_UTILS_H_ |
| |
| #include <stdint.h> |
| |
| #include <functional> |
| #include <vector> |
| |
| #include "src/developer/debug/shared/status.h" |
| |
| namespace debug_ipc { |
| struct Module; |
| } |
| |
| namespace debug_agent { |
| |
| class ProcessHandle; |
| |
| // Iterates through all modules in the given process, calling the callback for each. The callback |
| // should return true to keep iterating, false to stop now. |
| debug::Status WalkElfModules(const ProcessHandle& process, uint64_t dl_debug_addr, |
| std::function<bool(uint64_t base_addr, uint64_t lmap)> cb); |
| |
| // Computes the modules for the given process. |
| std::vector<debug_ipc::Module> GetElfModulesForProcess(const ProcessHandle& process, |
| uint64_t dl_debug_addr); |
| |
| } // namespace debug_agent |
| |
| #endif // SRC_DEVELOPER_DEBUG_DEBUG_AGENT_ELF_UTILS_H_ |