Sponsored Content
Top Forums Programming what is stack winding and stack unwinding Post 302130761 by porter on Tuesday 7th of August 2007 05:46:03 PM
Old 08-07-2007
Where this starts getting fun is when you have exceptions or setjmp/longjmp which let you unwind the stack without returning.

Some platforms also have "structured exception handling" (OS/2,Win32) which are basically a standardised way of stack unwinding in exceptional conditions.

Some platforms (eg 32bit PA-RISC) have a bottom-up stack rather than a top-down.
 

7 More Discussions You Might Find Interesting

1. Programming

The stack layout

I try to solve the problem https://www.unix.com/showthread.php?p=86595 use stack hack method, I am puzzled the stack layout. under vc6.0, the following code work(in release mode). #include <stdio.h> void change() { int x; int j; (&x) = 5; // if in debug mode, change to (&x) = 5;... (1 Reply)
Discussion started by: ChenMing
1 Replies

2. UNIX for Advanced & Expert Users

stack region

how can i determine that what percentage of stack region is currently is used? (i am using tru64 unix) (2 Replies)
Discussion started by: yakari
2 Replies

3. UNIX for Dummies Questions & Answers

memory stack

Hello everbody: when issuing the ulimit -a, on my tru64 machone, I get the following: root@billing4# ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) 10485760 stack(kbytes) 32768 memory(kbytes) 10190528 coredump(blocks) 0... (1 Reply)
Discussion started by: aladdin
1 Replies

4. Programming

Regarding stack analysis

I would like to know how I could do the following : void func(){ int a = 100; b=0; int c = a/b; } void sig_handler (int sig,siginfo_t *info,void *context){ //signal handling function //here I want to access the variables of func() } int main(){ struct sigaction *act =... (7 Replies)
Discussion started by: vpraveen84
7 Replies

5. UNIX for Dummies Questions & Answers

Kernel Stack vs User Mode Stack

Hi, I am new to the linux kernel development area. I want to know what is the difference between kernel mode stack and user mode stack? Does each process has a user mode stack and a kernel mode stack?? Or Each process has a user mode stack and there is only one kernel mode stack that is shared by... (4 Replies)
Discussion started by: saurabhkoar
4 Replies

6. Shell Programming and Scripting

Stack Trace

Hi All Thought it would be kind of fun to implement a stack trace for a shell script that calls functions within a sub shell. This is for bash under Linux and probably not portable - #! /bin/bash error_exit() { echo "=======================" echo $1 echo... (4 Replies)
Discussion started by: steadyonabix
4 Replies

7. UNIX for Dummies Questions & Answers

What happens to the stack?

Consider this bad code, edited in Windows and run via CygWin after dos2unix so be aware of any hidden "\r" charatcers... #!/bin/bash n=0 stackit() { eval $1 if then exit 0 fi n=$ echo "$n" stackit stackit } stackit stackit Run under CygWin:- AMIGA:~> cd /tmp AMIGA:/tmp>... (2 Replies)
Discussion started by: wisecracker
2 Replies
UNW_INIT_LOCAL(3)					       Programming Library						 UNW_INIT_LOCAL(3)

NAME
unw_init_local -- initialize cursor for local unwinding SYNOPSIS
#include <libunwind.h> int unw_init_local(unw_cursor_t *c, unw_context_t *ctxt); DESCRIPTION
The unw_init_local() routine initializes the unwind cursor pointed to by c with the machine-state in the context structure pointed to by ctxt. As such, the machine-state pointed to by ctxt identifies the initial stack frame at which unwinding starts. The machine-state must remain valid for the duration for which the cursor c is in use. The unw_init_local() routine can be used only for unwinding in the address space of the current process (i.e., for local unwinding). For all other cases, unw_init_remote() must be used instead. From a behavioral point of view, the call: ret = unw_init_local(&cursor, &ucontext); is equivalent to: ret = unw_init_remote(&cursor, unw_local_addr_space, &ucontext); However, unwind performance may be better when using unw_init_local(). Also, unw_init_local() is available even when UNW_LOCAL_ONLY has been defined before including <libunwind.h>, whereas unw_init_remote() is not. RETURN VALUE
On successful completion, unw_init_local() returns 0. Otherwise the negative value of one of the error-codes below is returned. THREAD AND SIGNAL SAFETY
unw_init_local() is thread-safe as well as safe to use from a signal handler. ERRORS
UNW_EINVAL unw_init_local() was called in a version of libunwind which supports remote unwinding only (this normally happens when calling unw_init_local() for a cross-platform version of libunwind). UNW_EUNSPEC An unspecified error occurred. UNW_EBADREG A register needed by unw_init_local() wasn't accessible. SEE ALSO
libunwind(3), unw_init_remote(3) AUTHOR
David Mosberger-Tang Email: dmosberger@gmail.com WWW: http://www.nongnu.org/libunwind/. Programming Library 16 August 2007 UNW_INIT_LOCAL(3)
All times are GMT -4. The time now is 08:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy