Files
binutils-gdb/gdb/testsuite/gdb.objc/objcdecode.m
Tom Tromey df25394884 Make the gdb.objc tests compile
The gdb.objc tests haven't compiled in years.  This patch fixes this,
based on a comment in bug 31671.

I don't know whether this approach works with the clang implementation
of Objective-C.  However, it does work with GCC, provided that
gnustep-base is installed.
2025-12-02 09:22:45 -07:00

51 lines
739 B
Objective-C

#include <stdio.h>
#include <Foundation/NSObject.h>
@interface Decode: NSObject
{
}
- 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)
return [object myDescription];
return NULL;
}