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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:56:41+00:00 2026-06-14T20:56:41+00:00

Looking at this question and this question I can see that for backtrace_symbols() to

  • 0

Looking at this question and this question I can see that for backtrace_symbols() to work, one must compile with the -rdynamic flag.

I’ve tried it into a test program and it works, but I’m writing a program that is also compiled with -static and this page says that backtrace_symbols() doesn’t work when -static is passed to the compiler/linker.

Is there any quick workaround to this or I’ll never have a human-readable backtrace function in my statically linked program?

  • 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-14T20:56:44+00:00Added an answer on June 14, 2026 at 8:56 pm

    The answer was already at hand: it was in the same page I linked in the question. At the end, I successfully used libunwind.

    #include <libunwind.h>
    #include <stdio.h>
    
    void do_backtrace()
    {
        unw_cursor_t    cursor;
        unw_context_t   context;
    
        unw_getcontext(&context);
        unw_init_local(&cursor, &context);
    
        while (unw_step(&cursor) > 0)
        {
            unw_word_t  offset, pc;
            char        fname[64];
    
            unw_get_reg(&cursor, UNW_REG_IP, &pc);
    
            fname[0] = '\0';
            (void) unw_get_proc_name(&cursor, fname, sizeof(fname), &offset);
    
            printf ("%p : (%s+0x%x) [%p]\n", pc, fname, offset, pc);
        }
    }
    
    int main()
    {
     do_backtrace();
     return 0;
    }
    

    I was getting linking errors because I was (again) forgotting to place linker options at the end of the command line. I really don’t understand why g++/gcc don’t issue at least a warning when ignoring command line options. The correct command line to compile is (-g isn’t needed):

    g++ -static unwind.cpp -o unwind -lunwind -lunwind-x86
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking at the Facebook iOS app, one can see that when in the feed
Thanks for looking at this question. I wanted to know how can I use
This question is about the public key that every .NET assembly has AFAIK (looking
I'm looking at an execution plan from a troublesome query. I can see that
Looking through PIL (and related to this question ), where can I get a
In looking at this question , commenter @Jon Egerton mentioned that MyClass was a
With this question I am mostly looking for answers from people that have implemented
How can one get records with highest/smallest per group? Former title of this question
I was looking at this question: Add additional data to a Highcharts series for
I was looking at this question. Basically having a leading zero causes the number

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.