Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions libr/arch/p/pyc/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,27 @@ static pyc_opcodes *get_pyc_opcodes(RArchSession *s) {
return ops;
}

static RList *get_pyc_code_obj(RArchSession *as) {
#if 0
struct pyc_version {
ut32 magic;
const char *version;
const char *revision;
};
typedef struct {
ut64 code_start_offset;
struct pyc_version version;
RList *sections_cache; // RList<RBinSection*>
RList *interned_table; // RList<char*>
RList *cobjs; // RList<pyc_code_object*>
} RBinPycObj;
#endif

static inline RList *get_pyc_code_obj(RArchSession *as) {
RBin *b = as->arch->binb.bin;
RBinPlugin *plugin = b->cur && b->cur->bo? b->cur->bo->plugin: NULL;
bool is_pyc = (plugin && strcmp (plugin->meta.name, "pyc") == 0);
return is_pyc? b->cur->bo->bin_obj: NULL;
RBinPlugin *plugin = R_UNWRAP4 (b, cur, bo, plugin);
const bool is_pyc = (plugin && !strcmp (plugin->meta.name, "pyc"));
RBinPycObj *pyc = is_pyc? b->cur->bo->bin_obj: NULL;
return pyc? pyc->cobjs: NULL;
}

static inline pyc_code_object *get_func(ut64 pc, RList *pyobj) {
Expand Down
18 changes: 18 additions & 0 deletions libr/arch/p/pyc/pyc_dis.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@
#include <r_util.h>
#include <r_asm.h>

#if 0
#include "../../bin/format/pyc/pyc_magic.h"
#else
struct pyc_version {
ut32 magic;
const char *version;
const char *revision;
};

typedef struct {
ut64 code_start_offset;
struct pyc_version version;
RList *sections_cache; // RList<RBinSection*>
RList *interned_table; // RList<char*>
RList *cobjs; // RList<pyc_code_object*>
} RBinPycObj;
#endif

#include "opcode.h"

typedef struct {
Expand Down
Loading
Loading