From f8e24446c36158f16c0b7a0fdb9144fded02cdbc Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 12 Sep 2001 23:14:24 +0000 Subject: add a newline character to the output of psrc and pprog --- mixlib/xmix_vm_handlers.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/mixlib/xmix_vm_handlers.c b/mixlib/xmix_vm_handlers.c index ed240fb..02c7ca9 100644 --- a/mixlib/xmix_vm_handlers.c +++ b/mixlib/xmix_vm_handlers.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- xmix_vm_handlers.c : * Implementation of the functions declared in xmix_vm_handlers.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "01/08/26 04:01:54 jao" + * $Id: xmix_vm_handlers.c,v 1.3 2001/09/12 23:14:24 jao Exp $ * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -41,6 +41,7 @@ mix_vm_command_info_t commands_[] = { "run [FILENAME]"}, { "next", cmd_next_, N_("Execute next instruction(s)"), "next [NO_OF_INS]"}, + { "pstat", cmd_pstat_, N_("Print current vm status"), "pstat"}, { "pc", cmd_pc_, N_("Print program counter value"), "pc" }, { "psym", cmd_psym_, N_("Print symbol value"), "psym [SYMBOLNAME]"}, { "preg", cmd_preg_, N_("Print register value"), @@ -131,10 +132,10 @@ trace_ (mix_vm_cmd_dispatcher_t *dis) static int run_and_trace_ (mix_vm_cmd_dispatcher_t *dis) { - int k = MIX_VM_OK; + int k = MIX_VM_RUNNING; if (!dis->trace) return mix_vm_run (dis->vm); - else while (k == MIX_VM_OK) + else while (k == MIX_VM_RUNNING) { trace_ (dis); k = mix_vm_exec_next (dis->vm); @@ -324,7 +325,7 @@ cmd_run_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) log_message_ (dis, _("... stopped: %s (address %d)"), mix_vm_get_last_breakpoint_message (dis->vm), mix_vm_get_prog_count (dis->vm)); - } + } break; case MIX_VM_ERROR: log_error_ (dis, _("... error executing loaded file")); @@ -1310,7 +1311,8 @@ gboolean cmd_pprog_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) { const gchar *path = mix_vm_cmd_dispatcher_get_program_path (dis); - fprintf (dis->out, path? path : _("No program currently loaded\n")); + fprintf (dis->out, path? path : _("No program currently loaded")); + fprintf (dis->out, "\n"); return (path != NULL); } @@ -1319,6 +1321,7 @@ cmd_psrc_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) { const gchar *path = mix_vm_cmd_dispatcher_get_src_file_path (dis); fprintf (dis->out, path? path : _("No program currently loaded\n")); + fprintf (dis->out, "\n"); return (path != NULL); } @@ -1342,7 +1345,7 @@ cmd_pline_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) if (line == 0) txt = "No such line (debug info not available)\n"; else - txt = mix_vm_cmd_dispatcher_get_src_file_line (dis, line); + txt = mix_vm_cmd_dispatcher_get_src_file_line (dis, line, TRUE); if (txt == NULL || strlen (txt) == 0) txt = "No such line\n"; @@ -1350,3 +1353,21 @@ cmd_pline_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) return TRUE; } + +gboolean +cmd_pstat_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) +{ + static const gchar *MSGS[MIX_VM_EMPTY + 1] = { + N_("Error loading or executing file"), + N_("Execution stopped: breakpoint encountered"), + N_("Execution stopped: conditional breakpoint encountered"), + N_("Program successfully terminated"), + N_("Execution stopped"), + N_("Program successfully loaded"), + N_("No program loaded") + }; + mix_vm_status_t status = + mix_vm_get_run_status (mix_vm_cmd_dispatcher_get_vm (dis)); + fprintf (dis->out, "VM status: %s\n", MSGS[status]); + return TRUE; +} -- cgit v1.2.3