Fix rarun2 build on w32

This commit is contained in:
pancake 2014-06-04 23:05:34 +02:00
parent af1700940f
commit d9ec210d5e
2 changed files with 9 additions and 8 deletions

View File

@ -38,21 +38,17 @@ static char *_connect = NULL;
static char *_listen = NULL; static char *_listen = NULL;
static int _timeout = 0; static int _timeout = 0;
#if __UNIX__
static void set_limit(int n, int a, ut64 b) { static void set_limit(int n, int a, ut64 b) {
if (n) { if (n) {
#if __UNIX__
struct rlimit cl = {b, b}; struct rlimit cl = {b, b};
setrlimit (RLIMIT_CORE, &cl); setrlimit (RLIMIT_CORE, &cl);
#else
eprintf ("ERROR: 'core' not available for this platform\n");
#endif
} else { } else {
#if __UNIX__
struct rlimit cl = {0, 0}; struct rlimit cl = {0, 0};
setrlimit (a, &cl); setrlimit (a, &cl);
#endif
} }
} }
#endif
static char *getstr(const char *src) { static char *getstr(const char *src) {
int len; int len;
@ -223,10 +219,15 @@ static int runfile () {
close (2); close (2);
dup2 (f, 2); dup2 (f, 2);
} }
#if __UNIX__
set_limit (_docore, RLIMIT_CORE, RLIM_INFINITY); set_limit (_docore, RLIMIT_CORE, RLIM_INFINITY);
set_limit (_maxfd, RLIMIT_NOFILE, _maxfd); set_limit (_maxfd, RLIMIT_NOFILE, _maxfd);
set_limit (_maxproc, RLIMIT_NPROC, _maxproc); set_limit (_maxproc, RLIMIT_NPROC, _maxproc);
set_limit (_maxstack, RLIMIT_STACK, _maxstack); set_limit (_maxstack, RLIMIT_STACK, _maxstack);
#else
if (_docore || _maxfd || _maxproc || _maxstack)
eprintf ("Warning: setrlimits not supported for this platform\n");
#endif
if (_connect) { if (_connect) {
char *p = strchr (_connect, ':'); char *p = strchr (_connect, ':');

View File

@ -54,13 +54,13 @@ int main(int argc, char **argv) {
//r_io_system(io, "reg"); //r_io_system(io, "reg");
r_debug_reg_sync (dbg, R_REG_TYPE_GPR, 0); r_debug_reg_sync (dbg, R_REG_TYPE_GPR, 0);
r_debug_reg_list (dbg, R_REG_TYPE_GPR, 32, 0); r_debug_reg_list (dbg, R_REG_TYPE_GPR, 32, NULL);
printf ("--> perform 2 steps (only 1 probably?)\n"); printf ("--> perform 2 steps (only 1 probably?)\n");
r_debug_step (dbg, 2); r_debug_step (dbg, 2);
r_debug_reg_sync(dbg, R_REG_TYPE_GPR, 0); r_debug_reg_sync(dbg, R_REG_TYPE_GPR, 0);
r_debug_reg_list(dbg, R_REG_TYPE_GPR, 32, 0); r_debug_reg_list(dbg, R_REG_TYPE_GPR, 32, NULL);
//printf("--> regs post step\n"); //printf("--> regs post step\n");
//r_io_system(io, "reg"); //r_io_system(io, "reg");