Diff for /freem/src/mdebug.c between versions 1.3 and 1.5

version 1.3, 2025/03/09 19:50:47 version 1.5, 2025/04/29 18:46:17
Line 24 Line 24
  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.   *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
  *   *
  *   $Log$   *   $Log$
    *   Revision 1.5  2025/04/29 18:46:17  snw
    *   Begin work on interactive debugger
    *
    *   Revision 1.4  2025/04/28 19:38:55  snw
    *   Add trace mode
    *
  *   Revision 1.3  2025/03/09 19:50:47  snw   *   Revision 1.3  2025/03/09 19:50:47  snw
  *   Second phase of REUSE compliance and header reformat   *   Second phase of REUSE compliance and header reformat
  *   *
Line 35 Line 41
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <unistd.h>
   
   #include "config.h"
   
   #ifdef HAVE_LIBREADLINE
   #  if defined(HAVE_READLINE_READLINE_H)
   #    include <readline/readline.h>
   #  elif defined(HAVE_READLINE_H)
   #    include <readline.h>
   #  else /* !defined(HAVE_READLINE_H) */
   extern char *readline ();
   #  endif /* !defined(HAVE_READLINE_H) */
   /*char *cmdline = NULL;*/
   #else /* !defined(HAVE_READLINE_READLINE_H) */
     /* no readline */
   #endif /* HAVE_LIBREADLINE */
   
   #ifdef HAVE_READLINE_HISTORY
   #  if defined(HAVE_READLINE_HISTORY_H)
   #    include <readline/history.h>
   #  elif defined(HAVE_HISTORY_H)
   #    include <history.h>
   #  else /* !defined(HAVE_HISTORY_H) */
   extern void add_history ();
   extern int write_history ();
   extern int read_history ();
   #  endif /* defined(HAVE_READLINE_HISTORY_H) */
     /* no history */
   #endif /* HAVE_READLINE_HISTORY */
   
   
 #include "mpsdef.h"  #include "mpsdef.h"
 #include "mdebug.h"  #include "mdebug.h"
Line 62  void dbg_init (void) Line 98  void dbg_init (void)
   
 }  }
   
   int debugger (void)
   {
       
   #if defined(HAVE_LIBREADLINE)    
       static int first_entry = TRUE;
       char *dbg_buf;
       char dbg_prompt[256];
       HIST_ENTRY **dbg_hist;
       int dbg_hist_idx;
       HIST_ENTRY *dbg_hist_ent;
       char rouname_buf[256];
       
       set_io (UNIX);
       
       if (first_entry) {
           first_entry = FALSE;
           
           printf ("\nEntering debug mode; M commands unavailable.\n");
           printf ("Type 'exit' to return to direct mode; 'help' for help.\n\n");
       }
   
       while (1) {
           stcpy (rouname_buf, rou_name);
           stcnv_m2c (rouname_buf);
           
           snprintf (dbg_prompt, sizeof (dbg_prompt) - 1, "%s $STACK=%d [DEBUG]> ", rouname_buf, nstx);
   
           dbg_buf = readline (dbg_prompt);
   
           if (!dbg_buf) continue;
   
           if (strcmp (dbg_buf, "exit") == 0) {
               first_entry = TRUE;
               printf ("\n\nExiting debug mode.\n\n");
               set_io (MUMPS);
               return FALSE;
           }
           else {
               printf ("DEBUG:  invalid command\r\n");
           }
           
       }
   
       return TRUE;
   #else
       return FALSE;
   #endif
   
   }
   
 dbg_watch *dbg_add_watch (char *varnam)  dbg_watch *dbg_add_watch (char *varnam)
 {  {
     register int i;      register int i;
Line 238  void dbg_fire_watch (char *varnam) { Line 324  void dbg_fire_watch (char *varnam) {
         w->chgct++;          w->chgct++;
         w->firect++;          w->firect++;
         dbg_pending_watches++;          dbg_pending_watches++;
           
 }  }

Removed from v.1.3  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>