stackframe

Determining which code line threw the exception

孤街浪徒 提交于 2019-11-30 05:46:10
问题 In dotNet a line throws an exception and is caught, how can I figure out which line in which file threw the exception? Seems relatively straightforward, but I can't figure it out... 回答1: You can only do it if you have debug symbols available. catch(Exception ex) { // check the ex.StackTrace property } If you want to debug such a situation in VS, you'd better just check Thrown checkbox for Common Language Runtime Exceptions in Exceptions dialog located in Debug menu. The debugger will break as

Is the gcc insane optimisation level (-O3) not insane enough?

妖精的绣舞 提交于 2019-11-30 03:18:54
问题 As part of answering another question, I wanted to show that the insane level of optimisation of gcc ( -O3 ) would basically strip out any variables that weren't used in main. The code was: #include <stdio.h> int main (void) { char bing[71]; int x = 7; bing[0] = 11; return 0; } and the gcc -O3 output was: .file "qq.c" .text .p2align 4,,15 .globl main .type main, @function main: pushl %ebp xorl %eax, %eax movl %esp, %ebp popl %ebp ret .size main, .-main .ident "GCC: (Ubuntu 4.4.3-4ubuntu5) 4.4

how to expand size of Java stack trace to see bottom of stack? (triggering a stack overflow)

随声附和 提交于 2019-11-29 09:36:55
In Java, is there any way to view the complete, untruncated stack trace (e.g. by increasing the number of frames recorded), or otherwise get at the bottom of a stack trace? Normally the stack trace is truncated from the top at 1024 frames worth, but for a stack overflow problem this is fairly worthless as you really need to see who made the call that triggered the recursion, down near the bottom. Much better would truncation in the middle of the stack, but evidently Sun's JVM isn't smart enough to do this. Perhaps even some special Sun-specific flags? I tried reducing the stack size to the

Is there a simple way to obtain all the local variables in the current stack frame in C# (or CIL)

断了今生、忘了曾经 提交于 2019-11-29 02:09:36
Following my previous question, in which I wanted to dump all the variables in the stack (from the current and all the previous frame) that can be seen here: Is there a way to examine the stack variables at runtime in C#? I was suggested to intercept the calls manually or use AOP framework like PostSharp to simplify such a task. I looked at PostSharp and the interception arguments don't include the variables in the current stack frame. I wonder if there is a simple way to automatically get all the local variables in the current stack frame. I suppose I can perform code analysis and generate

x86_64 : is stack frame pointer almost useless?

£可爱£侵袭症+ 提交于 2019-11-28 09:11:04
Linux x86_64. gcc 5.x I was studying the output of two codes, with -fomit-frame-pointer and without (gcc at "-O3" enables that option by default). pushq %rbp movq %rsp, %rbp ... popq %rbp My question is : If I globally disable that option, even for, at the extreme, compiling an operating system, is there a catch ? I know that interrupts use that information, so is that option good only for user space ? The compilers always generate self consistent code, so disabling the frame pointer is fine as long as you don't use external/hand crafted code that makes some assumption about it (e.g. by

how to expand size of Java stack trace to see bottom of stack? (triggering a stack overflow)

可紊 提交于 2019-11-28 03:21:11
问题 In Java, is there any way to view the complete, untruncated stack trace (e.g. by increasing the number of frames recorded), or otherwise get at the bottom of a stack trace? Normally the stack trace is truncated from the top at 1024 frames worth, but for a stack overflow problem this is fairly worthless as you really need to see who made the call that triggered the recursion, down near the bottom. Much better would truncation in the middle of the stack, but evidently Sun's JVM isn't smart

What are the ESP and the EBP registers?

[亡魂溺海] 提交于 2019-11-27 12:46:42
问题 I found that the ESP register is the current stack pointer and EBP is the base pointer for the current stack frame. However, I don't understand these definitions (I am just starting to learn how to code in assembler). What I understand is that ESP points towards the stack itself and EBP points towards whatever is on top of the stack 1 . But these are just my guesses and they are most likely incorrect. Otherwise, what would a statement like the following mean? MOV EBP, ESP Footnote 1: Editor's

GetEntryAssembly for web applications

耗尽温柔 提交于 2019-11-27 04:27:59
Assembly.GetEntryAssembly() does not work for web applications. But... I really need something like that. I work with some deeply-nested code that is used in both web and non-web applications. My current solution is to browse the StackTrace to find the first called assembly. /// <summary> /// Version of 'GetEntryAssembly' that works with web applications /// </summary> /// <returns>The entry assembly, or the first called assembly in a web application</returns> public static Assembly GetEntyAssembly() { // get the entry assembly var result = Assembly.GetEntryAssembly(); // if none (ex: web

x86_64 : is stack frame pointer almost useless?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 02:41:58
问题 Linux x86_64. gcc 5.x I was studying the output of two codes, with -fomit-frame-pointer and without (gcc at "-O3" enables that option by default). pushq %rbp movq %rsp, %rbp ... popq %rbp My question is : If I globally disable that option, even for, at the extreme, compiling an operating system, is there a catch ? I know that interrupts use that information, so is that option good only for user space ? 回答1: The compilers always generate self consistent code, so disabling the frame pointer is

What is a stack map frame

穿精又带淫゛_ 提交于 2019-11-27 02:32:30
I've recently been looking at The Java Virtual Machine Specifications (JVMS) to try to better understand the what makes my programs work, but I've found a section that I'm not quite getting... Section 4.7.4 describes the StackMapTable Attribute, and in that section the document goes into details about stack map frames. The issue is that it's a little wordy and I learn best by example; not by reading. I understand that the first stack map frame is derived from the method descriptor, but I don't understand how (which is supposedly explained here .) Also, I don't entirely understand what the