src/hotspot/os/aix/porting_aix.cpp
changeset 51139 c95334202a14
parent 47216 71c04702a3d5
child 53730 1d942423516c
equal deleted inserted replaced
51138:914f305ba6fa 51139:c95334202a14
   140 
   140 
   141   // .. (Note that is_readable_pointer returns true if safefetch stubs are not there yet;
   141   // .. (Note that is_readable_pointer returns true if safefetch stubs are not there yet;
   142   // in that case I try reading the traceback table unsafe - I rather risk secondary crashes in
   142   // in that case I try reading the traceback table unsafe - I rather risk secondary crashes in
   143   // error files than not having a callstack.)
   143   // error files than not having a callstack.)
   144 #define CHECK_POINTER_READABLE(p) \
   144 #define CHECK_POINTER_READABLE(p) \
   145   if (!MiscUtils::is_readable_pointer(p)) { \
   145   if (!os::is_readable_pointer(p)) { \
   146     trcVerbose("pc not readable"); \
   146     trcVerbose("pc not readable"); \
   147     return false; \
   147     return false; \
   148   }
   148   }
   149 
   149 
   150   codeptr_t pc2 = (codeptr_t) pc;
   150   codeptr_t pc2 = (codeptr_t) pc;
   228     if (tb->tb.name_present) {
   228     if (tb->tb.name_present) {
   229       // Copy name from text because it may not be zero terminated.
   229       // Copy name from text because it may not be zero terminated.
   230       const short l = MIN2<short>(*((short*)pc2), namelen - 1);
   230       const short l = MIN2<short>(*((short*)pc2), namelen - 1);
   231       // Be very careful.
   231       // Be very careful.
   232       int i = 0; char* const p = (char*)pc2 + sizeof(short);
   232       int i = 0; char* const p = (char*)pc2 + sizeof(short);
   233       while (i < l && MiscUtils::is_readable_pointer(p + i)) {
   233       while (i < l && os::is_readable_pointer(p + i)) {
   234         p_name[i] = p[i];
   234         p_name[i] = p[i];
   235         i++;
   235         i++;
   236       }
   236       }
   237       p_name[i] = '\0';
   237       p_name[i] = '\0';
   238 
   238 
   487 static void print_info_for_pc (outputStream* st, codeptr_t pc, char* buf,
   487 static void print_info_for_pc (outputStream* st, codeptr_t pc, char* buf,
   488                                size_t buf_size, bool demangle) {
   488                                size_t buf_size, bool demangle) {
   489   const struct tbtable* tb = NULL;
   489   const struct tbtable* tb = NULL;
   490   int displacement = -1;
   490   int displacement = -1;
   491 
   491 
   492   if (!MiscUtils::is_readable_pointer(pc)) {
   492   if (!os::is_readable_pointer(pc)) {
   493     st->print("(invalid)");
   493     st->print("(invalid)");
   494     return;
   494     return;
   495   }
   495   }
   496 
   496 
   497   if (AixSymbols::get_module_name((address)pc, buf, buf_size)) {
   497   if (AixSymbols::get_module_name((address)pc, buf, buf_size)) {
   695   st->print_cr("------ current frame:");
   695   st->print_cr("------ current frame:");
   696   st->print("iar:  " PTR64_FORMAT " ", p2i(cur_iar));
   696   st->print("iar:  " PTR64_FORMAT " ", p2i(cur_iar));
   697   print_info_for_pc(st, cur_iar, buf, buf_size, demangle);
   697   print_info_for_pc(st, cur_iar, buf, buf_size, demangle);
   698   st->cr();
   698   st->cr();
   699 
   699 
   700   if (cur_iar && MiscUtils::is_readable_pointer(cur_iar)) {
   700   if (cur_iar && os::is_readable_pointer(cur_iar)) {
   701     decode_instructions_at_pc(
   701     decode_instructions_at_pc(
   702       "Decoded instructions at iar:",
   702       "Decoded instructions at iar:",
   703       cur_iar, 32, 16, st);
   703       cur_iar, 32, 16, st);
   704   }
   704   }
   705 
   705 
   708   // preserved via lr register.
   708   // preserved via lr register.
   709   st->print("lr:   " PTR64_FORMAT " ", p2i(cur_lr));
   709   st->print("lr:   " PTR64_FORMAT " ", p2i(cur_lr));
   710   print_info_for_pc(st, cur_lr, buf, buf_size, demangle);
   710   print_info_for_pc(st, cur_lr, buf, buf_size, demangle);
   711   st->cr();
   711   st->cr();
   712 
   712 
   713   if (cur_lr && MiscUtils::is_readable_pointer(cur_lr)) {
   713   if (cur_lr && os::is_readable_pointer(cur_lr)) {
   714     decode_instructions_at_pc(
   714     decode_instructions_at_pc(
   715       "Decoded instructions at lr:",
   715       "Decoded instructions at lr:",
   716       cur_lr, 32, 16, st);
   716       cur_lr, 32, 16, st);
   717   }
   717   }
   718 
   718 
   727   st->cr();
   727   st->cr();
   728 
   728 
   729   // Check and print rtoc.
   729   // Check and print rtoc.
   730   st->print("rtoc: "  PTR64_FORMAT " ", p2i(cur_rtoc));
   730   st->print("rtoc: "  PTR64_FORMAT " ", p2i(cur_rtoc));
   731   if (cur_rtoc == NULL || cur_rtoc == (codeptr_t)-1 ||
   731   if (cur_rtoc == NULL || cur_rtoc == (codeptr_t)-1 ||
   732       !MiscUtils::is_readable_pointer(cur_rtoc)) {
   732       !os::is_readable_pointer(cur_rtoc)) {
   733     st->print("(invalid)");
   733     st->print("(invalid)");
   734   } else if (((uintptr_t)cur_rtoc) & 0x7) {
   734   } else if (((uintptr_t)cur_rtoc) & 0x7) {
   735     st->print("(unaligned)");
   735     st->print("(unaligned)");
   736   }
   736   }
   737   st->cr();
   737   st->cr();