summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mixutils/mixvm_command.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mixutils/mixvm_command.c b/mixutils/mixvm_command.c
index 3d783e1..2c07be7 100644
--- a/mixutils/mixvm_command.c
+++ b/mixutils/mixvm_command.c
@@ -274,14 +274,16 @@ cmd_load_ (char *arg)
static void
trace_ ()
{
+ enum {BUFFER_LEN = 128};
+ static gchar STRINS[BUFFER_LEN];
+
const mix_src_file_t *file = mix_vm_get_src_file (vm_);
const gchar *line = "";
- gchar *strins;
mix_address_t loc = mix_vm_get_prog_count (vm_);
mix_word_t ins = mix_vm_get_addr_contents (vm_, loc);
mix_ins_t fins;
mix_word_to_ins_uncheck (ins, fins);
- strins = mix_ins_to_string (&fins);
+ mix_ins_to_string_in_buffer (&fins, STRINS, BUFFER_LEN);
if (file != NULL)
{
@@ -289,8 +291,7 @@ trace_ ()
if (b > 0) line = mix_src_file_get_line (file, b);
}
- printf ("%d: [%s]\t%s", (gint)loc, strins, line);
- if (strins != NULL) g_free (strins);
+ printf ("%d: [%s]\t%s", (gint)loc, STRINS, line);
}
static int
@@ -313,6 +314,9 @@ cmd_run_ (char *arg)
if (arg != NULL && *arg != '\0' && cmd_load_ (arg) != TRUE)
return TRUE;
puts (_("Running ..."));
+
+ if (mix_vm_is_halted (vm_)) mix_vm_reset_program (vm_);
+
switch (run_and_trace_ ())
{
case MIX_VM_HALT: