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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:23:11+00:00 2026-06-10T08:23:11+00:00

I have some legacy C++ code that hasn’t been maintained in years. I’m trying

  • 0

I have some legacy C++ code that hasn’t been maintained in years. I’m trying to learn how it functions at the moment. It takes .xml input and should spit out an output text file. Two different .xml input files take vastly different amounts of time to process, and one of them behaves properly, the other doesn’t. They begin the same though. I’d like to output log files of the function calls made when I execute the code with the two different inputs and diff these logs against one another to see where they begin to diverge. I can’t just interrupt the code right at the first line of main() and step my way through the control flow in gdb. It’s taking way too long. Ideally, I’d like to find a way to do something like


gdb --args old_exec inp1.xml -step >log1.txt
gdb --args old_exec inp2.xml -step >log2.txt
diff log1.txt log2.txt

The “-step” flag isn’t real, of course, but maybe some way to tell it to log all the steps does exist. Any thoughts? Thanks!

  • 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-10T08:23:13+00:00Added an answer on June 10, 2026 at 8:23 am

    The GCC compiler has a flag, -finstrument-functions, which causes your functions to call specific functions on entry and exit; you can use this to track your code flow. With this flag in use, you will need to provide the following functions:

    void __cyg_profile_func_enter (void *this_fn, void *call_site);
    void __cyg_profile_func_exit  (void *this_fn, void *call_site);
    

    and keep in mind that when you compile those functions, they must not be compiled with the intrumentation flag!

    You can use addr2line to convert pointers to file/function/line numbers. It would generally be better to record the raw pointers at run-time, and perform post mortem address conversion.

    See http://balau82.wordpress.com/2010/10/06/trace-and-profile-function-calls-with-gcc/ for more details.

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

Sidebar

Related Questions

I have some legacy C++ code that I am trying to understand a bit
I have some legacy code with a legacy function that takes a filename as
I have been working on some legacy C++ code that uses variable length structures
I have some legacy code that I am now trying to re-use under Spring.
I have some legacy code that was used to monitor my applications cpu,memory etc
We have some legacy ASP.NET code that detects if a request is secure, and
I have some legacy code that contains this typedef: typedef enum simple_op_enum { #define
I have some legacy code that uses Interlocked.Equals to compare values. The values may
Currently I have some legacy ASP.NET 2.0 code that uses the ASP Xml web
I have the following function from some legacy code that I am maintaining. long

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.