stack

Storing data below the stack pointer?

Looking at the disassembly (along with an instruction trace) of ld.so installed in Ubuntu 9.04, I swear I'm seeing data being stored below the stack pointer (i.e., beyond the top of the stack) at times. This seems insane to me, but maybe this is more common than I think. Does this happen often? Here's what I see: ebp: 0xBF8269E8, esp: ...

How to disable stack trace generation in a java program?

I want to disable the stack trace getting generated when an exception is thrown. I have used, Runtime.getRuntime().traceInstructions(false); Runtime.getRuntime().traceMethodCalls(false); but still i could see the trace getting generated. How can you do that? Also i need to detect whether some one is debugging my class. I want to di...

Design Question: How can I maintain a stack of object

I have a struct call 'A', which has an attribute 'i', like this: typedef struct a { a() { i = 0;} int i; } A; And I would like to maintain a stack of A in my Main class: class Main { public: void save(); void doSomethingToModifyCurrentA(); void restore(); private: A currentA; stack<A> aStack...

Stack calling convention between .NET & C on WinCE 6.0

Hi there. I'm porting a DLL written in C from WinCE 5.0 to WinCE 6.0 on an ARM target. This DLL is called by a .NET software. On WinCE5.0, everything runs fine. On WinCE6, I have the following problem: on InitInstance() of my DLL, I can call anything without problem (for example MessageBox()) or uses recursivity. Passed that point, th...

What is stack unwinding?

What is stack unwinding? Searched through but couldn't find enlightening answer! Thanks in advance. ...

How is stack size of process on linux related to pthread, fork and exec

Hi, guys. I have a question about the stack size of a process on Linux. Is this stack size determined at linkage time and is coded in the ELF file? I wrote a program which print its stack size by pthread_attr_getstacksize(&attr, &stacksize);. And if I run this program directly from shell, it gives a value of about 10MB. But when I exec i...

in C: Why does a stack allocated structure exist outside of the function?

my function: struct hostent * gethost(char * hostname){ if(/*some condition under which I want to change the mode of my program to not take a host*/){ return null } else{ struct hostent * host = gethostbyname(hostname); return host; } } in main: struct hostent * host = gethost(argv[2])...

getting starting address of a stack in assembly programming

is it possible to get the effective starting address of a stack after completing stack operations like push and pop in assembly programming? ...

Query on Stack pointer use in Assembly Language

Hi All, I was ready a article posted on wikipedia on Tail recursion: http://en.wikipedia.org/wiki/Tail_call Now here at the end of the article, the example shows Stack Pointer being used to access the arguments passed to the function call in the assembly pseudo code. Isn't this wrong? I mean the arguments are accessed by the callee by ...

Why can't I create a std::stack of std::ifstreams?

Why does the following not work: #include <iostream> #include <fstream> #include <stack> std::stack<std::ifstream> s; -PT ...

C++: High speed stack

As far as I assume, std::stack and all such 'handmade' stacks work much slower than stack which is applications one. Maybe there's a good low-level 'bicycle' already? (Stack realization). Or it's a good idea to create new thread and use it's own stack? And how can I work directly with application stack? (asm {} only?) ...

How does the gcc option -fstack-check exactly work?

My program crashed when I added the option -fstack-check and -fstack-protector. __stack_chk_fail is called in the back trace. So how could I know where the problem is ? What does -fstack-check really check ? The information about gcc seems too huge to find out the answer. ...

Aligning doubles on 8-byte boundaries?

Is there a common portable idiom in numerics code (I'm writing in D, but language-agnostic, C and C++ answers would be useful to me, too) to ensure that all stack-allocated doubles that are accessed frequently are aligned on 8-byte boundaries? I'm currently optimizing some numerics code where misaligned stack-allocated doubles (only ali...

C++/C/Java: Anagrams - from original string to target;

Hi there, I'm trying to solve this problem : http://uva.onlinejudge.org/external/7/732.html. For the given example, they give us the original word, for example TRIT and the target "anagramed" string, TIRT. Objective: We have to output all the valid sequences of 'i' and 'o' (push and pop's, respectively) which produce the target string ...

Embedded C++, any tips to avoid a local thats only used to return a value on the stack?

I have a local that's only used for the purposes of checking the result from another function and passing it on if it meets certain criteria. Most of the time, that criteria will never be met. Is there any way I can avoid this "extra" local? I only have about 1MB of storage for my binary, and I have several thousand function calls that...

Sum two graphs, when the second RRD file is started only now

I don't know how to explain my problem.... but I have two RRD files: a.rrd b.rrd I'm trying to sum both of the files and STACK them up in the graph. like: my $bla = RRDs::graph "-", "--title","Test", "--imgformat=PNG", "--width=680", "--height=200", "DEF:Default0_=a.rrd:default:AVERAGE", "DEF:Real0_=a.rrd:re...

What is an execution frame?

In C#, what is an execution frame (also related to this I have heard of activation frame). IIRC it is a slot where method parameters go but cannot remember all of the details. Thanks ...

misaligned_stack_error after moving some code into external framework (Cocoa)

I just moved a bunch of code into a separate framework. Nothing has changed in the code since the move and it compiles fine. However, on runtime, It crashes with "misaligned_stack_error". I've been looking around and some people are saying -mstackrealign fixes it, however I have added it to the C flags for both projects in Xcode and it s...

why gcc 4.x default reserve 8 bytes for stack on linux when calling a method?

as a beginner of asm, I am checking gcc -S generated asm code to learn. why gcc 4.x default reserve 8 bytes for stack when calling a method? func18 is the empty function with no return no param no local var defined. I can't figure out why 8 bytes is reserved here (neither any forum/site mention for the reason, ppl seems take it for g...

For buffer overflows, what is the stack address when using pthreads?

I'm taking a class in computer security and there is an extra credit assignment to insert executable code into a buffer overflow. I have the c source code for the target program I'm trying to manipulate, and I've gotten to the point where I can successfully overwrite the eip for the current function stack frame. However, I always get a S...