8147510: [windows] no text locations shown for register info in hs-err file
authorstuefe
Fri, 29 Jan 2016 09:21:15 +0100
changeset 35903 049dfbdc3ced
parent 35901 f5028c67e7cb
child 35904 ff8da306923e
8147510: [windows] no text locations shown for register info in hs-err file Reviewed-by: dholmes, iklam
hotspot/src/os/windows/vm/os_windows.cpp
hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Mon Feb 01 22:11:16 2016 +0100
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Fri Jan 29 09:21:15 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -5267,8 +5267,29 @@
 
 
 bool os::find(address addr, outputStream* st) {
-  // Nothing yet
-  return false;
+  int offset = -1;
+  bool result = false;
+  char buf[256];
+  if (os::dll_address_to_library_name(addr, buf, sizeof(buf), &offset)) {
+    st->print(PTR_FORMAT " ", addr);
+    if (strlen(buf) < sizeof(buf) - 1) {
+      char* p = strrchr(buf, '\\');
+      if (p) {
+        st->print("%s", p + 1);
+      } else {
+        st->print("%s", buf);
+      }
+    } else {
+        // The library name is probably truncated. Let's omit the library name.
+        // See also JDK-8147512.
+    }
+    if (os::dll_address_to_function_name(addr, buf, sizeof(buf), &offset)) {
+      st->print("::%s + 0x%x", buf, offset);
+    }
+    st->cr();
+    result = true;
+  }
+  return result;
 }
 
 LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Mon Feb 01 22:11:16 2016 +0100
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Fri Jan 29 09:21:15 2016 +0100
@@ -599,6 +599,7 @@
   // this is only for the "general purpose" registers
 
 #ifdef AMD64
+  st->print("RIP="); print_location(st, uc->Rip);
   st->print("RAX="); print_location(st, uc->Rax);
   st->print("RBX="); print_location(st, uc->Rbx);
   st->print("RCX="); print_location(st, uc->Rcx);
@@ -616,6 +617,7 @@
   st->print("R14="); print_location(st, uc->R14);
   st->print("R15="); print_location(st, uc->R15);
 #else
+  st->print("EIP="); print_location(st, uc->Eip);
   st->print("EAX="); print_location(st, uc->Eax);
   st->print("EBX="); print_location(st, uc->Ebx);
   st->print("ECX="); print_location(st, uc->Ecx);