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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:38:49+00:00 2026-05-18T12:38:49+00:00

What would cause my program to pause on Xcode? I have no breakpoints set

  • 0

What would cause my program to pause on Xcode? I have no breakpoints set and when I execute my code, the gdb prompt appears on the command line. Does anybody have a quick advise for this.
The program itself does not crash and returns the right values. It just won’t stop execution.

To tell you a bit of what I am working on. I am going through some exercises from the Stephen Kochan Programming in Objective-C 2.0 book. The exercise where this happened is 8.6. The exercise asks to create a simple method that will create a rectangle object with the intersecting data between two other rectangles.

My main looks like:

#import "Rectangle.h"
#import "XYPoint.h"
#import <stdio.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    Rectangle *myRectangle = [[Rectangle alloc] init];
    XYPoint *myPoint = [[XYPoint alloc] init];
    Rectangle *secondRectangle = [[Rectangle alloc] init];
    XYPoint *secondPoint = [[XYPoint alloc] init];
    Rectangle *intersectRectangle;

    [myRectangle setWidth:100 andHeight:180];
    [myPoint setX:400 andY:300];
    [myRectangle setOrigin:myPoint];

    [secondRectangle setWidth:250 andHeight:75];
    [secondPoint setX:200 andY:420];
    [secondRectangle setOrigin:secondPoint];

    intersectRectangle = [myRectangle intersect:secondRectangle];

    NSLog(@"Width: %i, Height: %i", intersectRectangle.width, intersectRectangle.height);
    NSLog(@"With translated origin (%i, %i)", intersectRectangle.origin.x, intersectRectangle.origin.y);

    [myRectangle release];
    [myPoint release];
    [secondRectangle release];
    [secondPoint release];
    [intersectRectangle release];
    [pool drain];
    return 0;
}

And the method for the class like the following:

-(Rectangle *)intersect:(Rectangle *)rect{
    if (intersectingRect) {
        [intersectingRect release];
    }
    intersectingRect = [[Rectangle alloc] init];
    XYPoint *intersectPt = [[XYPoint alloc] init];
    int intersectWidth = 0;
    int intersectHeight = 0;
    int intersectX = 0;
    int intersectY = 0;

    if(origin.x < rect.origin.x) {
        if ((origin.x + width) > rect.origin.x) {
            if ((origin.x + width) > (rect.origin.x+rect.height)) {
                if (origin.y < rect.origin.y) {
                    if ((origin.y+height) > rect.origin.y) {
                        if ((origin.y + height) > (rect.origin.y + rect.height)) {
                            intersectWidth = rect.width;
                            intersectHeight = rect.height;
                            intersectX = rect.origin.x;
                            intersectY = rect.origin.y;
                        } else {
                            intersectWidth = rect.width;
                            intersectHeight = origin.y + height - rect.origin.y;
                            intersectX = rect.origin.x;
                            intersectY = rect.origin.y;
                        }
                    } else {
                        intersectWidth = 0;
                        intersectHeight = 0;
                        intersectX = 0;
                        intersectY = 0;
                    }
                } else if ((rect.origin.y + rect.height) > origin.y) {
                    if ((rect.origin.y + rect.height) > (origin.y + height)) {
                        intersectWidth = rect.width;
                        intersectHeight = height;
                        intersectX = rect.origin.x;
                        intersectY = origin.y;
                    } else {
                        intersectWidth = rect.width;
                        intersectHeight = rect.origin.y + rect.height - origin.y;
                        intersectX = rect.origin.x;
                        intersectY = origin.y;
                    }
                } else {
                    intersectWidth = 0;
                    intersectHeight = 0;
                    intersectX = 0;
                    intersectY = 0;
                }
            } else if (origin.y < rect.origin.y) {
                if ((origin.y + height) > rect.origin.y) {
                    if ((origin.y + height) > (rect.origin.y + rect.height)) {
                        intersectWidth = origin.x + width - rect.origin.x;
                        intersectHeight = rect.height;
                        intersectX = rect.origin.x;
                        intersectY = rect.origin.y;
                    } else {
                        intersectWidth = origin.x + width - rect.origin.x;
                        intersectHeight = origin.y + height - rect.origin.y;
                        intersectX = rect.origin.x;
                        intersectY = rect.origin.y;
                    }
                } else {
                    intersectWidth = 0;
                    intersectHeight = 0;
                    intersectX = 0;
                    intersectY = 0;
                }
            } else if ((rect.origin.y + rect.height) > origin.y) {
                if ((rect.origin.y + rect.height) < (origin.y + height)) {
                    intersectWidth = origin.x + width - rect.origin.x;
                    intersectHeight = rect.origin.y + rect.height - origin.y;
                    intersectX = rect.origin.x;
                    intersectY = origin.y;
                } else {
                    intersectWidth = origin.x + width - rect.origin.x;
                    intersectHeight = height;
                    intersectX = rect.origin.x;
                    intersectY = origin.y;
                }
            } else {
                intersectWidth = 0;
                intersectHeight = 0;
                intersectX = 0;
                intersectY = 0;
            }
        } else {
            intersectWidth = 0;
            intersectHeight =0;
            intersectX = 0;
            intersectY = 0;
        }
    } else if (origin.x < (rect.origin.x + rect.width)) {
        if ((origin.x + width) > (rect.origin.x + rect.width)) {
            if (origin.y < rect.origin.y) {
                if ((origin.y+height) > rect.origin.y) {
                    if ((origin.y + height) > (rect.origin.y + rect.height)) {
                        intersectWidth = rect.origin.x + rect.width - origin.x;
                        intersectHeight = rect.height;
                        intersectX = origin.x;
                        intersectY = rect.origin.y;
                    } else {
                        intersectWidth = rect.origin.x + rect.width - origin.x;
                        intersectHeight = origin.y + height - rect.origin.y;
                        intersectX = origin.x;
                        intersectY = rect.origin.y;
                    }
                } else {
                    intersectWidth = 0;
                    intersectHeight = 0;
                    intersectX = 0;
                    intersectY = 0;
                }
            } else if (origin.y < (rect.origin.y + rect.height)) {
                if ((origin.y + height) > (rect.origin.y + rect.height)) {
                    intersectWidth = rect.origin.x + rect.width - origin.x;
                    intersectHeight = rect.origin.y + rect.height - origin.y;
                    intersectX = origin.x;
                    intersectY = origin.y;
                } else {
                    intersectWidth = rect.origin.x + rect.width - origin.x;
                    intersectHeight = height;
                    intersectX = origin.x;
                    intersectY = origin.y;
                }
            } else {
                intersectWidth = 0;
                intersectHeight = 0;
                intersectX = 0;
                intersectY = 0;
            }
        } else if (origin.y < rect.origin.y) {
            if ((origin.y + height) > rect.origin.y) {
                if ((origin.y + height) > (rect.origin.y + rect.height)) {
                    intersectWidth = width;
                    intersectHeight = rect.height;
                    intersectX = origin.x;
                    intersectY = rect.origin.y;
                } else {
                    intersectWidth = width;
                    intersectHeight = origin.y + height - rect.origin.y;
                    intersectX = origin.x;
                    intersectY = rect.origin.y;
                }
            } else {
                intersectWidth = 0;
                intersectHeight = 0;
                intersectX = 0;
                intersectY = 0;
            }
        } else if (origin.y < (rect.origin.y + rect.height)) {
            if ((origin.y + height) > (rect.origin.y + rect.height)) {
                intersectWidth = width;
                intersectHeight = rect.origin.y + rect.height - origin.y;
                intersectX = origin.x;
                intersectY = origin.y;
            } else {
                intersectWidth = width;
                intersectHeight = height;
                intersectX = origin.x;
                intersectY = origin.y;
            }
        } else {
            intersectWidth = 0;
            intersectHeight = 0;
            intersectX = 0;
            intersectY = 0;
        }
    } else {
        intersectWidth = 0;
        intersectHeight = 0;
        intersectX = 0;
        intersectY = 0;
    }
    [intersectingRect setWidth:intersectWidth andHeight:intersectHeight];
    [intersectPt setX:intersectX andY:intersectY];
    [intersectingRect setOrigin:intersectPt];
    return intersectingRect;
}

The thing is that I don’t want to disable breakpoints altogether. I just don’t understand why the execution is being paused in this case since I am not setting any breakpoints. I don’t want to disable breakpoints because eventually I would like to use them. It is just this specific case that is unexpectedly pausing.

  • 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-18T12:38:50+00:00Added an answer on May 18, 2026 at 12:38 pm

    The program was for some reason trying to send a message to an object that was already released. Fixing the overload of the dealloc method solved the pause problem. The object that was being created inside the intersecting method was then being released by the overloaded dealloc method. Hence, when the main tried sending the message to release it, it was already gone.

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

Sidebar

Related Questions

I have a program which takes various command line arguments. For the sake of
Is there any reason why printw() would cause a segmentation fault? Code is fine
Would the code bellow cause my code to leak? More specifically, am I responsible
What would cause a Clojure program to not immediately exit upon finishing the last
I want to cause my program to pause for a certain number of milliseconds,
In a C++ program, I would like to have a long-only option with a
I would like to write a vulnerable program, to better understand Stack Overflow (causes)
So I am wondering what would cause it so that all events for the
Why/how does this create a seemingly infinite loop? Incorrectly, I assumed this would cause
What would possibly cause a 'git push' to try and commit to two branches?

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.