Questions tagged [stack-unwinding]

Stack-unwind will pop the top frame of the stack, depending on the language it may occur e.g. at the end of a code block, when returning from a called function, or during exception handling.

Stack-unwind will pop the top frame of the stack. Depending on the language this may occur e.g. at the end of a code block, when returning from a called function, or during exception handling.

Related tags: .

Related Q/A:

References:

128 questions
3
votes
7 answers

Exception handling

I heard people say exception handling is a bit expensive because of the stack unwinding. I don't get something, the stack unwinding happens whether I throw an exception and whether I use "return". So where is the difference? If for example I get a…
Idan
  • 5,717
  • 10
  • 47
  • 84
3
votes
2 answers

Why do malloc/new capture the callstack?

I have a 64bit application that runs as a service under Server 2003. When I attach the VS Profiler or windbg I see lots of callstacks like the one below. I understand that processes spawned in the debugger (or profiler) use the debug heap etc... But…
Benedetto
  • 711
  • 6
  • 17
2
votes
4 answers

Why aren't destructors called when exception isn't caught within main?

I have the following code: #include #include #include struct FooError {}; struct Foo { ~Foo() { std::cerr << "~Foo() executed" << std::endl; } explicit Foo(unsigned int index) { if (5 == index) throw…
bananov
  • 163
  • 1
  • 5
2
votes
1 answer

How to print stacktrace once an exception is thrown before the catch block (stack unwinding)

Let's say we have the following code: #include void funcA() { funcB(); } void funcB() { funcC(); } void funcC() { funcD(); } void funcD() { throw std::runtime_error("Exception!!"); //3 } void funcE() { int * p; …
Mazen Ak
  • 152
  • 7
2
votes
1 answer

On ARM macOS when explicitly raise()-ing a signal, some return addresses are garbled on the stack

Here's a simple program for ARM macOS that installs a signal handler for SIGSEGV, then generates one. In the signal handler function, the stack is walked with the usual frame pointer chasing algorithm, then the symbolized version is printed…
Donpedro
  • 828
  • 7
  • 22
2
votes
0 answers

How can linking a static library break C++ exception handling?

I had a recent problem where a thrown C++ exception was not caught and instead leads to program termination. My current MWE is: #include #include void foo(){ CUpti_SubscriberHandle subscriber; cuptiSubscribe(&subscriber,…
Flamefire
  • 5,313
  • 3
  • 35
  • 70
2
votes
2 answers

Why program cannot reach proper return instruction after stack unwinding?

Compiler: g++ 9.2.0 Operating system: Windows 10 g++ call: g++ -E main.cpp -v -o main.i g++ -c main.cpp -v -o main.o g++ main.o -v -o main.exe main.exe main.cpp: #include #include #include #include…
2
votes
2 answers

Why do we need the DWARF eh_frame emitted by compilers?

I have red that eh_frame is needed for stack unwinding during debugging or when our code hits an exception. Now my questions is, can't the debugger just walk the stack and figure out the boundaries between frames by looking for rbp being pushed or…
user12742950
2
votes
1 answer

Is it possible to generate unwind table on an object file

The background is that we have a prebuilt object file without unwind table, but somehow gcc unwind had problem backtracking on the object. Is it possible to generate unwind table without source code? Considering unwind table is based stack statics…
Bill Randerson
  • 1,028
  • 1
  • 11
  • 29
2
votes
2 answers

How do you conditionally modify a UINavigationController's back-stack to skip previous entries regardless of where you came from?

We're trying to figure out how to conditionally exclude certain screens in our back-stack when navigating backwards. For instance, take the following screens: Main Dashboard (You can go to 2 or 3 from here) Order Management (you can go to 3 or 6…
Mark A. Donohoe
  • 28,442
  • 25
  • 137
  • 286
2
votes
1 answer

Reaching unwind handlers

Any idea why code that looks like this list fooList; processList(&fooList); Generates the following machine code lea rax, [rbp-48] mov rdi, rax call processList(std::__cxx11::list >*) lea …
Paul Floyd
  • 5,530
  • 5
  • 29
  • 43
2
votes
0 answers

error C2712 Cannot use __try in functions that require object unwinding

I'm writing a simple C++ WIN32 API program that install&start a windows service. I'm using SEH __try&__finaly in my code. Unfortunately I'm getting a known error as below: error C2712 Cannot use __try in functions that require object unwinding. I…
user6691392
2
votes
1 answer

Native linking error could not create compact unwind for XXX does not use standard frame (MT5209)

I’m working on Xamarin and trying to install an iOS app on my iPad. I want to link an Ada static library. So I have a libMyLibrary.a + libgnat.a file and a C header code (MyLibrary.h). In Xamarin, I created a binding library project and added my…
LoneWanderer
  • 3,058
  • 1
  • 23
  • 41
2
votes
1 answer

How do you build libunwind on i386 FreeBSD?

libunwind is available as a package (pkg_add -r libunwind) on FreeBSD 8.1 amd64. It is not available that way on FreeBSD 8.1 i386. When I download from http://www.nongnu.org/libunwind/ I cannot build it. The error is In file included from…
lcbrevard
  • 263
  • 1
  • 12
2
votes
2 answers

Recursive search through tree without passing object

I'm trying to search for a node in a non-binary tree without actually passing a node to the search method. Each node has a name variable. The findChild() method takes a name, and searches through the tree it was called on to find the node with that…
Harry T
  • 131
  • 2
  • 12
1 2 3
8 9