Example #1
0
  void Environment::boot_vm() {
    state->initialize();
    state->boot();

    TaskProbe* probe = TaskProbe::create(state);
    state->probe.set(probe->parse_env(NULL) ? probe : nil<TaskProbe>());
  }
Example #2
0
  void test_parse_env_execute_instruction() {
    TS_ASSERT(p->parse_env("execute_instruction"));

    TS_ASSERT(p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOAD_RUNTIME));
  }
Example #3
0
  void test_parse_env_load_runtime() {
    TS_ASSERT(p->parse_env("load_runtime"));

    TS_ASSERT(p->enabled_p(PROBE_LOAD_RUNTIME));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
  }
Example #4
0
  void test_parse_env_every() {
    TS_ASSERT(p->parse_env("add_method,start_method,lookup_failed,execute_instruction,load_runtime"));

    TS_ASSERT(p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT(p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT(p->enabled_p(PROBE_LOAD_RUNTIME));
  }
Example #5
0
  void test_parse_env_start_method() {
    TS_ASSERT(p->parse_env("start_method"));

    TS_ASSERT(p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOAD_RUNTIME));
  }
Example #6
0
  void test_parse_env_all() {
    TS_ASSERT(p->parse_env("all"));

    TS_ASSERT(p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT(p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT(p->enabled_p(PROBE_LOAD_RUNTIME));
  }
Example #7
0
  void test_enabled_p_prim() {
    p->parse_env("all");

    TS_ASSERT(p->enabled_p(state, state->symbol("add_method")));
    TS_ASSERT(p->enabled_p(state, state->symbol("start_method")));
    TS_ASSERT(p->enabled_p(state, state->symbol("lookup_failed")));
    TS_ASSERT(p->enabled_p(state, state->symbol("execute_instruction")));
    TS_ASSERT(p->enabled_p(state, state->symbol("load_runtime")));
  }
Example #8
0
int main(int argc, char * argv[]) {
	TaskProbe t = TaskProbe();
	const char * prog = "dummy2\0";
	const char * symbol = "main\0";
	t.attach_to_exec(prog, argv);
	if (t.is_attached_to_process()) {
		//t.resume_task();
		t.getAddressOrigin();
		printf("%s\n", "Attached.");
		t.set_breakpoint(0x100000ef0);
		//t.set_breakpoint(symbol);
		t.run();
	}
	return 0;
}
Example #9
0
 void test_parse_env() {
   TS_ASSERT_EQUALS(false, p->parse_env("unrecognizable"));
 }
Example #10
0
  void test_disable_prim() {
    p->parse_env("all");

    TS_ASSERT(p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT(p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT(p->enabled_p(PROBE_LOAD_RUNTIME));

    p->disable(state, state->symbol("add_method"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_ADD_METHOD));

    p->disable(state, state->symbol("start_method"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_START_METHOD));

    p->disable(state, state->symbol("lookup_failed"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOOKUP_FAILED));

    p->disable(state, state->symbol("execute_instruction"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_EXECUTE_INSTRUCTION));

    p->disable(state, state->symbol("load_runtime"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOAD_RUNTIME));

    p->disable(state, state->symbol("execute_method"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_EXECUTE_METHOD));
  }
Example #11
0
 Environment::Environment() {
   state = new VM();
   TaskProbe* probe = TaskProbe::create(state);
   state->probe.set(probe->parse_env(NULL) ? probe : (TaskProbe*)Qnil);
 }