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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:25:14+00:00 2026-06-11T01:25:14+00:00

I am attempting to debug a program that seems to be having issues with

  • 0

I am attempting to debug a program that seems to be having issues with pointer passing. I have a class defined as below:

class data{
public:
    data(int x, int y){
        a=x;
        b=y;
        md = new metadata();
    }
    ~data(){
        delete md;
    }

    int a;
    int b;

    metadata* md; //metadata is another class
};

and several functions that take a pointer to a data object:

void function1(data* d){
    //do stuff
}

void function2(data* d){
    //do stuff
    function1(d);
}

void function3(data* d){
    //do stuff
    function2(d);
}

int main(){
    //stuff
    data* data = new data(1,2);
    function3(d);
    //other stuff
}

I have a breakpoint set in function1 and one in function3. somewhere between these two breakpoints, md gets reassigned to point to a different metadata object (d, though, still points to the same memory address). There are thousands of lines executed between the two breakpoints, so its not really feasible to just step through, so I want to watch and break when the md pointer is changed. however, watch d->md for the breakboint in function1 does not work, as I get a message saying

Watchpoint 1 deleted because the program has left the block in which its expression is valid

which presumably occurs because in d is local to the context of the function. Is there a way to watch the memory address in which the md pointer is stored to see when it gets changed (i.e. when md is reassigned) and break there?

  • 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-11T01:25:16+00:00Added an answer on June 11, 2026 at 1:25 am

    Get the address of d->md using print d->md and watch the expression *((metadata *)0x....) instead of using the name d.

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

Sidebar

Related Questions

I have been attempting to debug my program, but it always seems to get
I have a program that crashes (attempting to read a bad memory address) while
I am attempting to debug a dll that is called by a Labview application.
I'm attempting to debug an R program, and I'm sorely missing the stop if
I'm attempting to debug a scala project remotely. Both the executing program (built and
I'm currently attempting to debug a solution that I've picked up as a side
I want to prevent VS from attempting to debug code that is not mine.
I have inherited an Adobe AIR application, and am attempting to debug it through
I am having a really hard time attempting to debug LINQ to SQL and
I am attempting to debug an Android application that uses native C code. I

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.