Showing posts with label objectivec. Show all posts
Showing posts with label objectivec. Show all posts

Wednesday, July 11, 2012

Power With LLDB Objective-C Debugger

I have come to realize there is a huge and powerful tool called the LLDB debugger which is used by Objective-C programmers now instead of gdb. In the past, I have used some of the commands of the gdb debugger, however this map at
http://lldb.llvm.org/lldb-gdb.html shows me a wonderful number of things at my disposal that I never knew existed in gdb.

The current command of interest is the replacement for gdb's info symbol command which shows "information for a raw address in the executable or any shared libraries"
(gdb) info symbol 0xa0b06174
That replacement in lldb is image lookup
(lldb) image lookup --address 0x1ec4
I highly recommend all Objective-C programmers skim http://lldb.llvm.org/lldb-gdb.html aka The LLDB Debugger command map and smile at all that you have available!


Update:

We ended up switching back to gdb. 


We were able to see the offending code once we switched back to gdb from lldb and applied what we could from http://coderslike.us/2009/05/05/finding-freeddeallocated-instances-of-objects/


The solution to the memory issue was:
  • create a UIColor
  • store that in a variable such as someUIColor
  • pull out from someUIColor.CGColor the CGColorRef and pass that on to whatever needs it

It seems that doing something like this is bad in ARC and one should use UIColor (which is an NSObject):

CGColorRef crashingColor = [[UIColor colorWithRed:1 green:1 blue:160.0/255.0 alpha:1] CGColor];

Sunday, April 1, 2012

Frames vs Bounds in UIView

In the context of UIView of the iOS, I came across frame and later came across bounds. To the casual observer, one may think they are the same. They are not.

I like how this stack overflow user, amattn, puts it in his post:


Here's the cheatsheet:

    • frame is where the view is (with respect to the superview)
    • bounds is where the view is allowed to draw (with respect to itself)

Also, 40 minutes and 50 seconds into the "4. Views (October 6, 2011) - HD" lecture by Stanford, discusses the difference in depth using a drawing which really helps. 


Sunday, November 7, 2010

Setting Up Objective-C on Windows

In seeking to learn more Objective-C and use my Windows OS (Vista), I learned there is set up work to do and figuring out the final compilation command.

First, I installed using the directions at http://wwwmain.gnustep.org/experience/Windows.html It was straightforward.

With Justin Voss' help, we landed on the following command to compile a test.m file that we created together:
gcc `gnustep-config --objc-flags` -L /usr/GNUstep/System/Library/Libraries/ test.m -lgnustep-base -lobjc

I am grateful to Justin and those who created GNUStep.