Skip to content

Commit 7eed52f

Browse files
committed
asfj
1 parent 1b2226a commit 7eed52f

File tree

3 files changed

+24
-50
lines changed

3 files changed

+24
-50
lines changed

libr/core/canal.c

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,6 @@ static int cmp_sec_range(const RCoreSecRange *a, const RCoreSecRange *b) {
3535
return (fa > fb)? 1: (fa < fb)? -1: 0;
3636
}
3737

38-
static const char *data_types[] = { "CSTRINGS", "CONST", "cfstring", "4BYTE", "8BYTE", "16BYTE", NULL };
39-
static bool is_data_section_type(const char *type) {
40-
const char **dt = data_types;
41-
for (; *dt; dt++) {
42-
if (r_str_startswith (type, *dt)) {
43-
return true;
44-
}
45-
}
46-
return false;
47-
}
48-
4938
static RVecRCoreSecRange *r_core_get_sec_ranges(RCore *core) {
5039
RCorePriv *priv = core->priv;
5140
// Check if we have a cached result
@@ -76,12 +65,12 @@ static RVecRCoreSecRange *r_core_get_sec_ranges(RCore *core) {
7665
if (to <= from) {
7766
continue;
7867
}
68+
if (section->perm & R_PERM_W) {
69+
continue;
70+
}
7971
RCoreSecRange r = {
8072
.from = from,
8173
.to = to,
82-
.executable = (section->perm & R_PERM_X) != 0,
83-
.has_strings = section->has_strings,
84-
.is_data_type = is_data_section_type (section->type)
8574
};
8675
RVecRCoreSecRange_push_back (sr, &r);
8776
}
@@ -160,6 +149,11 @@ static int cmpaddr(const void *_a, const void *_b) {
160149
return (a->addr > b->addr)? 1: (a->addr < b->addr)? -1: 0;
161150
}
162151

152+
static int cmp_ut64(const ut64 *a, const void *_b) {
153+
const ut64 *b = (const ut64 *)_b;
154+
return (*a > *b)? 1: (*a < *b)? -1: 0;
155+
}
156+
163157
static void init_addr2klass(RCore *core, RBinObject *bo) {
164158
if (bo->addr2klassmethod) {
165159
return;
@@ -287,13 +281,6 @@ static bool is_string_at(RCore *core, ut64 addr, char *str, int *olen, const RVe
287281
return false;
288282
}
289283
const RCoreSecRange *r = RVecRCoreSecRange_at (sr, idx);
290-
#if 0
291-
// Skip strings in executable sections unless they contain actual string data
292-
// (e.g., Mach-O __cstring which is executable but contains string data)
293-
if (r->executable && !r->has_strings && !r->is_data_type) {
294-
return false;
295-
}
296-
#endif
297284
if (addr + 4 > r->to) {
298285
return false;
299286
}
@@ -1179,15 +1166,7 @@ static bool __core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int de
11791166
RIOMap *map = r_io_map_get_at (core->io, addr);
11801167
// only get next if found on an executable section
11811168
if (!map || (map && map->perm & R_PERM_X)) {
1182-
ut64 *iter;
1183-
bool found = false;
1184-
R_VEC_FOREACH (&next, iter) {
1185-
if (*iter == addr) {
1186-
found = true;
1187-
break;
1188-
}
1189-
}
1190-
if (!found) {
1169+
if (!RVecUT64_find (&next, &addr, cmp_ut64)) {
11911170
ut64 at = r_anal_function_max_addr (fcn);
11921171
while (true) {
11931172
ut64 size;
@@ -1198,7 +1177,6 @@ static bool __core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int de
11981177
at += size;
11991178
}
12001179
// TODO: ensure next address is function after padding (nop or trap or wat)
1201-
// XXX noisy for test cases because we want to clear the stderr
12021180
r_cons_clear_line (core->cons, true, true);
12031181
if (verbose) {
12041182
loganal (fcn->addr, at, 10000 - depth);
@@ -5357,7 +5335,6 @@ bool fcn_merge_touch_cb(ut64 addr, struct r_merge_ctx_t *ctx) {
53575335
if (ctx->cur == fcn) {
53585336
return true;
53595337
}
5360-
53615338
// Function we're trying to merge into
53625339
if (ctx->merge == fcn) {
53635340
found = true;

libr/include/r_core.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ R_LIB_VERSION_HEADER(r_core);
6666
#define R_FLAGS_FS_SYMBOLS_SECTIONS "symbols.sections"
6767
#define R_FLAGS_FS_SYSCALLS "syscalls"
6868

69-
#define R_GRAPH_FORMAT_NO 0
70-
#define R_GRAPH_FORMAT_GMLFCN 1
71-
#define R_GRAPH_FORMAT_JSON 2
72-
#define R_GRAPH_FORMAT_GML 3
73-
#define R_GRAPH_FORMAT_DOT 4
74-
#define R_GRAPH_FORMAT_CMD 5
69+
#define R_GRAPH_FORMAT_NO 0
70+
#define R_GRAPH_FORMAT_GMLFCN 1
71+
#define R_GRAPH_FORMAT_JSON 2
72+
#define R_GRAPH_FORMAT_GML 3
73+
#define R_GRAPH_FORMAT_DOT 4
74+
#define R_GRAPH_FORMAT_CMD 5
7575

7676
///
7777
#define R_CONS_COLOR_DEF(x, def) ((core->cons && core->cons->context->pal.x)? core->cons->context->pal.x: def)
@@ -318,14 +318,14 @@ typedef struct r_core_esil_t {
318318
ut32 tr_reg;
319319
ut32 tr_mem;
320320
RReg *reg;
321-
char *cmd_step; // command to run before a step is performed
322-
char *cmd_step_out; // command to run after a step is performed
323-
char *cmd_intr; // command to run when an interrupt occurs
324-
char *cmd_trap; // command to run when a trap occurs
325-
char *cmd_mdev; // command to run when an memory mapped device address is used
326-
char *cmd_todo; // command to run when esil expr contains TODO
327-
char *cmd_ioer; // command to run when esil fails to IO
328-
char *mdev_range; // string containing the r_str_range to match for read/write accesses
321+
char *cmd_step; // command to run before a step is performed
322+
char *cmd_step_out; // command to run after a step is performed
323+
char *cmd_intr; // command to run when an interrupt occurs
324+
char *cmd_trap; // command to run when a trap occurs
325+
char *cmd_mdev; // command to run when an memory mapped device address is used
326+
char *cmd_todo; // command to run when esil expr contains TODO
327+
char *cmd_ioer; // command to run when esil fails to IO
328+
char *mdev_range; // string containing the r_str_range to match for read/write accesses
329329
ut8 cfg;
330330
} RCoreEsil;
331331

libr/include/r_core_priv.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* radare - LGPL - Copyright 2024-2025 - pancake */
1+
/* radare - LGPL - Copyright 2024-2026 - pancake */
22

33
#include "r_core.h"
44

@@ -12,9 +12,6 @@ extern "C" {
1212
typedef struct r_core_sec_range_t {
1313
ut64 from;
1414
ut64 to;
15-
bool executable;
16-
bool has_strings;
17-
bool is_data_type; // precomputed from section type (CSTRINGS, CONST, etc.)
1815
} RCoreSecRange;
1916

2017
R_VEC_TYPE (RVecRCoreSecRange, RCoreSecRange);

0 commit comments

Comments
 (0)