rev 9211 : 8140645: Recent Developments for AIX
Summary: Port recent developments from SAP for AIX to the OpenJDK

   1 /*
   2  * Copyright 2012, 2013 SAP AG. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 
  26 // Loadlib_aix.cpp contains support code for analysing the memory
  27 // layout of loaded binaries in ones own process space.
  28 //
  29 // It is needed, among other things, to provide a  dladdr() emulation, because
  30 // that one is not provided by AIX
  31 
  32 #ifndef OS_AIX_VM_LOADLIB_AIX_HPP
  33 #define OS_AIX_VM_LOADLIB_AIX_HPP
  34 
  35 class outputStream;
  36 
  37 // Struct holds information about a single loaded library module.
  38 // Note that on AIX, a single library can be spread over multiple
  39 // uintptr_t range on a module base, eg.
  40 // libC.a(shr3_64.o) or libC.a(shrcore_64.o).

  41 
  42 // Note: all pointers to strings (path, member) point to strings which are immortal.
  43 struct loaded_module_t {
  44 
  45   // points to the full path of the lodaed module, e.g.
  46   // "/usr/lib/libC.a"
  47   const char* path;
  48 
  49   // host library name without path
  50   const char* shortname;
  51 
  52   // points to the object file (AIX specific stuff)
  53   // e.g "shrcore_64.o"
  54   const char* member;
  55 
  56   // text area from, to
  57   const void* text;
  58   size_t text_len;
  59 
  60   // data area from, to
  61   const void* data;
  62   size_t data_len;
  63 
  64   // true if this module is part of the vm
  65   bool is_in_vm;







































  66 
  67 }; // end LoadedLibraryModule
  68 
  69 // This class is a singleton holding a map of all loaded binaries
  70 // in the AIX process space.
  71 class LoadedLibraries
  72 // : AllStatic (including allocation.hpp just for AllStatic is overkill.)
  73 {
  74 






  75   public:
  76 
  77     // rebuild the internal module table. If an error occurs, internal module
  78     // table remains untouched.
  79     static bool reload();
  80 
  81     // check whether the given address points into the text segment of a
  82     // loaded module. Return true if this is the case.
  83     // Optionally, information about the module is returned (info)
  84     static bool find_for_text_address (
  85       const void* p,
  86       loaded_module_t* info // optional, leave NULL if not needed.
  87     );
  88 
  89     // check whether the given address points into the data segment of a
  90     // loaded module. Return true if this is the case.
  91     // Optionally, information about the module is returned (info)
  92     static bool find_for_data_address (
  93       const void* p,
  94       loaded_module_t* info // optional, leave NULL if not needed.
  95     );
  96 
  97     // output debug info
  98     static void print(outputStream* os);
  99 
 100 }; // end LoadedLibraries

 101 
 102 #endif // OS_AIX_VM_LOADLIB_AIX_HPP
--- EOF ---