Skip to content

Commit

Permalink
Make debugging work a bit better on OpenBSD: nudge get_base_from_maps…
Browse files Browse the repository at this point in the history
…() so it does not return 0 on OpenBSD just because the memory mapping does not contain the file name. (#6455)

Copied the fallback code from cmd_debug.c:r_debug_get_baddr().

getBaddrFromDebugger() from radare2.c also does the right thing. r_debug_get_baddr() probably should be exposed through the api so everyone can use one, maybe correct, version.
  • Loading branch information
nevun authored and radare committed Jan 9, 2017
1 parent fef557b commit d26a4cf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libr/core/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ static ut64 get_base_from_maps(RCore *core, const char *file) {
//b = map->addr;
}
}
// fallback resolution copied from cmd_debug.c:r_debug_get_baddr
r_list_foreach (core->dbg->maps, iter, map) {
if (map->perm == 5) { // r-x
return map->addr;
}
}

return b;
}
#endif
Expand Down

0 comments on commit d26a4cf

Please # to comment.