Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8356165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:06:07+00:00 2026-06-09T10:06:07+00:00

I am writing a crash back trace program for a course. The provided starter

  • 0

I am writing a crash back trace program for a course. The provided starter code gives us %eip upon a crash, and we are supposed to print the backtrace of the runtime stack.

The first step seems to be to get %ebp of the top stack, and our assignment says that there is “something accessible in C code that has a guaranteed fixed location relative to the current base pointer”.

The only thing I can think of would be the arguments to a function being stored at a fixed location above %ebp, but I cannot think of any possible way to use this information.

What is a way to find this %ebp with just C code (no inline assembly or anything)?

Any ponting in the right direction would be much appreciated! I’m on x86-32 bit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:06:09+00:00Added an answer on June 9, 2026 at 10:06 am

    I’m assuming that task is given for Linux/UNIX.

    The provided starter code gives us %eip upon a crash,

    So, you are now in the SIGSEGV handler and have eip from…. context – the third parameter of handler?

    First way:

    The signal handler is started on the stack of application; and if you will take address of some local variable, you will get pointer to the stack:

     void sigsegv_handler(int signo, siginfo_t *info, void *context)
     {
       int a;
       void * ptr = &a;
       void * ptr_epb = ptr+0x**; 
       // 0x** is an unknown offset, find in disassembly or in debugger
     }
    

    This is not generally “guaranteed fixed location relative to the current base pointer” if we are talking about generalized case (according to C programming language standard and/or some UNIX Specification this should be undefined behaviour). But for x86/x86_64; some fixed compiler; fixed set of compiler options; enabled frame pointer saving in stack, then this offset will be constant.

    Second way:

    Check ucontext.h (/usr/include/sys) and hack into it via third argument to handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a multithreaded program, which would crash when a particular exception was thrown.
I am writing a program to grade C++ code that students submit. Right now
I am writing a program for Bully Algorithm in Java Here is the code:
Writing Classic ASP code in JScript has a lot going for it: more humane
Writing documentation in html requires some code examples. What to do with characters that
Writing a python program, and I came up with this error while using the
When writing code, I often place debug messages in the code. The debug messages
I'm writing a bit of code that will open a MessageBox on a separate
I'm writing a wrapper in Java for a C++ program. The wrapper is done
I'm writing a plug-in for another program through an API. To save it's current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.