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

  • Home
  • SEARCH
  • 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 5939051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:46:19+00:00 2026-05-22T15:46:19+00:00

I wrote a program which solves some kind of optimization problem. I have been

  • 0

I wrote a program which solves some kind of optimization problem. I have been running it with increasingly lower thresholds and I think I hit some kind of barrier since my program can’t get better results. It has been running for about 5 days…

However, I have some code in the program which saves its data if it is better than the threshold. Since I have no interest in running it for 5 days again I want to do it while the program is running, but sadly I didn’t compile it with -g (I am using gcc). What I am trying to do is change the threshold value to a higher value.

I did manage to connect to it using gdb, and see a stack frame. I am now inside a method, and I want to get access to the “this” pointer in order to change the threshold parameter. I tried examining values around the function’s address but nothing makes sense…
How do I find out where “this” points to?

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-05-22T15:46:19+00:00Added an answer on May 22, 2026 at 3:46 pm

    First, you don’t need to restart the program in order to debug it.

    You should rebuild it using exactly the same sources and flags you used originally and add -g. This will give you an executable that contains debug info, but otherwise is (almost) identical to the original binary. The output from nm a.out and nm a.out.debug should be very close (some minor differences are likely to be present, but will likely not affect debugging). Now run gdb a.out.debug <pid> and you should be able to do source-level debugging, and adjust your threshold.

    If this fails, you can still do what you want, but it will be harder: you’ll have to do that at the assembly level. You can run the a.out.debug (start a new task), and see in GDB disas output how parameters are passed to your routine, and how the threshold is accessed. You can then go back to your original executable, and observe essentially the same things happening there. Once you know where in memory the threshold is located, you’ll be able to adjust it in GDB.

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

Sidebar

Related Questions

I wrote a program which includes writing and reading from database. When I run
I wrote a program out, which was all in one file, and the methods
I'm planning to write a program in Ruby to analyse some data which has
I have a program, written in Java, which originally used its directory in Program
My objective is to write a program which will call another executable on a
Newbie here...can I write one program which incorporates .NET LINQ and also various Java
I want to write a program in which plays an audio file that reads
I would like to write a small program in C# which goes through my
I'm trying to write a simple program in VC++ which will just initialize the
I wrote a program in C with Ubuntu Linux and now I need to

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.