libr: remove some unused variables and functions

This commit is contained in:
Riccardo Schirone 2016-04-26 14:59:18 +02:00
parent 33bc23cbb5
commit 26fc8f92ef
6 changed files with 1 additions and 75 deletions

View File

@ -353,36 +353,6 @@ static inline int cr16_print_reg_reg(struct cr16_cmd *cmd, ut8 src, ut8 dst)
return 0;
}
#if 0
// This function is unused, shall we remove it?
static int cr16_decode_stcbiti(const ut8 *instr, struct cr16_cmd *cmd)
{
int ret = 2;
ut8 dstreg;
ut16 in;
r_mem_copyendian((ut8*)&in, instr, 2, LIL_ENDIAN);
if (cr16_print_biti_opcode(cmd, in)) {
return -1;
}
dstreg = cr16_get_dstreg(in);
if (cr16_check_reg_boundaries(dstreg)) {
return -1;
}
if (cr16_print_short_reg(cmd, (in >> 1) & 0xF, cr16_get_dstreg(in))) {
return -1;
}
cmd->type = CR16_TYPE_BIT;
return ret;
}
#endif
static inline int cr16_print_4biti_opcode(struct cr16_cmd *cmd, ut16 instr)
{
if (cr16_check_instrs_4bit_bndrs(cr16_get_opcode_low(instr))) {

View File

@ -128,7 +128,6 @@ static void plugin_free(RAsmPlugin *p) {
R_API RAsm *r_asm_new() {
int i;
RAsmPlugin *static_plugin;
RAsm *a = R_NEW0 (RAsm);
if (!a) return NULL;
a->bits = 32;

View File

@ -622,7 +622,7 @@ static const char *skipnum(const char *s) {
static char *demangle_classname(const char *s) {
int modlen, len;
const char *kstr;
char *ret, *sym, *klass, *module;
char *ret, *klass, *module;
if (!strncmp (s, "_TtC", 4)) {
len = atoi (s + 4);
modlen = strlen (s + 4);

View File

@ -1292,7 +1292,6 @@ struct r_debug_plugin_t r_debug_plugin_native = {
#elif __x86_64__
.bits = R_SYS_BITS_32 | R_SYS_BITS_64,
.arch = "x86",
.canstep = 1,
#if __linux__
.canstep = 0, // XXX it's 1 on some platforms...
#else

View File

@ -520,53 +520,12 @@ int xnu_get_vmmap_entries_for_pid (pid_t pid) {
return n;
}
static int get_bits () {
#if __i386__ || __POWERPC__
return R_SYS_BITS_32;
#elif __x86_64__ || __mips__
return R_SYS_BITS_32 | R_SYS_BITS_64;
#elif __aarch64__
return R_SYS_BITS_16 | R_SYS_BITS_32 | R_SYS_BITS_64;
#elif __arm__
return R_SYS_BITS_16 | R_SYS_BITS_32;
#else
return 0;
#warning Unsupported architecture
#endif
}
static int xnu_get_bits_with_sysctl (pid_t pid) {
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 0 };
size_t len = 4;
struct kinfo_proc kp;
size_t kinfo_size = sizeof (kp);
mib[3] = pid;
if (sysctl (mib, len, &kp, &kinfo_size, NULL, 0) == -1) {
perror ("sysctl");
return -1;
}
#if __arm__ || __aarch64__
return (kp.kp_proc.p_flag & P_LP64) ?
R_SYS_BITS_16 | R_SYS_BITS_32 | R_SYS_BITS_64
: R_SYS_BITS_16 | R_SYS_BITS_32;
#else
return (kp.kp_proc.p_flag & P_LP64) ?
R_SYS_BITS_32 | R_SYS_BITS_64
: R_SYS_BITS_32;
#endif
}
#define xwr2rwx(x) ((x&1)<<2) | (x&2) | ((x&4)>>2)
#define COMMAND_SIZE(segment_count,segment_command_sz,\
thread_count,tstate_size)\
segment_count * segment_command_sz + thread_count * \
sizeof (struct thread_command) + tstate_size * thread_count
/* RDebug doesnt set the bits. FIXME when that is done */
#define SAME_BITNESS(proc_pid)\
(get_bits () == xnu_get_bits_with_sysctl (proc_pid))
static void get_mach_header_sizes(size_t *mach_header_sz,
size_t *segment_command_sz) {
#if __ppc64__ || __x86_64__

View File

@ -14,7 +14,6 @@ static RParsePlugin *parse_static_plugins[] =
R_API RParse *r_parse_new() {
int i;
RParsePlugin *static_plugin;
RParse *p = R_NEW0 (RParse);
if (!p) return NULL;
p->parsers = r_list_new ();