src/hotspot/os/aix/loadlib_aix.cpp
author serb
Sun, 24 Jun 2018 16:35:21 -0700
changeset 50834 9cf279436b9d
parent 47216 71c04702a3d5
child 55683 b528b724b16d
permissions -rw-r--r--
8205153: Delete "standard instructions" machinery in the open automated tests Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     1
/*
46535
fc2445cc0e3d 8086005: Define __STDC_xxx_MACROS config macros globally via build system
kbarrett
parents: 35594
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
35594
cc13089c6327 8147937: Adapt SAP copyrights to new company name.
goetz
parents: 34647
diff changeset
     3
 * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     5
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     8
 * published by the Free Software Foundation.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     9
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    14
 * accompanied this code).
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    15
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    19
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    22
 * questions.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    23
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    24
 */
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    25
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    26
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    27
// Implementation of LoadedLibraries and friends
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    28
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    29
// Ultimately this just uses loadquery()
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    30
// See:
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    31
// http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    32
//      ?topic=/com.ibm.aix.basetechref/doc/basetrf1/loadquery.htm
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    33
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    34
#include "loadlib_aix.hpp"
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    35
#include "misc_aix.hpp"
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    36
#include "porting_aix.hpp"
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    37
#include "utilities/debug.hpp"
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    38
#include "utilities/ostream.hpp"
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    39
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    40
// For loadquery()
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    41
#include <sys/ldr.h>
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    42
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    43
// Use raw malloc instead of os::malloc - this code gets used for error reporting.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    44
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    45
// A class to "intern" eternal strings.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    46
// TODO: similar coding exists in AIX version of dladdr and potentially elsewhere: consolidate!
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    47
class StringList {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    48
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    49
  char** _list;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    50
  int _cap;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    51
  int _num;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    52
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    53
  // Enlarge list. If oom, leave old list intact and return false.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    54
  bool enlarge() {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    55
    int cap2 = _cap + 64;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    56
    char** l2 = (char**) ::realloc(_list, sizeof(char*) * cap2);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    57
    if (!l2) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    58
      return false;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    59
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    60
    _list = l2;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    61
    _cap = cap2;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    62
    return true;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    63
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    64
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    65
  // Append string to end of list.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    66
  // Returns NULL if oom.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    67
  char* append(const char* s) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    68
    if (_cap == _num) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    69
      if (!enlarge()) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    70
        return NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    71
      }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    72
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    73
    assert0(_cap > _num);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    74
    char* s2 = ::strdup(s);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    75
    if (!s2) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    76
      return NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    77
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    78
    _list[_num] = s2;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    79
    trcVerbose("StringDir: added %s at pos %d", s2, _num);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    80
    _num ++;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    81
    return s2;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    82
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    83
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    84
public:
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    85
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    86
  StringList()
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    87
    : _list(NULL)
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    88
    , _cap(0)
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    89
    , _num(0)
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    90
  {}
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    91
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    92
  // String is copied into the list; pointer to copy is returned.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    93
  // Returns NULL if oom.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    94
  char* add (const char* s) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    95
    for (int i = 0; i < _num; i++) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    96
      if (strcmp(_list[i], s) == 0) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    97
        return _list[i];
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    98
      }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    99
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   100
    return append(s);
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   101
  }
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   102
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   103
};
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   104
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   105
static StringList g_stringlist;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   106
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   107
//////////////////////
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   108
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   109
// Entries are kept in a linked list ordered by text address. Entries are not
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   110
// eternal - this list is rebuilt on every reload.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   111
// Note that we do not hand out those entries, but copies of them.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   112
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   113
struct entry_t {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   114
  entry_t* next;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   115
  loaded_module_t info;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   116
};
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   117
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   118
static void print_entry(const entry_t* e, outputStream* os) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   119
  const loaded_module_t* const lm = &(e->info);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   120
  os->print(" %c text: " INTPTR_FORMAT " - " INTPTR_FORMAT
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   121
            ", data: " INTPTR_FORMAT " - " INTPTR_FORMAT " "
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   122
            "%s",
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   123
      (lm->is_in_vm ? '*' : ' '),
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   124
      lm->text, (uintptr_t)lm->text + lm->text_len,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   125
      lm->data, (uintptr_t)lm->data + lm->data_len,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   126
      lm->path);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   127
  if (lm->member) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   128
    os->print("(%s)", lm->member);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   129
  }
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   130
}
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   131
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   132
static entry_t* g_first = NULL;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   133
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   134
static entry_t* find_entry_for_text_address(const void* p) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   135
  for (entry_t* e = g_first; e; e = e->next) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   136
    if ((uintptr_t)p >= (uintptr_t)e->info.text &&
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   137
        (uintptr_t)p < ((uintptr_t)e->info.text + e->info.text_len)) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   138
      return e;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   139
    }
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   140
  }
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   141
  return NULL;
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   142
}
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   143
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   144
static entry_t* find_entry_for_data_address(const void* p) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   145
  for (entry_t* e = g_first; e; e = e->next) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   146
    if ((uintptr_t)p >= (uintptr_t)e->info.data &&
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   147
        (uintptr_t)p < ((uintptr_t)e->info.data + e->info.data_len)) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   148
      return e;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   149
    }
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   150
  }
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   151
  return NULL;
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   152
}
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   153
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   154
// Adds a new entry to the list (ordered by text address ascending).
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   155
static void add_entry_to_list(entry_t* e, entry_t** start) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   156
  entry_t* last = NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   157
  entry_t* e2 = *start;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   158
  while (e2 && e2->info.text < e->info.text) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   159
    last = e2;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   160
    e2 = e2->next;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   161
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   162
  if (last) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   163
    last->next = e;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   164
  } else {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   165
    *start = e;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   166
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   167
  e->next = e2;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   168
}
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   169
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   170
static void free_entry_list(entry_t** start) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   171
  entry_t* e = *start;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   172
  while (e) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   173
    entry_t* const e2 = e->next;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   174
    ::free(e);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   175
    e = e2;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   176
  }
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   177
  *start = NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   178
}
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   179
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   180
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   181
// Rebuild the internal module table. If an error occurs, old table remains
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   182
// unchanged.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   183
static bool reload_table() {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   184
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   185
  bool rc = false;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   186
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   187
  trcVerbose("reload module table...");
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   188
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   189
  entry_t* new_list = NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   190
  const struct ld_info* ldi = NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   191
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   192
  // Call loadquery(L_GETINFO..) to get a list of all loaded Dlls from AIX. loadquery
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   193
  // requires a large enough buffer.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   194
  uint8_t* buffer = NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   195
  size_t buflen = 1024;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   196
  for (;;) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   197
    buffer = (uint8_t*) ::realloc(buffer, buflen);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   198
    if (loadquery(L_GETINFO, buffer, buflen) == -1) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   199
      if (errno == ENOMEM) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   200
        buflen *= 2;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   201
      } else {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   202
        trcVerbose("loadquery failed (%d)", errno);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   203
        goto cleanup;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   204
      }
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   205
    } else {
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   206
      break;
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   207
    }
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   208
  }
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   209
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   210
  trcVerbose("loadquery buffer size is %llu.", buflen);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   211
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   212
  // Iterate over the loadquery result. For details see sys/ldr.h on AIX.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   213
  ldi = (struct ld_info*) buffer;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   214
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   215
  for (;;) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   216
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   217
    entry_t* e = (entry_t*) ::malloc(sizeof(entry_t));
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   218
    if (!e) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   219
      trcVerbose("OOM.");
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   220
      goto cleanup;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   221
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   222
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   223
    memset(e, 0, sizeof(entry_t));
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   224
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   225
    e->info.text = ldi->ldinfo_textorg;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   226
    e->info.text_len = ldi->ldinfo_textsize;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   227
    e->info.data = ldi->ldinfo_dataorg;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   228
    e->info.data_len = ldi->ldinfo_datasize;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   229
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   230
    e->info.path = g_stringlist.add(ldi->ldinfo_filename);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   231
    if (!e->info.path) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   232
      trcVerbose("OOM.");
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   233
      goto cleanup;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   234
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   235
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   236
    // Extract short name
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   237
    {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   238
      const char* p = strrchr(e->info.path, '/');
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   239
      if (p) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   240
        p ++;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   241
        e->info.shortname = p;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   242
      } else {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   243
        e->info.shortname = e->info.path;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   244
      }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   245
    }
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   246
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   247
    // Do we have a member name as well (see ldr.h)?
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   248
    const char* p_mbr_name =
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   249
      ldi->ldinfo_filename + strlen(ldi->ldinfo_filename) + 1;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   250
    if (*p_mbr_name) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   251
      e->info.member = g_stringlist.add(p_mbr_name);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   252
      if (!e->info.member) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   253
        trcVerbose("OOM.");
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   254
        goto cleanup;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   255
      }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   256
    } else {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   257
      e->info.member = NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   258
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   259
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   260
    if (strcmp(e->info.shortname, "libjvm.so") == 0) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   261
      // Note that this, theoretically, is fuzzy. We may accidentally contain
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   262
      // more than one libjvm.so. But that is improbable, so lets go with this
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   263
      // solution.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   264
      e->info.is_in_vm = true;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   265
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   266
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   267
    trcVerbose("entry: %p %llu, %p %llu, %s %s %s, %d",
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   268
      e->info.text, e->info.text_len,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   269
      e->info.data, e->info.data_len,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   270
      e->info.path, e->info.shortname,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   271
      (e->info.member ? e->info.member : "NULL"),
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   272
      e->info.is_in_vm
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   273
    );
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   274
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   275
    // Add to list.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   276
    add_entry_to_list(e, &new_list);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   277
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   278
    // Next entry...
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   279
    if (ldi->ldinfo_next) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   280
      ldi = (struct ld_info*)(((char*)ldi) + ldi->ldinfo_next);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   281
    } else {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   282
      break;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   283
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   284
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   285
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   286
  // We are done. All is well. Free old list and swap to new one.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   287
  if (g_first) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   288
    free_entry_list(&g_first);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   289
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   290
  g_first = new_list;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   291
  new_list = NULL;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   292
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   293
  rc = true;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   294
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   295
cleanup:
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   296
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   297
  if (new_list) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   298
    free_entry_list(&new_list);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   299
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   300
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   301
  ::free(buffer);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   302
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   303
  return rc;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   304
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   305
} // end LoadedLibraries::reload()
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   306
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   307
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   308
///////////////////////////////////////////////////////////////////////////////
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   309
// Externals
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   310
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   311
static MiscUtils::CritSect g_cs;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   312
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   313
// Rebuild the internal module table. If an error occurs, old table remains
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   314
// unchanged.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   315
bool LoadedLibraries::reload() {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   316
  MiscUtils::AutoCritSect lck(&g_cs);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   317
  return reload_table();
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   318
}
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   319
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   320
void LoadedLibraries::print(outputStream* os) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   321
  MiscUtils::AutoCritSect lck(&g_cs);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   322
  if (!g_first) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   323
    reload_table();
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   324
  }
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   325
  for (entry_t* e = g_first; e; e = e->next) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   326
    print_entry(e, os);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   327
    os->cr();
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   328
  }
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   329
}
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   330
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   331
bool LoadedLibraries::find_for_text_address(const void* p,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   332
                                            loaded_module_t* info) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   333
  MiscUtils::AutoCritSect lck(&g_cs);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   334
  if (!g_first) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   335
    reload_table();
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   336
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   337
  const entry_t* const e = find_entry_for_text_address(p);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   338
  if (e) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   339
    if (info) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   340
      *info = e->info;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   341
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   342
    return true;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   343
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   344
  return false;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   345
}
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   346
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   347
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   348
bool LoadedLibraries::find_for_data_address (
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   349
  const void* p,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   350
  loaded_module_t* info // optional. can be NULL:
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   351
) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   352
  MiscUtils::AutoCritSect lck(&g_cs);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   353
  if (!g_first) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   354
    reload_table();
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   355
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   356
  const entry_t* const e = find_entry_for_data_address(p);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   357
  if (e) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   358
    if (info) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   359
      *info = e->info;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   360
    }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   361
    return true;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   362
  }
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   363
  return false;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   364
}
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   365