mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
Previously, only module() was present: it retrieved the base address of the specified module. It worked fine, but it iterated through the process' modules every time it was called. This commit replaces it with modules(), which returns an std::unordered_map containing all modules. The map uses the module name as key and Module as value. Aside from the performance improvement, the new code also provides info for each module region: - Start address. - Size. - Whether it's readable, writable and/or executable.
19 lines
482 B
C++
19 lines
482 B
C++
// Copyright 2020 The Mumble Developers. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license
|
|
// that can be found in the LICENSE file at the root of the
|
|
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
|
|
|
|
#include "Module.h"
|
|
|
|
Module::Module(const std::string &name) : m_name(name) {
|
|
}
|
|
|
|
procptr_t Module::baseAddress() const {
|
|
const auto iter = m_regions.cbegin();
|
|
if (iter != m_regions.cend()) {
|
|
return iter->address;
|
|
}
|
|
|
|
return 0;
|
|
}
|