Skip to content

Instantly share code, notes, and snippets.

View atomicbird's full-sized avatar

Tom Harrington atomicbird

View GitHub Profile
--- Color4.h ---
@interface Color4 : NSObject {
}
-(id) initWithRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
@end
--- Color4.m ---
// Assuming NSString *username, NSString *password, NSURLRequest *request...
NSData *authRawData = [[NSString stringWithFormat:@"%@:%@", username, password] dataUsingEncoding:NSUTF8StringEncoding];
NSString *authEncoded = [authRawData asBase64EncodedString];
[request setValue:[NSString stringWithFormat:@"Basic %@", authEncoded] forHTTPHeaderField:@"Authorization"];
==35777== 18 bytes in 1 blocks are possibly lost in loss record 650 of 3,892
==35777== at 0x1075CA: malloc_zone_malloc (vg_replace_malloc.c:198)
==35777== by 0xA54BD4: _strdup_internal (in /usr/lib/libobjc.A.dylib)
==35777== by 0xA594BD: __sel_registerName (in /usr/lib/libobjc.A.dylib)
==35777== by 0x3F9319: NSKeyValueMethodForPattern (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==35777== by 0x3FB0A0: +[NSObject(NSKeyValueCodingPrivate) _createMutableSetValueGetterWithContainerClassID:key:] (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==35777== by 0x3FAE7F: _NSKeyValueMutableSetGetterForClassAndKey (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==35777== by 0x3F881E: _NSKVONotifyingEnableForInfoAndKey (in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)
==35777== by 0x3F8407: -[NSKeyValueUnnestedProperty _isaForAutonotifying] (in /System/Library/Frameworks/Foundation.framework/
// - (id)initWithContentsOfURL:(NSURL *)url error:(NSError **)outError;
NSError *error;
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:wavURL error:&error];
// Warning: passing argument 2 of 'initWithContentsOfURL:error:' from distinct Objective-C type
(gdb) info sharedlibrary
The DYLD shared library state has been initialized from the executable's shared library information. All symbols should be present, but the addresses of some symbols may move when the program is executed, as DYLD may relocate library load addresses if necessary.
Requested State Current State
Num Basename Type Address Reason | | Source
| | | | | | | |
1 dyld - 0x8fe00000 dyld Y Y /usr/lib/dyld at 0x8fe00000 (offset 0x0) with prefix "__dyld_"
2 valgrind - 0x1000 exec Y Y /usr/local/bin/valgrind (offset 0x0)
3 libgcc_s.1.dylib - 0x96526000 dyld Y Y /usr/lib/libgcc_s.1.dylib at 0x96526000 (offset -0x69ada000)
4 libSystem.B.dylib - 0x9652e000 dyld Y Y /usr/lib/libSystem.B.dylib at 0x9652e000 (offset -0x69ad2000)
(commpage objfile is) /usr/lib/libSystem.B.dylib[LC_SEGMEN
// Define a debug-build-only NSLog wrapper. DLog printing will only happen in debug builds.
#ifdef DEBUG
#define DLog(...) NSLog(__VA_ARGS__)
#else
#define DLog(...)
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <sys/types.h>
#include <unistd.h>
// Return 1 if being debugged, 0 if not (or if debug status can't be determined).
int beingDebugged()
{