domain *get_domain_if_pc_group() { if (!has_domain()) return NULL; domain *d = get_current_domain(); if (d->type() == PC_GROUP) { return d; } return NULL; }
INT is_GFq_domain(domain *& d) { if (!has_domain()) return FALSE; d = get_current_domain(); if (d->type() == GFq) { return TRUE; } d = NULL; return FALSE; }
// Trace callstack & print it void Thread::trace_call_stack() { auto *domain_context = get_this_domain_context(); auto *call_context = get_this_call_context(); auto *first_call_context = get_all_call_contexts(); auto *current_domain = get_current_domain(); while (call_context >= first_call_context) { // Switch to previous domain while (domain_context->prev && domain_context->value.m_call_context > call_context) { // Back to previous domain context according the call context domain_context = domain_context->value.m_prev_context; switch_domain(domain_context->value.m_domain); } // Get the function via entry auto *function = Program::get_function_by_entry(call_context->m_function_or_entry); auto *object = call_context->m_this_object; auto *program = object->get_program(); char oid_desc[64]; object->get_oid().print(oid_desc, sizeof(oid_desc), "Object"); printf("Function %s::%s @ %s(%s)\n", function->get_program()->get_name()->c_str(), function->get_name()->c_str(), program->get_name()->c_str(), oid_desc); // Print all arguments auto n = function->get_max_arg_no(); if (function->get_attrib() & Function::RANDOM_ARG) // For random arg function, m_arg_no in call_context is the // count of arugments passed when calling n = call_context->m_arg_no; print_variables(function->get_parameters(), "Argument", call_context->m_args, n); // Print all local variables print_variables(function->get_local_variables(), "Local variables", call_context->m_locals, 0); call_context--; } // Return the saved current domain of the thread switch_domain(current_domain); }