- if: ${{ matrix.sdk }}
name: Create iOS SDK
run: |
- ./sys/ios-sdk.sh
+ ./sys/sdk-ios.sh
pushd /tmp/r2ios
zip -r /tmp/r2ios-sdk.zip *
popd
bp->traces = r_bp_traptrace_new ();
bp->bps = r_list_newf ((RListFree)r_bp_item_free);
bp->plugins = r_list_newf ((RListFree)free);
- bp->nhwbps = 0;
for (i = 0; bp_static_plugins[i]; i++) {
static_plugin = R_NEW (RBreakpointPlugin);
memcpy (static_plugin, bp_static_plugins[i],
return bp;
}
-R_API RBreakpoint *r_bp_free(RBreakpoint *bp) {
+// AIRPDO return void
+R_API void r_bp_free(RBreakpoint *bp) {
if (bp) {
r_list_free (bp->bps);
r_list_free (bp->plugins);
free (bp->bps_idx);
free (bp);
}
- return NULL;
}
R_API int r_bp_get_bytes(RBreakpoint *bp, ut8 *buf, int len, int endian, int idx) {
R_LOG_WARN ("Cannot get breakpoint bytes. No architecture selected?");
}
}
- bp->nbps++;
r_list_append (bp->bps, b);
return b;
}
R_API void r_bp_add_fault(RBreakpoint *bp, ut64 addr, int size, int perm) {
- // TODO
+ R_RETURN_IF_FAIL (bp);
+ /* Add a fault-type breakpoint (no original bytes to preserve) */
+ r_bp_add (bp, NULL, addr, size, R_BP_TYPE_FAULT, perm);
}
R_API RBreakpointItem* r_bp_add_sw(RBreakpoint *bp, ut64 addr, int size, int perm) {
// Check if the breakpoint is in a valid map
R_API bool r_bp_is_valid(RBreakpoint *bp, RBreakpointItem *b) {
+ R_RETURN_VAL_IF_FAIL (bp && b, false);
if (bp->bpinmaps) {
return bp->coreb.isMapped (bp->coreb.core, b->addr, b->perm);
}
#include <r_bp.h>
-R_API int r_bp_plugin_del(RBreakpoint *bp, const char *name) {
+R_API bool r_bp_plugin_del(RBreakpoint *bp, const char *name) {
+ R_RETURN_VAL_IF_FAIL (bp && name, false);
RListIter *iter;
RBreakpointPlugin *h;
- if (name && *name) {
- r_list_foreach (bp->plugins, iter, h) {
- if (!strcmp (h->meta.name, name)) {
- if (bp->cur == h) {
- bp->cur = NULL;
- }
- r_list_delete (bp->plugins, iter);
- bp->nbps--;
- return true;
+ r_list_foreach (bp->plugins, iter, h) {
+ if (!strcmp (h->meta.name, name)) {
+ if (bp->cur == h) {
+ bp->cur = NULL;
}
+ r_list_delete (bp->plugins, iter);
+ return true;
}
}
return false;
}
-R_API int r_bp_plugin_add(RBreakpoint *bp, RBreakpointPlugin *foo) {
+R_API bool r_bp_plugin_add(RBreakpoint *bp, RBreakpointPlugin *foo) {
+ R_RETURN_VAL_IF_FAIL (bp && foo, false);
RListIter *iter;
RBreakpointPlugin *h;
- if (!bp) {
- R_LOG_ERROR ("Cannot add plugin because dbg->bp is null and/or plugin is null");
- return false;
- }
- /* avoid dupped plugins */
- r_list_foreach (bp->bps, iter, h) {
+ r_list_foreach (bp->plugins, iter, h) {
if (!strcmp (h->meta.name, foo->meta.name)) {
return false;
}
}
- bp->nbps++;
r_list_append (bp->plugins, foo);
return true;
}
-R_API int r_bp_plugin_remove(RBreakpoint *bp, RBreakpointPlugin *plugin) {
- // R2_590 TODO
- return true;
+R_API bool r_bp_plugin_remove(RBreakpoint *bp, RBreakpointPlugin *plugin) {
+ R_RETURN_VAL_IF_FAIL (bp && plugin, false);
+ return r_bp_plugin_del (bp, plugin->meta.name);
}
-R_API int r_bp_use(RBreakpoint *bp, const char *name, int bits) {
+R_API bool r_bp_use(RBreakpoint *bp, const char *name, int bits) {
+ R_RETURN_VAL_IF_FAIL (bp && name, false);
RListIter *iter;
bp->bits = bits;
RBreakpointPlugin *h;
}
R_API char *r_bp_plugin_list(RBreakpoint *bp) {
+ R_RETURN_VAL_IF_FAIL (bp, NULL);
RListIter *iter;
RBreakpointPlugin *b;
RStrBuf *sb = r_strbuf_new ("");
return false;
}
// TODO: check return value
- bp->iob.read_at (bp->iob.io, from, buf, len);
+ int rd = bp->iob.read_at (bp->iob.io, from, buf, (int)len);
+ if (rd != (int)len) {
+ free (buf);
+ free (trap);
+ free (bits);
+ return false;
+ }
memset (bits, 0x00, bitlen);
- r_bp_get_bytes (bp, trap, len, bp->endian, 0);
+ r_bp_get_bytes (bp, trap, (int)len, bp->endian, 0);
trace = R_NEW (RBreakpointTrace);
if (!trace) {
}
R_API RBreakpointItem* r_bp_watch_add(RBreakpoint *bp, ut64 addr, int size, int hw, int perm) {
- RBreakpointItem *b;
+ // use R_RETURN precondition checks in all R_API functions
if (addr == UT64_MAX || size < 1) {
return NULL;
}
if (r_bp_get_in (bp, addr, perm)) {
- eprintf ("Breakpoint already set at this address.\n");
+ R_LOG_WARN ("Breakpoint already set at this address");
return NULL;
}
- b = r_bp_item_new (bp);
+ RBreakpointItem *b = r_bp_item_new (bp);
b->addr = addr + bp->delta;
b->size = size;
b->enabled = true;
if (hw) {
r_bp_watch_add_hw (bp, b);
} else {
- eprintf ("[TODO]: Software watchpoint is not implemented yet (use ESIL)\n");
+ R_LOG_TODO ("Software watchpoint is not implemented yet (use ESIL)");
/* TODO */
}
- bp->nbps++;
r_list_append (bp->bps, b);
return b;
}
R_API void r_bp_watch_del(void) {
+ R_LOG_TODO ("r_bp_watch_del not implemented");
}
RList *plugins;
RBreakpointCallback breakpoint;
/* storage of breakpoints */
- int nbps;
- int nhwbps;
RList *bps; // list of breakpoints
RBreakpointItem **bps_idx;
int bps_idx_count;
st64 delta;
ut64 baddr;
+ int nhwbps;
} RBreakpoint;
// DEPRECATED: USE R_PERM
#ifdef R_API
R_API RBreakpoint *r_bp_new(void);
-R_API RBreakpoint *r_bp_free(RBreakpoint *bp);
+R_API void r_bp_free(RBreakpoint *bp);
R_API bool r_bp_del(RBreakpoint *bp, ut64 addr);
R_API bool r_bp_del_all(RBreakpoint *bp);
-R_API int r_bp_plugin_add(RBreakpoint *bp, RBreakpointPlugin *plugin);
-R_API int r_bp_plugin_remove(RBreakpoint *bp, RBreakpointPlugin *plugin);
-R_API int r_bp_use(RBreakpoint *bp, const char *name, int bits);
-R_API int r_bp_plugin_del(RBreakpoint *bp, const char *name);
+R_API bool r_bp_plugin_add(RBreakpoint *bp, RBreakpointPlugin *plugin);
+R_API bool r_bp_use(RBreakpoint *bp, const char *name, int bits);
+R_API bool r_bp_plugin_remove(RBreakpoint *bp, RBreakpointPlugin *plugin);
+R_API bool r_bp_plugin_del(RBreakpoint *bp, const char *name);
R_API char *r_bp_plugin_list(RBreakpoint *bp);
R_API int r_bp_in(RBreakpoint *bp, ut64 addr, int perm);
R_API void r_bp_set_trace_all(RBreakpoint *bp, int set);
R_API RBreakpointItem *r_bp_enable(RBreakpoint *bp, ut64 addr, int set, int count);
R_API void r_bp_enable_all(RBreakpoint *bp, int set);
+R_API int r_bp_stepy_continuation(RBreakpoint *bp);
/* index api */
R_API RBreakpointItem *r_bp_get_index(RBreakpoint *bp, int idx);
R_API void r_bp_traptrace_list(RBreakpoint *bp);
R_API bool r_bp_traptrace_at(RBreakpoint *bp, ut64 from, int len);
R_API RList *r_bp_traptrace_new(void);
-R_API void r_bp_traptrace_enable(RBreakpoint *bp, int enable);
/* watchpoint */
R_API RBreakpointItem *r_bp_watch_add(RBreakpoint *bp, ut64 addr, int size, int hw, int rw);