Changeset 318


Ignore:
Timestamp:
Feb 16, 2012, 1:21:52 PM (9 years ago)
Author:
dmik
Message:

Port SymGetSymFromAddr? API usage to OS/2.

Location:
trunk/openjdk/hotspot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/hotspot/src/os/windows/vm/decoder_windows.cpp

    r309 r318  
    2929HMODULE                   Decoder::_dbghelp_handle = NULL;
    3030bool                      Decoder::_can_decode_in_vm = false;
    31 pfn_SymGetSymFromAddr64   Decoder::_pfnSymGetSymFromAddr64 = NULL;
     31pfn_SymGetSymFromAddrXX   Decoder::_pfnSymGetSymFromAddrXX = NULL;
    3232pfn_UndecorateSymbolName  Decoder::_pfnUndecorateSymbolName = NULL;
    3333
     
    4646    pfn_SymSetOptions _pfnSymSetOptions = (pfn_SymSetOptions)::GetProcAddress(handle, "SymSetOptions");
    4747    pfn_SymInitialize _pfnSymInitialize = (pfn_SymInitialize)::GetProcAddress(handle, "SymInitialize");
    48     _pfnSymGetSymFromAddr64 = (pfn_SymGetSymFromAddr64)::GetProcAddress(handle, "SymGetSymFromAddr64");
     48#ifdef __WIN32OS2__
     49    _pfnSymGetSymFromAddrXX = (pfn_SymGetSymFromAddrXX)::GetProcAddress(handle, "SymGetSymFromAddr");
     50#else
     51    _pfnSymGetSymFromAddrXX = (pfn_SymGetSymFromAddrXX)::GetProcAddress(handle, "SymGetSymFromAddr64");
     52#endif
    4953    _pfnUndecorateSymbolName = (pfn_UndecorateSymbolName)GetProcAddress(handle, "UnDecorateSymbolName");
    5054
    51     if (_pfnSymSetOptions == NULL || _pfnSymInitialize == NULL || _pfnSymGetSymFromAddr64 == NULL) {
    52       _pfnSymGetSymFromAddr64 = NULL;
     55    if (_pfnSymSetOptions == NULL || _pfnSymInitialize == NULL || _pfnSymGetSymFromAddrXX == NULL) {
     56      _pfnSymGetSymFromAddrXX = NULL;
    5357      _pfnUndecorateSymbolName = NULL;
    5458      ::FreeLibrary(handle);
     
    6064    _pfnSymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS);
    6165    if (!_pfnSymInitialize(GetCurrentProcess(), NULL, TRUE)) {
    62       _pfnSymGetSymFromAddr64 = NULL;
     66      _pfnSymGetSymFromAddrXX = NULL;
    6367      _pfnUndecorateSymbolName = NULL;
    6468      ::FreeLibrary(handle);
     
    8084void Decoder::uninitialize() {
    8185  assert(_initialized, "Decoder not yet initialized");
    82   _pfnSymGetSymFromAddr64 = NULL;
     86  _pfnSymGetSymFromAddrXX = NULL;
    8387  _pfnUndecorateSymbolName = NULL;
    8488  if (_dbghelp_handle != NULL) {
     
    96100Decoder::decoder_status Decoder::decode(address addr, char *buf, int buflen, int *offset) {
    97101  assert(_initialized, "Decoder not yet initialized");
    98   if (_pfnSymGetSymFromAddr64 != NULL) {
    99     PIMAGEHLP_SYMBOL64 pSymbol;
    100     char symbolInfo[MAX_PATH + sizeof(IMAGEHLP_SYMBOL64)];
    101     pSymbol = (PIMAGEHLP_SYMBOL64)symbolInfo;
     102  if (_pfnSymGetSymFromAddrXX != NULL) {
     103    PIMAGEHLP_SYMBOLXX pSymbol;
     104    char symbolInfo[MAX_PATH + sizeof(IMAGEHLP_SYMBOLXX)];
     105    pSymbol = (PIMAGEHLP_SYMBOLXX)symbolInfo;
    102106    pSymbol->MaxNameLength = MAX_PATH;
    103     pSymbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
    104     DWORD64 displacement;
    105     if (_pfnSymGetSymFromAddr64(::GetCurrentProcess(), (DWORD64)addr, &displacement, pSymbol)) {
     107    pSymbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOLXX);
     108    DWORDXX displacement;
     109    if (_pfnSymGetSymFromAddrXX(::GetCurrentProcess(), (DWORDXX)addr, &displacement, pSymbol)) {
    106110      if (buf != NULL) {
    107111        if (!demangle(pSymbol->Name, buf, buflen)) {
  • trunk/openjdk/hotspot/src/share/vm/utilities/decoder.hpp

    r317 r318  
    3333#include <imagehlp.h>
    3434
     35#ifdef __WIN32OS2__
     36#define DWORDXX DWORD
     37#define PDWORDXX PDWORD
     38#define IMAGEHLP_SYMBOLXX IMAGEHLP_SYMBOL
     39#define PIMAGEHLP_SYMBOLXX PIMAGEHLP_SYMBOL
     40#else
     41#define DWORDXX DWORD64
     42#define PDWORDXX PDWORD64
     43#define IMAGEHLP_SYMBOLXX IMAGEHLP_SYMBOL64
     44#define PIMAGEHLP_SYMBOLXX PIMAGEHLP_SYMBOL64
     45#endif
     46
    3547// functions needed for decoding symbols
    3648typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD);
    3749typedef BOOL  (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
    38 typedef BOOL  (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
     50typedef BOOL  (WINAPI *pfn_SymGetSymFromAddrXX)(HANDLE, DWORDXX, PDWORDXX, PIMAGEHLP_SYMBOLXX);
    3951typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD);
    4052
     
    93105  static HMODULE                   _dbghelp_handle;
    94106  static bool                      _can_decode_in_vm;
    95   static pfn_SymGetSymFromAddr64   _pfnSymGetSymFromAddr64;
     107  static pfn_SymGetSymFromAddrXX   _pfnSymGetSymFromAddrXX;
    96108  static pfn_UndecorateSymbolName  _pfnUndecorateSymbolName;
    97109#else
Note: See TracChangeset for help on using the changeset viewer.