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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:01:44+00:00 2026-06-12T03:01:44+00:00

In some iOS code, I have an C struct ivar on an object. One

  • 0

In some iOS code, I have an C struct ivar on an object. One of the members of this struct is of type double. If I, within a method, assign to this struct member, the debugger reports spurious values for the value of this struct member when I print the struct itself (as does the list view of variables), but when I print the struct member directly, (p structWithDouble.doubleMember), I get the right value. Furthermore, If I assign the value of this member to a local, automatic double var, I see the correct value in the list view and when printing.

I imagine this is an issue with LLDB, but it’s unsettling and frustrating. Is this a known issue? If so, is there a workaround?

Examples

typedef struct {
    double doubleMember;
} structWithDouble;

@interface MyClass : NSObject {
    structWithDouble structAsIvar;
}
@end

@implementation

- (void)someMethod {
    structAsIvar.doubleMember = 200.0;
    double localDouble = structAsIvar.doubleMember;
}

Inside someMethod:, the debugger variable list shows the following values:

structAsIvar.doubleMember (double) 1.65865e-307
localDouble               (double) 200

Over in LLDB, I get the following output when breaking in someMethod::

(lldb) p structAsIvar.doubleMember
(double) $4 = 200

(lldb) p structAsIvar
(structAsIvar) $5 = {
  (double) doublemember = 1.17244e-312
}

(lldb) p localDouble
(double) 200

(lldb) p self->structAsIvar.doubleMember
(double) 200

Update

I’ve found that none of this behavior happens when using GDB. Apparently LLDB just isn’t ready yet… I’m still be interested in a workaround for LLDB, though.

  • 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-12T03:01:46+00:00Added an answer on June 12, 2026 at 3:01 am

    It looks like this is fixed in Xcode 4.5’s lldb (lldb-167.2):

    (lldb)  p structAsIvar.doubleMember
    (double) $5 = 200
    (lldb)  p structAsIvar
    (structWithDouble) $6 = {
      (double) doubleMember = 200
    }
    (lldb) p localDouble
    (double) $7 = 200
    (lldb) p self->structAsIvar.doubleMember
    (double) $8 = 200
    (lldb) 
    

    I’m not sure exactly which release had the fix; it’s likely Xcode 4.4 also works correctly but I don’t have that at hand to test right now.

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

Sidebar

Related Questions

I have some code in my iOS app like this: URL *url = [NSURL
I have seen some iOS developpers using code like this : - (void)setupWebView:(UIWebView**)aWebView {
I use this code: [image setImage:[UIImage imageNamed:@some@2x.png]]; and it work on ios 4.3, but
I have some iOS 5 code that I am using to interface to an
I have copied some files across from one project to another. The code simply
I'm just getting started learning CoreData for iOS and have written some exploratory code
I have written a static library to re-use some code between iOS projects, let's
I have some Code that I'd like to share between an iOS and an
I have some Objective-C [i-os] code that I would like to run unit tests
I've opened up some old iOS code and when I try to build it

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.