aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.objc/objcdecode.m
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.objc/objcdecode.m')
-rw-r--r--gdb/testsuite/gdb.objc/objcdecode.m49
1 files changed, 49 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.objc/objcdecode.m b/gdb/testsuite/gdb.objc/objcdecode.m
new file mode 100644
index 0000000..5e99618
--- /dev/null
+++ b/gdb/testsuite/gdb.objc/objcdecode.m
@@ -0,0 +1,49 @@
+#include <objc/Object.h>
+
+@interface Decode: Object
+{
+}
+- multipleDef;
+- (const char *) myDescription;
+@end
+
+@implementation Decode
+
+- multipleDef
+{
+ printf("method multipleDef\n");
+ return self;
+}
+
+- (const char *) myDescription
+{
+ return "Decode gdb test object";
+}
+
+@end
+
+int
+multipleDef()
+{
+ printf("function multipleDef\n");
+ return 0;
+}
+
+int main (int argc, const char *argv[])
+{
+ id obj;
+ obj = [Decode new];
+ multipleDef();
+ [obj multipleDef];
+ return 0;
+}
+
+const char *_NSPrintForDebugger(id object)
+{
+ /* This is not really what _NSPrintForDebugger should do, but it
+ is a simple test if gdb can call this function */
+ if (object && [object respondsTo: @selector(myDescription)])
+ return [object myDescription];
+
+ return NULL;
+}