[m-dev.] for review: new debugger command set (part 3 of 4)
Tyson Dowd
trd at cs.mu.OZ.AU
Wed Oct 7 18:34:01 AEST 1998
On 01-Oct-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> Index: runtime/mercury_accurate_gc.c
> ===================================================================
> @@ -292,8 +292,10 @@
> RECAST MERCURY_TRACE_UTIL AS MERCURY_LAYOUT_UTIL
>
> /* Get the type parameters from the stack frame. */
>
> - type_params = MR_trace_materialize_typeinfos_base(vars,
> - top_frame, stack_pointer, current_frame);
> + /* XXX We must pass NULL since the registers have not been saved */
> + /* XXX This is probably a bug; Tyson should look into it */
> + type_params = MR_materialize_typeinfos_base(vars,
> + NULL, stack_pointer, current_frame);
Yep, it probably is, but I'm probably not going to be able to fix
it just now, so leaving this in is fine.
> Index: runtime/mercury_agc_debug.c
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/mercury_agc_debug.c,v
> retrieving revision 1.3
> diff -u -u -r1.3 mercury_agc_debug.c
> --- mercury_agc_debug.c 1998/09/21 13:17:42 1.3
> +++ mercury_agc_debug.c 1998/09/22 02:28:12
> @@ -9,7 +9,7 @@
> RECAST MERCURY_TRACE_UTIL AS MERCURY_LAYOUT_UTIL
> */
>
> #include "mercury_imp.h"
> -#include "mercury_trace_util.h"
> +#include "mercury_layout_util.h"
> #include "mercury_deep_copy.h"
> #include "mercury_agc_debug.h"
>
> @@ -26,6 +26,8 @@
> void
> MR_agc_dump_roots(MR_RootList roots)
> {
> + Word saved_regs[MAX_FAKE_REG];
> +
> fflush(NULL);
> fprintf(stderr, "Dumping roots\n");
>
> @@ -40,17 +42,19 @@
> ** the saved registers).
> */
> restore_registers();
> - MR_copy_regs_to_saved_regs(MAX_REAL_REG + NUM_SPECIAL_REG);
> + MR_copy_regs_to_saved_regs(MAX_REAL_REG + NUM_SPECIAL_REG,
> + saved_regs);
>
> MR_hp = MR_ENGINE(debug_heap_zone->min);
> MR_virtual_hp = MR_ENGINE(debug_heap_zone->min);
>
> fflush(NULL);
> - MR_trace_write_variable((Word) roots->type_info, *roots->root);
> + MR_write_variable((Word) roots->type_info, *roots->root);
> fflush(NULL);
> fprintf(stderr, "\n");
>
> - MR_copy_saved_regs_to_regs(MAX_REAL_REG + NUM_SPECIAL_REG);
> + MR_copy_saved_regs_to_regs(MAX_REAL_REG + NUM_SPECIAL_REG,
> + saved_regs);
> save_registers();
> roots = roots->next;
> }
> @@ -61,6 +65,7 @@
> MR_agc_dump_stack_frames(MR_Internal *label, MemoryZone *heap_zone,
> Word *stack_pointer, Word *current_frame)
> {
> + Word saved_regs[MAX_FAKE_REG];
> int i, var_count;
> const MR_Stack_Layout_Vars *vars;
> Word *type_params, type_info, value;
> @@ -87,8 +92,8 @@
> var_count = layout->MR_sll_var_count;
> vars = &(layout->MR_sll_var_info);
>
> - type_params = MR_trace_materialize_typeinfos_base(vars,
> - top_frame, stack_pointer, current_frame);
> + type_params = MR_materialize_typeinfos_base(vars,
> + NULL, stack_pointer, current_frame);
Isn't this the same thing? Aren't the registers actually saved in
this case. Either the NULL should be "saved_regs" or you need an
XXX here (or both).
> bool
> -MR_trace_get_type_and_value_filtered(const MR_Stack_Layout_Var *var,
> - const char *name,
> - Word *type_info, Word *value)
> +MR_get_type_and_value_filtered(const MR_Stack_Layout_Var *var,
> + Word *saved_regs, const char *name, Word *type_info, Word *value)
> {
> return ((strncmp(name, "TypeInfo", 8) != 0)
> && (strncmp(name, "ModuleInfo", 10) != 0)
> && (strncmp(name, "HLDS", 4) != 0)
> - && MR_trace_get_type_and_value(var, NULL, type_info, value));
> + && MR_get_type_and_value(var, saved_regs, NULL,
> + type_info, value));
> }
You probably want to filter on TypeClassInfo as well (I think we now
generate TypeClassInfo variables instead of just TypeInfo).
Other than this, comments, no problems.
--
Those who would give up essential liberty to purchase a little temporary
safety deserve neither liberty nor safety. - Benjamin Franklin
Tyson Dowd <tyson at tyse.net> http://tyse.net
More information about the developers
mailing list