//------------------------------------------------------------------------------ // Name: comment // Desc: //------------------------------------------------------------------------------ QString CommentServer::comment(QHexView::address_t address, int size) const { if(IProcess *process = edb::v1::debugger_core->process()) { // if the view is currently looking at words which are a pointer in size // then see if it points to anything... if(size == edb::v1::pointer_size()) { edb::address_t value(0); if(process->read_bytes(address, &value, edb::v1::pointer_size())) { auto it = custom_comments_.find(value); if(it != custom_comments_.end()) { return it.value(); } else { if(Result<QString> ret = resolve_function_call(value)) { return *ret; } else if(Result<QString> ret = resolve_string(value)) { return *ret; } } } } } return QString(); }
//------------------------------------------------------------------------------ // Name: comment(QHexView::address_t address, int size) const // Desc: //------------------------------------------------------------------------------ QString CommentServer::comment(QHexView::address_t address, int size) const { QString ret; // if the view is currently looking at words which are a pointer in size // then see if it points to anything... if(size == edb::v1::pointer_size()) { edb::address_t value; if(edb::v1::debugger_core->read_bytes(address, &value, sizeof(value))) { QHash<quint64, QString>::const_iterator it = custom_comments_.find(value); if(it != custom_comments_.end()) { ret = it.value(); } else { bool ok; ret = resolve_function_call(value, ok); if(!ok) { ret = resolve_string(value, ok); } } } } return ret; }
exprtree* make_function (scanner_ident_t *name_ident, exprtree *args) { char *name = name_ident->str; scanner_region_t name_region = name_ident->region; exprtree *tree = 0; exprtree *arg; function_arg_info_t *first, *last; overload_entry_t *entry; tuple_info_t info; if (lookup_userval(the_mathmap->current_filter->userval_infos, name) != 0) { userval_info_t *info = lookup_userval(the_mathmap->current_filter->userval_infos, name); return make_userval(info, args, name_region); } if (lookup_filter(the_mathmap->filters, name) != 0) { filter_t *filter = lookup_filter(the_mathmap->filters, name); return make_filter_call(filter, args, name_region); } first = last = (function_arg_info_t*)malloc(sizeof(function_arg_info_t)); arg = args; last->info = arg->result; last->next = 0; while (arg->next != 0) { arg = arg->next; last = last->next = (function_arg_info_t*)malloc(sizeof(function_arg_info_t)); last->info = arg->result; last->next = 0; } entry = resolve_function_call(name, first, &info); if (entry != 0) { if (entry->type == OVERLOAD_BUILTIN) { int is_constant = 1; for (arg = args; arg != 0; arg = arg->next) if (arg->type != EXPR_TUPLE_CONST) { is_constant = 0; break; } tree = alloc_exprtree(); tree->type = EXPR_FUNC; tree->val.func.entry = entry; tree->val.func.args = args; tree->result = info; } else if (entry->type == OVERLOAD_MACRO) tree = entry->v.macro(args); else g_assert_not_reached(); tree->region = scanner_region_merge(name_region, exprlist_region(args)); } else if (lookup_variable(the_mathmap->current_filter->v.mathmap.variables, name, &info)) { variable_t *var = lookup_variable(the_mathmap->current_filter->v.mathmap.variables, name, &info); if (info.number != image_tag_number || info.length != 1) { sprintf(error_string, _("Variable %s is not an image and cannot be invoked."), name); error_region = name_region; JUMP(1); } return make_image_call(make_var_exprtree(var, info, name_region), args, name_region); } else { const char *op_name = get_op_name_for_func(name); if (op_name) sprintf(error_string, _("Unable to resolve invocation of operator `%s'."), op_name); else sprintf(error_string, _("Unable to resolve invocation of function `%s'."), name); error_region = name_region; JUMP(1); } return tree; }