-
-
Save beelsebob/4557079 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // clang -framework Foundation -fobjc-arc test.m | |
| #include <Foundation/Foundation.h> | |
| @interface Foo : NSObject @end | |
| @implementation Foo | |
| + alloc | |
| { | |
| NSLog(@"in Foo alloc"); | |
| return (Foo *)@"yep"; | |
| } | |
| @end | |
| int main(int argc, char **argv) | |
| { | |
| NSLog(@"%@", [Foo alloc]); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Doom:~ tatd2$ clang -framework Foundation -fobjc-arc Foo.m | |
| Doom:~ tatd2$ gdb ./a.out | |
| GNU gdb 6.3.50-20050815 (Apple version gdb-1820) (Sat Jun 16 02:40:11 UTC 2012) | |
| Copyright 2004 Free Software Foundation, Inc. | |
| GDB is free software, covered by the GNU General Public License, and you are | |
| welcome to change it and/or distribute copies of it under certain conditions. | |
| Type "show copying" to see the conditions. | |
| There is absolutely no warranty for GDB. Type "show warranty" for details. | |
| This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ..... done | |
| (gdb) b +[Foo alloc] | |
| Breakpoint 1 at 0x100000e57 | |
| (gdb) r | |
| Starting program: /Users/tatd2/a.out | |
| Reading symbols for shared libraries ++++.............................................................. done | |
| Breakpoint 1, 0x0000000100000e57 in +[Foo alloc] () | |
| (gdb) b +[NSObject alloc] | |
| Breakpoint 2 at 0x7fff9114f76e | |
| (gdb) c | |
| Continuing. | |
| Breakpoint 2, 0x00007fff9114f76e in +[NSObject alloc] () | |
| (gdb) bt | |
| #0 0x00007fff9114f76e in +[NSObject alloc] () | |
| #1 0x00007fff94d08f46 in +[NSTimeZone timeZoneWithName:] () | |
| #2 0x00007fff94d08da5 in +[NSTimeZone systemTimeZone] () | |
| #3 0x00007fff94d089fd in +[NSTimeZone defaultTimeZone] () | |
| #4 0x00007fff94d2c775 in CFTimeZoneCopyDefault () | |
| #5 0x00007fff94d3cc97 in CFCalendarCreateWithIdentifier () | |
| #6 0x00007fff94d4fa50 in __CFLogCString () | |
| #7 0x00007fff94d4f97c in _CFLogvEx () | |
| #8 0x00007fff9025f625 in NSLogv () | |
| #9 0x00007fff9025f5be in NSLog () | |
| #10 0x0000000100000e61 in +[Foo alloc] () | |
| #11 0x0000000100000ebb in main () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment