Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/os/aix/vm/loadlib_aix.hpp
32284 views
/*1* Copyright 2012, 2013 SAP AG. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/232425// Loadlib_aix.cpp contains support code for analysing the memory26// layout of loaded binaries in ones own process space.27//28// It is needed, among other things, to provide a dladdr() emulation, because29// that one is not provided by AIX3031#ifndef OS_AIX_VM_LOADLIB_AIX_HPP32#define OS_AIX_VM_LOADLIB_AIX_HPP3334class outputStream;3536// This class holds information about a single loaded library module.37// Note that on AIX, a single library can be spread over multiple38// uintptr_t range on a module base, eg.39// libC.a(shr3_64.o) or libC.a(shrcore_64.o).40class LoadedLibraryModule {4142friend class LoadedLibraries;4344char fullpath[512]; // eg /usr/lib/libC.a45char shortname[30]; // eg libC.a46char membername[30]; // eg shrcore_64.o47const unsigned char* text_from;48const unsigned char* text_to;49const unsigned char* data_from;50const unsigned char* data_to;5152public:5354const char* get_fullpath() const {55return fullpath;56}57const char* get_shortname() const {58return shortname;59}60const char* get_membername() const {61return membername;62}6364// text_from, text_to: returns the range of the text (code)65// segment for that module66const unsigned char* get_text_from() const {67return text_from;68}69const unsigned char* get_text_to() const {70return text_to;71}7273// data_from/data_to: returns the range of the data74// segment for that module75const unsigned char* get_data_from() const {76return data_from;77}78const unsigned char* get_data_to() const {79return data_to;80}8182// returns true if the83bool is_in_text(const unsigned char* p) const {84return p >= text_from && p < text_to ? true : false;85}8687bool is_in_data(const unsigned char* p) const {88return p >= data_from && p < data_to ? true : false;89}9091// output debug info92void print(outputStream* os) const;9394}; // end LoadedLibraryModule9596// This class is a singleton holding a map of all loaded binaries97// in the AIX process space.98class LoadedLibraries99// : AllStatic (including allocation.hpp just for AllStatic is overkill.)100{101102private:103104enum {MAX_MODULES = 100};105static LoadedLibraryModule tab[MAX_MODULES];106static int num_loaded;107108public:109110// rebuild the internal table of LoadedLibraryModule objects111static void reload();112113// checks whether the address p points to any of the loaded code segments.114// If it does, returns the LoadedLibraryModule entry. If not, returns NULL.115static const LoadedLibraryModule* find_for_text_address(const unsigned char* p);116117// checks whether the address p points to any of the loaded data segments.118// If it does, returns the LoadedLibraryModule entry. If not, returns NULL.119static const LoadedLibraryModule* find_for_data_address(const unsigned char* p);120121// output debug info122static void print(outputStream* os);123124}; // end LoadedLibraries125126127#endif // OS_AIX_VM_LOADLIB_AIX_HPP128129130