MR_TypeInfoParams MR_materialize_type_params(const MR_LabelLayout *label_layout, MR_Word *saved_regs) { return MR_materialize_type_params_base(label_layout, saved_regs, MR_saved_sp(saved_regs), MR_saved_curfr(saved_regs)); }
static void MR_dump_live_variables(const MR_LabelLayout *label_layout, MR_MemoryZone *heap_zone, MR_bool top_frame, MR_Word *stack_pointer, MR_Word *current_frame) { int short_var_count; int long_var_count; int i; MR_TypeInfo type_info; MR_Word value; MR_TypeInfoParams type_params; MR_Word saved_regs[MR_MAX_FAKE_REG]; MR_Float saved_f_regs[MR_MAX_VIRTUAL_F_REG]; MR_Word *current_regs; MR_Float *current_f_regs; long_var_count = MR_long_desc_var_count(label_layout); short_var_count = MR_short_desc_var_count(label_layout); // For the top stack frame, we should pass a pointer to a filled-in // saved_regs instead of NULL. For other stack frames, passing NULL // is fine, since output arguments are not live yet for any call // except the top one. MR_restore_registers(); MR_copy_regs_to_saved_regs(MR_MAX_FAKE_REG - 1, saved_regs, MR_MAX_VIRTUAL_F_REG - 1, saved_f_regs); if (top_frame) { current_regs = saved_regs; current_f_regs = saved_f_regs; } else { current_regs = NULL; current_f_regs = NULL; } type_params = MR_materialize_type_params_base(label_layout, current_regs, stack_pointer, current_frame); for (i = 0; i < long_var_count; i++) { fprintf(stderr, "%-12s\t", ""); if (MR_PROC_LAYOUT_HAS_PROC_ID(label_layout->MR_sll_entry)) { MR_print_proc_id(stderr, label_layout->MR_sll_entry); } MR_dump_long_value(MR_long_desc_var_locn(label_layout, i), heap_zone, stack_pointer, current_frame, top_frame); fprintf(stderr, "\n"); fflush(NULL); if (MR_debug_agc_print_vars) { // Call Mercury but use the debugging heap. MR_hp_word = MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min); MR_virtual_hp_word = MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min); if (MR_get_type_and_value_base(label_layout, i, current_regs, stack_pointer, current_frame, current_f_regs, type_params, &type_info, &value)) { printf("\t"); MR_write_variable(type_info, value); printf("\n"); } fflush(NULL); } } for (i = 0; i < short_var_count; i++) { fprintf(stderr, "%-12s\t", ""); if (MR_PROC_LAYOUT_HAS_PROC_ID(label_layout->MR_sll_entry)) { MR_print_proc_id(stderr, label_layout->MR_sll_entry); } MR_dump_short_value(MR_short_desc_var_locn(label_layout, i), heap_zone, stack_pointer, current_frame, top_frame); fprintf(stderr, "\n"); fflush(NULL); if (MR_debug_agc_print_vars) { // Call Mercury but use the debugging heap. MR_hp_word = MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min); MR_virtual_hp_word = MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min); if (MR_get_type_and_value_base(label_layout, i, current_regs, stack_pointer, current_frame, current_f_regs, type_params, &type_info, &value)) { printf("\t"); MR_write_variable(type_info, value); printf("\n"); } fflush(NULL); } } MR_copy_saved_regs_to_regs(MR_MAX_FAKE_REG - 1, saved_regs, MR_MAX_VIRTUAL_F_REG - 1, saved_f_regs); MR_save_registers(); MR_free(type_params); }