rizin/libr/bin/mangling/objc.c
Adam Pridgen db1bb1a089 Changed the location of RBinObject, and created RBinFile to conform similarly to
RCoreFile, where RBinFile contains meta information for RBinObjects.  Now
RBinFiles are swapped out along with the RCoreFile when the priority is changed.
2014-01-20 02:44:25 +01:00

33 lines
760 B
C

/* radare - LGPL - Copyright 2012 - pancake */
#include <r_bin.h>
R_API int r_bin_lang_objc(RBin *bin) {
RListIter *iter;
RBinSymbol *sym;
int hasobjc = R_FALSE;
char *dsym;
const char *ft;
if (!bin || !bin->cur->o || !bin->cur->o->info)
return 0;
ft = bin->cur->o->info->rclass;
if (!ft || (!strstr (ft, "mach") && !strstr (ft, "elf")))
return 0;
r_list_foreach (bin->cur->o->symbols, iter, sym) {
if (!hasobjc)
if (!strncmp (sym->name, "_OBJC_", 6))
hasobjc = R_TRUE;
dsym = r_bin_demangle_objc (bin, sym->name);
if (dsym) {
// Add type
free (dsym);
}
}
if (hasobjc)
bin->cur->o->info->lang = "objc";
// create class members and set method names
// iterate on symbols to conscruct class/methods
return hasobjc;
}