mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-09 20:04:49 +00:00
* Fix build with clang
* Fix some warnings which result in more bugfixes. yay
This commit is contained in:
parent
16866fe504
commit
32afad2b65
@ -287,7 +287,7 @@ static void rabin_show_classes() {
|
||||
}
|
||||
}
|
||||
|
||||
static int rabin_show_symbols() {
|
||||
static int rabin_show_symbols(ut64 at) {
|
||||
RList *symbols;
|
||||
RListIter *iter;
|
||||
RBinSymbol *symbol;
|
||||
@ -377,7 +377,7 @@ static int rabin_show_strings() {
|
||||
return R_TRUE;
|
||||
}
|
||||
|
||||
static int rabin_show_sections() {
|
||||
static int rabin_show_sections(ut64 at) {
|
||||
RList *sections;
|
||||
RListIter *iter;
|
||||
RBinSection *section;
|
||||
@ -639,7 +639,7 @@ static int rabin_do_operation(const char *op) {
|
||||
return R_TRUE;
|
||||
}
|
||||
|
||||
static int rabin_show_srcline() {
|
||||
static int rabin_show_srcline(ut64 at) {
|
||||
char *srcline;
|
||||
if ((srcline = r_bin_meta_get_source_line (bin, at))) {
|
||||
printf ("%s\n", srcline);
|
||||
@ -862,9 +862,9 @@ int main(int argc, char **argv) {
|
||||
if (action&ACTION_MAIN)
|
||||
rabin_show_main ();
|
||||
if (action&ACTION_IMPORTS)
|
||||
rabin_show_imports (at);
|
||||
rabin_show_imports ();
|
||||
if (action&ACTION_CLASSES)
|
||||
rabin_show_classes (at);
|
||||
rabin_show_classes ();
|
||||
if (action&ACTION_SYMBOLS)
|
||||
rabin_show_symbols (at);
|
||||
if (action&ACTION_STRINGS)
|
||||
@ -874,11 +874,11 @@ int main(int argc, char **argv) {
|
||||
if (action&ACTION_FIELDS)
|
||||
rabin_show_fields();
|
||||
if (action&ACTION_LIBS)
|
||||
rabin_show_libs();
|
||||
rabin_show_libs ();
|
||||
if (action&ACTION_RELOCS)
|
||||
rabin_show_relocs();
|
||||
rabin_show_relocs ();
|
||||
if (action&ACTION_SRCLINE)
|
||||
rabin_show_srcline(at);
|
||||
rabin_show_srcline (at);
|
||||
if (action&ACTION_EXTRACT)
|
||||
rabin_extract ((arch==NULL && arch_name==NULL && bits==0));
|
||||
if (op != NULL && action&ACTION_OPERATION)
|
||||
|
@ -21,7 +21,7 @@ int main() {
|
||||
r_cons_fgets (buf, sizeof (buf), 0, NULL);
|
||||
r_cons_printf ("%s\n", buf);
|
||||
r_cons_flush ();
|
||||
if (strstr (buf, "exit"));
|
||||
if (strstr (buf, "exit"))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -158,16 +158,11 @@ static int r_debug_bf_kill(RDebug *dbg, boolt thread, int sig) {
|
||||
return R_TRUE;
|
||||
}
|
||||
|
||||
static int r_debug_native_bp(RDebug *dbg, int add, ut64 addr, int hw, int rwx) {
|
||||
eprintf ("TODO: breakpoints not implemented in brainfuck debugger. use dcu\n");
|
||||
return R_FALSE;
|
||||
}
|
||||
|
||||
static RList *r_debug_native_map_get(RDebug *dbg) {
|
||||
RIOBfdbg *o = dbg->iob.io->fd->data;
|
||||
BfvmCPU *c = o->bfvm;
|
||||
RList *list = r_list_new ();
|
||||
list->free = r_debug_map_free;
|
||||
list->free = (RListFree)r_debug_map_free;
|
||||
r_list_append (list, r_debug_map_new (
|
||||
"code", 0, 4096, 6, 0));
|
||||
r_list_append (list, r_debug_map_new (
|
||||
@ -197,7 +192,6 @@ struct r_debug_plugin_t r_debug_plugin_bf = {
|
||||
.threads = NULL,
|
||||
.kill = r_debug_bf_kill,
|
||||
.frames = NULL,
|
||||
.map_get = NULL, // TODO ?
|
||||
.breakpoint = &r_debug_bf_breakpoint,
|
||||
.reg_read = &r_debug_bf_reg_read,
|
||||
.reg_write = &r_debug_bf_reg_write,
|
||||
|
@ -38,7 +38,7 @@ static int r_debug_gdb_reg_read(RDebug *dbg, int type, ut8 *buf, int size) {
|
||||
return desc->num_registers*desc->reg_size;
|
||||
}
|
||||
|
||||
static int r_debug_gdb_reg_write(RDebug *dbg, int pid, int tid, int type, const ut8 *buf, int size) {
|
||||
static int r_debug_gdb_reg_write(RDebug *dbg, int type, const ut8 *buf, int size) {
|
||||
gdbwrap_setreg_buffer (desc, buf, desc->reg_size*desc->num_registers);
|
||||
gdbwrap_shipallreg (desc);
|
||||
return R_TRUE; // XXX Error check
|
||||
|
@ -1306,8 +1306,6 @@ eprintf ("++ EFL = 0x%08x %d\n", ctx.EFlags, r_offsetof (CONTEXT, EFlags));
|
||||
}
|
||||
|
||||
static int r_debug_native_reg_write(RDebug *dbg, int type, const ut8* buf, int size) {
|
||||
int pid = dbg->pid;
|
||||
int tid = dbg->tid;
|
||||
// XXX use switch or so
|
||||
if (type == R_REG_TYPE_DRX) {
|
||||
#if __KFBSD__
|
||||
@ -1319,7 +1317,7 @@ static int r_debug_native_reg_write(RDebug *dbg, int type, const ut8* buf, int s
|
||||
int i;
|
||||
ut32 *val = (ut32 *)buf;
|
||||
for (i=0; i<7; i++) { // DR0-DR7
|
||||
ptrace (PTRACE_POKEUSER, pid, r_offsetof (
|
||||
ptrace (PTRACE_POKEUSER, dbg->pid, r_offsetof (
|
||||
struct user, u_debugreg[i]), *(val+i));
|
||||
//if (ret != 0)
|
||||
// return R_FALSE;
|
||||
@ -1334,7 +1332,9 @@ return R_FALSE;
|
||||
#endif
|
||||
} else
|
||||
if (type == R_REG_TYPE_GPR) {
|
||||
int pid = dbg->pid;
|
||||
#if __WINDOWS__
|
||||
int tid = dbg->tid;
|
||||
CONTEXT ctx __attribute__((aligned (16)));
|
||||
memcpy (&ctx, buf, sizeof (CONTEXT));
|
||||
ctx.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
|
||||
@ -1899,13 +1899,12 @@ static void addr_to_string(struct sockaddr_storage *ss, char *buffer, int buflen
|
||||
|
||||
static RList *r_debug_desc_native_list (int pid) {
|
||||
RList *ret = NULL;
|
||||
RDebugDesc *desc;
|
||||
int perm, type;
|
||||
// TODO: windows
|
||||
#if __KFBSD__
|
||||
int mib[4];
|
||||
int perm, type, mib[4];
|
||||
size_t len;
|
||||
char *buf, *bp, *eb, *str, path[1024];
|
||||
RDebugDesc *desc;
|
||||
struct kinfo_file *kve;
|
||||
|
||||
len = 0;
|
||||
@ -1977,7 +1976,9 @@ static RList *r_debug_desc_native_list (int pid) {
|
||||
}
|
||||
free (buf);
|
||||
#elif __linux__
|
||||
char path[1024], file[2048], buf[1024];
|
||||
RDebugDesc *desc;
|
||||
int type, perm;
|
||||
char path[512], file[512], buf[512];
|
||||
struct dirent *de;
|
||||
DIR *dd;
|
||||
struct stat st;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/hfs.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define GRUB_HFS_SBLOCK 2
|
||||
#define GRUB_HFS_EMBED_HFSPLUS_SIG 0x482B
|
||||
@ -658,13 +659,24 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, int thi
|
||||
void *closure)
|
||||
{
|
||||
int nodesize = type == 0 ? data->cat_size : data->ext_size;
|
||||
|
||||
#if GCC
|
||||
union
|
||||
{
|
||||
struct grub_hfs_node node;
|
||||
char rawnode[nodesize];
|
||||
grub_uint16_t offsets[nodesize / 2];
|
||||
} node;
|
||||
#else
|
||||
union
|
||||
{
|
||||
struct grub_hfs_node node;
|
||||
char *rawnode;
|
||||
grub_uint16_t *offsets; //[nodesize / 2];
|
||||
} node;
|
||||
#endif
|
||||
|
||||
node.rawnode = malloc (nodesize);
|
||||
node.offsets = malloc ((nodesize*sizeof(grub_uint16_t))/2);
|
||||
|
||||
do
|
||||
{
|
||||
@ -685,8 +697,11 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, int thi
|
||||
return grub_errno;
|
||||
|
||||
if (grub_disk_read (data->disk, blk, 0,
|
||||
sizeof (node), &node))
|
||||
return grub_errno;
|
||||
sizeof (node), &node)) {
|
||||
free (node.rawnode);
|
||||
free (node.offsets);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
/* Iterate over all records in this node. */
|
||||
for (i = 0; i < grub_be_to_cpu16 (node.node.reccnt); i++)
|
||||
@ -709,13 +724,19 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx, int thi
|
||||
- pnt->keylen - 1
|
||||
};
|
||||
|
||||
if (node_hook (&node.node, &rec, closure))
|
||||
if (node_hook (&node.node, &rec, closure)) {
|
||||
free (node.rawnode);
|
||||
free (node.offsets);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
idx = grub_be_to_cpu32 (node.node.next);
|
||||
} while (idx && this);
|
||||
|
||||
free (node.rawnode);
|
||||
free (node.offsets);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_EXPORT(grub_errno);
|
||||
@ -70,7 +71,7 @@ grub_fatal (const char *fmt, ...)
|
||||
grub_vprintf (_(fmt), ap);
|
||||
va_end (ap);
|
||||
|
||||
grub_abort ();
|
||||
abort ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -502,7 +502,7 @@ R_API char *r_line_readline() {
|
||||
break;
|
||||
if (strstr (I.history.data[i], I.buffer.data)) {
|
||||
gcomp_line = I.history.data[i];
|
||||
if (!gcomp_idx--);
|
||||
if (!gcomp_idx--)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user