8196401: PPC64+s390: get_frame_at_stack_banging_point uses wrong PC
authormdoerr
Wed, 31 Jan 2018 15:10:04 +0100
changeset 48821 8250a10cf60f
parent 48820 9a411a9a17f0
child 48822 8a9808a9dd6b
8196401: PPC64+s390: get_frame_at_stack_banging_point uses wrong PC Reviewed-by: stuefe, goetz
src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
--- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp	Wed Jan 31 11:35:42 2018 +0100
+++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp	Wed Jan 31 15:10:04 2018 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018 SAP SE. 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
@@ -111,6 +111,10 @@
   uc->uc_mcontext.jmp_context.iar = (uint64_t) new_pc;
 }
 
+static address ucontext_get_lr(const ucontext_t * uc) {
+  return (address)uc->uc_mcontext.jmp_context.lr;
+}
+
 ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
                                         intptr_t** ret_sp, intptr_t** ret_fp) {
 
@@ -167,7 +171,8 @@
       return false;
     } else {
       intptr_t* sp = os::Aix::ucontext_get_sp(uc);
-      *fr = frame(sp, (address)*sp);
+      address lr = ucontext_get_lr(uc);
+      *fr = frame(sp, lr);
       if (!fr->is_java_frame()) {
         assert(fr->safe_for_sender(thread), "Safety check");
         assert(!fr->is_first_frame(), "Safety check");
--- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp	Wed Jan 31 11:35:42 2018 +0100
+++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp	Wed Jan 31 15:10:04 2018 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2016 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018 SAP SE. 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
@@ -121,6 +121,10 @@
   uc->uc_mcontext.regs->nip = (unsigned long)pc;
 }
 
+static address ucontext_get_lr(const ucontext_t * uc) {
+  return (address)uc->uc_mcontext.regs->link;
+}
+
 intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
   return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
 }
@@ -178,9 +182,9 @@
       // the frame is complete.
       return false;
     } else {
-      intptr_t* fp = os::Linux::ucontext_get_fp(uc);
       intptr_t* sp = os::Linux::ucontext_get_sp(uc);
-      *fr = frame(sp, (address)*sp);
+      address lr = ucontext_get_lr(uc);
+      *fr = frame(sp, lr);
       if (!fr->is_java_frame()) {
         assert(fr->safe_for_sender(thread), "Safety check");
         assert(!fr->is_first_frame(), "Safety check");
--- a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp	Wed Jan 31 11:35:42 2018 +0100
+++ b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp	Wed Jan 31 15:10:04 2018 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016, 2017 SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018 SAP SE. 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
@@ -108,6 +108,10 @@
   uc->uc_mcontext.psw.addr = (unsigned long)pc;
 }
 
+static address ucontext_get_lr(const ucontext_t * uc) {
+  return (address)uc->uc_mcontext.gregs[14/*LINK*/];
+}
+
 intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
   return (intptr_t*)uc->uc_mcontext.gregs[15/*REG_SP*/];
 }
@@ -165,9 +169,9 @@
       // the frame is complete.
       return false;
     } else {
-      intptr_t* fp = os::Linux::ucontext_get_fp(uc);
       intptr_t* sp = os::Linux::ucontext_get_sp(uc);
-      *fr = frame(sp, (address)*sp);
+      address lr = ucontext_get_lr(uc);
+      *fr = frame(sp, lr);
       if (!fr->is_java_frame()) {
         assert(fr->safe_for_sender(thread), "Safety check");
         assert(!fr->is_first_frame(), "Safety check");