Fix #10674 - pzq and gcc build

This commit is contained in:
pancake 2018-07-09 01:13:03 +02:00
parent b8a9e05b2c
commit 95d346b611
8 changed files with 42 additions and 33 deletions

View File

@ -485,6 +485,8 @@ R_API RConfigNode* r_config_set(RConfig *cfg, const char *name, const char *valu
}
free (node->value);
node->value = strdup (ov? ov: "");
free (ov);
return NULL;
}
}
beach:

View File

@ -1912,8 +1912,8 @@ static int cb_zoombyte(void *user, void *data) {
core->print->zoom->mode = *node->value;
break;
default:
r_cons_printf ("p\nf\ns\n0\nF\ne\nh\n");
// eprintf ("Invalid zoom.byte value. See pz? for help\n");
eprintf ("Invalid zoom.byte value. See pz? for help\n");
r_cons_printf ("pzp\npzf\npzs\npz0\npzF\npze\npzh\n");
return false;
}
return true;

View File

@ -1408,7 +1408,7 @@ static int cmd_dbg_map_heap_glibc_64 (RCore *core, const char *input);
static void get_hash_debug_file(RCore *core, const char *path, char *hash, int hash_len) {
RListIter *iter;
char buf[20] = R_EMPTY;
int offset, err, i, j = 0;
int offset, i, j = 0;
int bd = -1;
RBinFile *old_cur = r_bin_cur (core->bin);

View File

@ -3674,13 +3674,13 @@ R_API void r_print_code(RPrint *p, ut64 addr, ut8 *buf, int len, char lang) {
static int cmd_print(void *data, const char *input) {
RCore *core = (RCore *) data;
int mode, w, p, i, l, len, ret;
int w, p, i, l, len, ret;
ut8* block;
ut32 tbs = core->blocksize;
ut64 n, off, from, to, at, ate, piece;
ut64 tmpseek = UT64_MAX;
const int addrbytes = core->io->addrbytes;
mode = w = p = i = l = len = ret = 0;
w = p = i = l = len = ret = 0;
n = off = from = to = at = ate = piece = 0;
r_print_init_rowoffsets (core->print);
@ -5644,7 +5644,6 @@ static int cmd_print(void *data, const char *input) {
if (input[1] && input[1] != ' ') {
oldmode = strdup (r_config_get (core->config, "zoom.byte"));
if (!r_config_set (core->config, "zoom.byte", input + 1)) {
eprintf ("Invalid zoom.byte mode (%s)\n", input + 1);
do_zoom = false;
}
}

View File

@ -1070,7 +1070,7 @@ static void GH(print_heap_segment)(RCore *core, MallocState *main_arena, GHT *in
if( tcache->counts[i] > 1 ) {
tcache_fd = (ut64)tcache->entries[i];
for (int n = 1; n < tcache->counts[i]; n++) {
(void)r_io_read_at (core->io, tcache_fd, &tcache_tmp, sizeof ( GHT ) );
(void)r_io_read_at (core->io, tcache_fd, (ut8*)&tcache_tmp, sizeof ( GHT ) );
if ( (ut64)tcache_tmp - SZ * 2 == (ut64)prev_chunk ) {
is_free = true;
break;

View File

@ -211,7 +211,7 @@ static void visual_repeat(RCore *core) {
#if __UNIX__ && !__APPLE__
// TODO: Add support for iterm2 and terminal for mac, see rarop source for more info
int port = r_config_get_i (core->config, "http.port");
if (!r_core_rtr_http (core, '&', NULL)) {
if (!r_core_rtr_http (core, '&', 'H', NULL)) {
const char *xterm = r_config_get (core->config, "cmd.xterm");
// TODO: this must be configurable
r_sys_cmdf ("%s 'r2 -C http://localhost:%d/cmd/V;sleep 1' &", xterm, port);
@ -2740,7 +2740,7 @@ R_API void r_core_visual_title(RCore *core, int color) {
static ut64 oldpc = 0;
const char *BEGIN = core->cons->pal.prompt;
const char *filename;
char pos[512], foo[512], bar[512], pcs[32];
char pos[512], bar[512], pcs[32];
if (!oldpc) {
oldpc = r_debug_reg_get (core->dbg, "PC");
}
@ -2886,22 +2886,26 @@ R_API void r_core_visual_title(RCore *core, int color) {
sprintf (pcs, "%d%% ", pc);
}
}
{
char *title;
if (__ime) {
snprintf (foo, sizeof (foo), "[0x%08"PFMT64x " + %d> * INSERT MODE *\n",
title = r_str_newf ("[0x%08"PFMT64x " + %d> * INSERT MODE *\n",
core->offset, core->print->cur);
} else {
if (core->print->cur_enabled) {
snprintf (foo, sizeof (foo), "[0x%08"PFMT64x " %s%d (0x%x:%d=%d)]> %s %s\n",
title = r_str_newf ("[0x%08"PFMT64x " %s%d (0x%x:%d=%d)]> %s %s\n",
core->offset, pcs, core->blocksize,
core->print->cur, core->print->ocur, core->print->ocur == -1 ?
1: R_ABS (core->print->cur - core->print->ocur) + 1,
bar, pos);
} else {
snprintf (foo, sizeof (foo), "[0x%08"PFMT64x " %s%d %s]> %s %s\n",
title = r_str_newf ("[0x%08"PFMT64x " %s%d %s]> %s %s\n",
core->offset, pcs, core->blocksize, filename, bar, pos);
}
}
r_cons_print (foo);
r_cons_print (title);
free (title);
}
if (color) {
r_cons_strcat (Color_RESET);
}

View File

@ -7,7 +7,7 @@
#include "r_util.h"
#include "r_vector.h"
#define END_OF_MAP_IDS 0xffffffff
#define END_OF_MAP_IDS UT32_MAX
#define MAP_USE_HALF_CLOSED 0

View File

@ -42,7 +42,7 @@ R_API int r_type_kind(Sdb *TDB, const char *name) {
}
R_API RList* r_type_get_enum (Sdb *TDB, const char *name) {
char *p, *val, var[128], var2[128];
char *p, *val, var[130], var2[130];
int n;
if (r_type_kind (TDB, name) != R_TYPE_ENUM) {
@ -297,17 +297,20 @@ static void filter_type(char *t) {
R_API char *r_type_format(Sdb *TDB, const char *t) {
int n;
char *p, var[128], var2[128], var3[128];
char *p, var[130], var2[132];
char *fmt = NULL;
char *vars = NULL;
const char *kind = sdb_const_get (TDB, t, NULL);
if (!kind) return NULL;
if (!kind) {
return NULL;
}
// only supports struct atm
snprintf (var, sizeof (var), "%s.%s", kind, t);
if (!strcmp (kind, "type")) {
const char *fmt = sdb_const_get (TDB, var, NULL);
if (fmt)
if (fmt) {
return strdup (fmt);
}
} else if (!strcmp (kind, "struct") || !strcmp (kind, "union")) {
// assumes var list is sorted by offset.. should do more checks here
for (n = 0; (p = sdb_array_get (TDB, var, n, NULL)); n++) {
@ -322,6 +325,7 @@ R_API char *r_type_format(Sdb *TDB, const char *t) {
int alen = sdb_array_size (TDB, var2);
int elements = sdb_array_get_num (TDB, var2, alen - 1, NULL);
if (type) {
char var3[128] = {0};
// Handle general pointers except for char *
if ((strstr (type, "*(") || strstr (type, " *")) &&
strncmp (type, "char *", 7)) {