mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-21 05:05:48 +00:00
Update spp and build it with -fPIC
This commit is contained in:
parent
6c229ee54e
commit
54176fb2c0
@ -81,7 +81,6 @@ struct MACH0_(SObjcPropertyList) {
|
||||
/* struct SObjcProperty first; These structures follow inline */
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static mach0_ut get_pointer(mach0_ut p, ut32 *offset, ut32 *left, RBinFile *arch);
|
||||
static void copy_sym_name_with_namespace(char *class_name, char *read_name, RBinSymbol *sym);
|
||||
static void get_ivar_list_t(mach0_ut p, RBinFile *arch, RBinClass *klass);
|
||||
@ -92,17 +91,16 @@ static void get_class_ro_t(mach0_ut p, RBinFile *arch, ut32 *is_meta_class, RBin
|
||||
static void get_class_t(mach0_ut p, RBinFile *arch, RBinClass *klass, bool dupe);
|
||||
static void __r_bin_class_free(RBinClass *p);
|
||||
|
||||
static int is_thumb(RBinFile *arch) {
|
||||
static bool is_thumb(RBinFile *arch) {
|
||||
struct MACH0_(obj_t) *bin = (struct MACH0_(obj_t) *)arch->o->bin_obj;
|
||||
if (bin->hdr.cputype == 12) {
|
||||
if (bin->hdr.cpusubtype == 9) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static mach0_ut get_pointer(mach0_ut p, ut32 *offset, ut32 *left, RBinFile *arch) {
|
||||
mach0_ut r;
|
||||
mach0_ut addr;
|
||||
@ -147,7 +145,6 @@ static mach0_ut get_pointer(mach0_ut p, ut32 *offset, ut32 *left, RBinFile *arch
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static void copy_sym_name_with_namespace(char *class_name, char *read_name, RBinSymbol *sym) {
|
||||
if (!class_name) {
|
||||
class_name = "";
|
||||
@ -156,7 +153,6 @@ static void copy_sym_name_with_namespace(char *class_name, char *read_name, RBin
|
||||
sym->name = strdup (read_name);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static void get_ivar_list_t(mach0_ut p, RBinFile *arch, RBinClass *klass) {
|
||||
struct MACH0_(SIVarList) il;
|
||||
struct MACH0_(SIVar) i;
|
||||
@ -598,9 +594,7 @@ static void get_method_list_t(mach0_ut p, RBinFile *arch, char *class_name, RBin
|
||||
}
|
||||
#endif
|
||||
method->vaddr = m.imp;
|
||||
method->type = is_static
|
||||
? "FUNC"
|
||||
: "METH";
|
||||
method->type = is_static ? "FUNC" : "METH";
|
||||
if (is_thumb (arch)) {
|
||||
if (method->vaddr & 1) {
|
||||
method->vaddr >>= 1;
|
||||
@ -640,7 +634,6 @@ static void get_protocol_list_t(mach0_ut p, RBinFile *arch, RBinClass *klass) {
|
||||
if (!(r = get_pointer (p, &offset, &left, arch))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (r + left < r || r + sizeof (struct MACH0_(SProtocolList)) < r) {
|
||||
return;
|
||||
}
|
||||
@ -924,7 +917,6 @@ static mach0_ut get_isa_value() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static void get_class_t(mach0_ut p, RBinFile *arch, RBinClass *klass, bool dupe) {
|
||||
struct MACH0_(SClass) c = { 0 };
|
||||
const int size = sizeof (struct MACH0_(SClass));
|
||||
@ -940,7 +932,6 @@ static void get_class_t(mach0_ut p, RBinFile *arch, RBinClass *klass, bool dupe)
|
||||
return;
|
||||
}
|
||||
bigendian = arch->o->info->big_endian;
|
||||
|
||||
if (!(r = get_pointer (p, &offset, &left, arch))) {
|
||||
return;
|
||||
}
|
||||
@ -953,7 +944,6 @@ static void get_class_t(mach0_ut p, RBinFile *arch, RBinClass *klass, bool dupe)
|
||||
if (r + size > arch->size) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (left < size) {
|
||||
eprintf ("Cannot parse obj class info out of bounds\n");
|
||||
return;
|
||||
@ -1061,7 +1051,8 @@ RList *MACH0_(parse_classes)(RBinFile *arch) {
|
||||
bool is_found = false;
|
||||
mach0_ut p = 0;
|
||||
ut32 left = 0;
|
||||
int len, paddr;
|
||||
int len;
|
||||
ut64 paddr;
|
||||
bool bigendian;
|
||||
ut8 pp[sizeof (mach0_ut)] = {0};
|
||||
|
||||
@ -1071,7 +1062,7 @@ RList *MACH0_(parse_classes)(RBinFile *arch) {
|
||||
bigendian = obj->info->big_endian;
|
||||
|
||||
/* check if it's Swift */
|
||||
//ret = parse_swift_classes (arch);
|
||||
// ret = parse_swift_classes (arch);
|
||||
|
||||
// searching of section with name __objc_classlist
|
||||
if (!(sctns = r_bin_plugin_mach.sections (arch))) {
|
||||
@ -1112,13 +1103,11 @@ RList *MACH0_(parse_classes)(RBinFile *arch) {
|
||||
// eprintf ("RBinClass allocation error\n");
|
||||
goto get_classes_error;
|
||||
}
|
||||
|
||||
if (!(klass->methods = r_list_new ())) {
|
||||
// retain just for debug
|
||||
// eprintf ("RList<RBinField> allocation error\n");
|
||||
goto get_classes_error;
|
||||
}
|
||||
|
||||
if (!(klass->fields = r_list_new ())) {
|
||||
// retain just for debug
|
||||
// eprintf ("RList<RBinSymbol> allocation error\n");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2009-2016 - pancake */
|
||||
/* radare - LGPL - Copyright 2009-2017 - pancake */
|
||||
|
||||
#include <r_types.h>
|
||||
#include <r_util.h>
|
||||
|
@ -291,6 +291,6 @@ spp-sync sync-spp:
|
||||
git add spp
|
||||
|
||||
spp: spp-sync
|
||||
cd spp ; $(MAKE)
|
||||
CFLAGS=-fPIC $(MAKE) -C spp
|
||||
|
||||
.PHONY: spp
|
||||
|
@ -131,7 +131,7 @@ TAG_CALLBACK(spp_trace)
|
||||
{
|
||||
char b[1024];
|
||||
if (!echo[ifl]) return 0;
|
||||
snprintf(b, 1023, "echo '%s' >&2", buf);
|
||||
snprintf(b, 1023, "echo '%s' >&2 ", buf);
|
||||
system(b);
|
||||
return 0;
|
||||
}
|
||||
@ -199,7 +199,7 @@ TAG_CALLBACK(spp_include)
|
||||
TAG_CALLBACK(spp_if)
|
||||
{
|
||||
char *var = spp_var_get(buf);
|
||||
echo[ifl + 1] = (var && *var!='0' && *var != '\0')? 1: 0;
|
||||
echo[ifl + 1] = (var && *var != '0' && *var != '\0') ? 1 : 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
#define __BSD__ 1
|
||||
#define __UNIX__ 1
|
||||
#endif
|
||||
#if _WIN32 || __CYGWIN__ || MINGW32
|
||||
#if __WIN32__ || __CYGWIN__ || MINGW32
|
||||
#define __addr_t_defined
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if _WIN32 || MINGW32 && !__CYGWIN__
|
||||
#if __WIN32__ || MINGW32 && !__CYGWIN__
|
||||
#include <winsock.h>
|
||||
typedef int socklen_t;
|
||||
#undef USE_SOCKETS
|
||||
|
@ -216,7 +216,7 @@ retry:
|
||||
if (buf[0] == '\n' && printed) {
|
||||
buf++;
|
||||
}
|
||||
D printf (" ==> 2.1: continue(%s)\n", ptr2 + delta);
|
||||
D printf (" ==> 2.1: continue(%s)\n", buf);
|
||||
goto retry;
|
||||
} else {
|
||||
do_fputs (out, "\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user