< prev index next >

src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp

Print this page

202  * Windows/x64 does not use stack frames the way expected by Java:
203  * [1] in most cases, there is no frame pointer. All locals are addressed via RSP
204  * [2] in rare cases, when alloca() is used, a frame pointer is used, but this may
205  *     not be RBP.
206  * See http://msdn.microsoft.com/en-us/library/ew5tede7.aspx
207  *
208  * So it's not possible to print the native stack using the
209  *     while (...) {...  fr = os::get_sender_for_C_frame(&fr); }
210  * loop in vmError.cpp. We need to roll our own loop.
211  */
212 bool os::win32::platform_print_native_stack(outputStream* st, const void* context,
213                                             char *buf, int buf_size, address& lastpc)
214 {
215   CONTEXT ctx;
216   if (context != nullptr) {
217     memcpy(&ctx, context, sizeof(ctx));
218   } else {
219     RtlCaptureContext(&ctx);
220   }
221 
222   st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)");
223 
224   STACKFRAME stk;
225   memset(&stk, 0, sizeof(stk));
226   stk.AddrStack.Offset    = ctx.Rsp;
227   stk.AddrStack.Mode      = AddrModeFlat;
228   stk.AddrFrame.Offset    = ctx.Rbp;
229   stk.AddrFrame.Mode      = AddrModeFlat;
230   stk.AddrPC.Offset       = ctx.Rip;
231   stk.AddrPC.Mode         = AddrModeFlat;
232 
233   // Ensure we consider dynamically loaded dll's
234   SymbolEngine::refreshModuleList();
235 
236   int count = 0;
237   address lastpc_internal = 0;
238   while (count++ < StackPrintLimit) {
239     intptr_t* sp = (intptr_t*)stk.AddrStack.Offset;
240     intptr_t* fp = (intptr_t*)stk.AddrFrame.Offset; // NOT necessarily the same as ctx.Rbp!
241     address pc = (address)stk.AddrPC.Offset;
242 

202  * Windows/x64 does not use stack frames the way expected by Java:
203  * [1] in most cases, there is no frame pointer. All locals are addressed via RSP
204  * [2] in rare cases, when alloca() is used, a frame pointer is used, but this may
205  *     not be RBP.
206  * See http://msdn.microsoft.com/en-us/library/ew5tede7.aspx
207  *
208  * So it's not possible to print the native stack using the
209  *     while (...) {...  fr = os::get_sender_for_C_frame(&fr); }
210  * loop in vmError.cpp. We need to roll our own loop.
211  */
212 bool os::win32::platform_print_native_stack(outputStream* st, const void* context,
213                                             char *buf, int buf_size, address& lastpc)
214 {
215   CONTEXT ctx;
216   if (context != nullptr) {
217     memcpy(&ctx, context, sizeof(ctx));
218   } else {
219     RtlCaptureContext(&ctx);
220   }
221 
222   st->print_cr("Native frames: (J=compiled Java code, A=AOT compiled, P=AOT preloaded, j=interpreted, Vv=VM code, C=native code)");
223 
224   STACKFRAME stk;
225   memset(&stk, 0, sizeof(stk));
226   stk.AddrStack.Offset    = ctx.Rsp;
227   stk.AddrStack.Mode      = AddrModeFlat;
228   stk.AddrFrame.Offset    = ctx.Rbp;
229   stk.AddrFrame.Mode      = AddrModeFlat;
230   stk.AddrPC.Offset       = ctx.Rip;
231   stk.AddrPC.Mode         = AddrModeFlat;
232 
233   // Ensure we consider dynamically loaded dll's
234   SymbolEngine::refreshModuleList();
235 
236   int count = 0;
237   address lastpc_internal = 0;
238   while (count++ < StackPrintLimit) {
239     intptr_t* sp = (intptr_t*)stk.AddrStack.Offset;
240     intptr_t* fp = (intptr_t*)stk.AddrFrame.Offset; // NOT necessarily the same as ctx.Rbp!
241     address pc = (address)stk.AddrPC.Offset;
242 
< prev index next >