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 9004129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:49:56+00:00 2026-06-16T00:49:56+00:00

I want to replace following function calla with callb (Reference : Get call stack

  • 0

I want to replace following function calla with callb (Reference : Get call stack from any thread within C )

int calla()
{
   printf("Inside calla\n");
   printf("A1=%x\n",__builtin_return_address (0));
   printf("A2=%x\n",__builtin_return_address (1) );
   printf("A3=%x\n",__builtin_return_address (2) );
}


int callb()
{
   int i,j;
   j = stackdepth(); 
   for (i=0 ; i<j ;i++) 
   printf("%x\n",__builtin_return_address (i));
}

How to find the stack depth ?

  • 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-16T00:49:57+00:00Added an answer on June 16, 2026 at 12:49 am

    This only works with gcc, and on certain platforms. I could retype all the documentation here, but it’s easy enough to get: it’s section 6.48 of the gcc manual (info gcc) if you have version 4.7.2, at least, and it’s online here.

    Note the sentence “The level argument must be a constant integer.” which will make looping tricky.

    You cannot reliably get the stack height from __builtin_return_address, but according to the documention __builtin_frame_address will return 0 when you hit the top of the stack.

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

Sidebar

Related Questions

I get the following object as a paramter via a function call from a
I want to replace part of the following html text (excerpt of a huge
Following this thread: How to handle functions deprecation in library? I want to find
I want to replace the contents within a html element so I'm using the
I have the following Ajax call: function ajaxCall(soap, url){ // Post SOAP request. $.ajax({
I want to get an onload event working on my config object. The following
The following code produces bytecode output as string. I want to replace some lines
I Have Javascript Function and I Want to call it On each time user
I want to replace an url in a href with a call of a
I have the following script that I want output to the screen from. CREATE

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.