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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:02:20+00:00 2026-05-30T22:02:20+00:00

In the debugger (gdb and llvm), I usually do: po self po myIvar p

  • 0

In the debugger (gdb and llvm),

I usually do:

po self
po myIvar
p (CGPoint)whatEver

and works fine except when I am inside of a block. How can I access them in the debugger? I don’t like very much writing NSLogs everywhere …

I suppose inside blocks In the debugger I need to access ivars in a different way but I don’t know how 🙁

  • 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-30T22:02:21+00:00Added an answer on May 30, 2026 at 10:02 pm

    Blocks are their own environment when they’re executed. The neat thing about them is that they’ll capture any variables from the surrounding scope that you mention in their bodies. The flip side of that is that there’s no access to variables that aren’t captured.

    Take a look at this snippet:

    NSArray * a = [NSArray array];
    NSDictionary * d = [NSDictionary dictionary];
    NSString * s = @"This is my string. There are many others like it.";
    
    void (^myB)(NSInteger) = ^(NSInteger i){
        NSString * lS = [s lowercaseString];
        lS = [lS stringByReplacingOccurrencesOfString:@"many" withString:[NSString stringWithFormat:@"%ld", i]];
    /* Breakpoint here */    NSLog(@"%@", lS);
    };
    
    myB(7);
    

    The Block captures s and uses it. The NSInteger parameter, i, is also used and accessible inside the Block. The breakpoint gets hit when the Block is executed, though, which means that the creating scope, with the array a and dictionary d, no longer exists. You can see this if you look at the local variable display in Xcode:

    Local variable display of the Block

    Aside from globals, that’s all you or the debugger have access to when the Block is executing. If you really need to know the values of other variables during that time, I think you’ll have to mention them inside the Block. This will capture them, which will mean (for objects) they’ll be retained and then released when the Block is deallocated.

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

Sidebar

Related Questions

Where i can get binary file of GDB debugger for BusyBox under i386 architecture.
I'd like to use gdb or Xcode's debugger to watch every message sent to
Is there any debugger, like gdb or something else, aimed for C/C++, that runs
when I start GDB, I get the following error message in debugger: input:--- token
Recently I was debugging a project and the debugger (GDB 7.1) crashed all of
I'm using the gdb debugger to step through my code to verify my logic
I am attempting to use the gdb/mi debugger in the Eclipse CDT version 6.02.
Mono supports three different debuggers Gdb, mdb(mono debugger) and mono soft debugger. I want
In Xcode 4.3, now you can enable using LLDB as the debugger for iOS
Is it possible to get the gdb debugger to work with gcc-style nested functions?

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.