[tex-k] Debugging patches

Julian Gilbey J.D.Gilbey@qmw.ac.uk
Thu, 25 Jan 2001 11:15:56 +0000


--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Was trying to run the debugging mode on Metafont, but hit the small
snag that the change file hasn't been fixed to allow this.  So
attached are patches to {tex,mf,mp,weave,tangle}.ch to do this, based
on the fixes already in tex.ch and mp.ch.  I haven't attempted to port
these patches to (pdf|e)tex and omega.  They are against the versions
in teTeX-1.0.7.

   Julian

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

         Julian Gilbey, Dept of Maths, Queen Mary, Univ. of London
       Debian GNU/Linux Developer,  see http://people.debian.org/~jdg
  Donate free food to the world's hungry: see http://www.thehungersite.com/

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tex.ch.diff"

--- tex.ch.orig	Fri Apr 30 23:34:40 1999
+++ tex.ch	Thu Jan 25 11:01:34 2001
@@ -3692,6 +3692,12 @@
   for font_k:=font_base to font_max do font_used[font_k]:=false;
 @z
 
+@x [52.1338] Correct debug_help read statements to actually read things
+  read(term_in,m);
+@y
+  m:=input_int(term_in);
+@z
+
 % [52.1338] Core-dump in debugging mode on 0 input.  Under Unix, it's
 % not possible to portably switch into the debugger while a program is
 % running.  The best approximation is to do a core dump, then run the
@@ -3704,6 +3710,12 @@
     dump_core {do something to cause a core dump}
 @z
 
+@x [52.1338] Another integer read change
+  else  begin read(term_in,n);
+@y
+  else  begin n:=input_int(term_in);
+@z
+
 @x [52.1339] l.24429 - debug - print tfm info
 5: print_word(font_info[n]);
 @y 24397
@@ -3713,6 +3725,12 @@
   print_int(font_info[n].qqqq.b2); print_char(":");@/
   print_int(font_info[n].qqqq.b3);
   end;
+@z
+
+@x [52.1339] Final read integer change
+13: begin read(term_in,l); print_cmd_chr(n,l);
+@y
+13: begin l:=input_int(term_in); print_cmd_chr(n,l);
 @z
 
 % [53.1350] (new_write_whatsit) Allow 18 as a \write stream. We never

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mf.ch.diff"

--- mf.ch.orig	Thu Jan 25 09:46:53 2001
+++ mf.ch	Thu Jan 25 10:41:36 2001
@@ -1974,6 +1974,36 @@
 %if (base_ident=0)or(buffer[loc]="&")or dump_line then
 %@z
 
+@x [50.1212] Correct debug_help read statements to actually read things
+  read(term_in,m);
+@y
+  m:=input_int(term_in);
+@z
+
+% [50.1212] Core-dump in debugging mode on 0 input.  Under Unix, it's
+% not possible to portably switch into the debugger while a program is
+% running.  The best approximation is to do a core dump, then run the
+% debugger on it later.
+@x [50.1212] - Core-dump in debugging mode on 0 input.
+    begin goto breakpoint;@\ {go to every label at least once}
+    breakpoint: m:=0; @{'BREAKPOINT'@}@\
+    end
+@y
+    dump_core {do something to cause a core dump}
+@z
+
+@x [50.1212] Another integer reading change
+  else  begin read(term_in,n);
+@y
+  else  begin n:=input_int(term_in);
+@z
+
+@x [50.1213] Last time
+13: begin read(term_in,l); print_cmd_mod(n,l);
+@y
+13: begin l:=input_int(term_in); print_cmd_mod(n,l);
+@z
+
 @x [51.1214] Add editor-switch variable to globals.
 This section should be replaced, if necessary, by any special
 modifications of the program

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mp.ch.diff"

--- mp.ch.orig	Thu Jan 25 10:33:54 2001
+++ mp.ch	Thu Jan 25 10:33:57 2001
@@ -1704,7 +1704,7 @@
 init_randoms(get_random_seed);@/
 @z
 
-@x [47.1307] Change read of integer.
+@x [47.1307] Change read of integer and breakpoint (see tex.ch)
   read(term_in,m);
   if m<0 then return
   else if m=0 then
@@ -1716,9 +1716,7 @@
   m:=input_int (stdin);
   if m<0 then return
   else if m=0 then
-    begin goto breakpoint;@\ {go to every label at least once}
-    breakpoint: m:=0; @{'BREAKPOINT'@}@\
-    end
+    dump_core {do something to cause a core dump}
   else  begin n:=input_int (stdin);
 @z
 

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="weave.ch.diff"

--- weave.ch.orig	Thu Jan 25 10:36:09 2001
+++ weave.ch	Thu Jan 25 10:45:15 2001
@@ -299,6 +299,22 @@
 @y
 @z
 
+@x [260] Handle reading integers from stdin and breakpoints (see tex.ch)
+  read(term_in,ddt); {read a list of integers}
+  if ddt<0 then return
+  else if ddt=0 then
+    begin goto breakpoint;@\ {go to every label at least once}
+    breakpoint: ddt:=0;@\
+    end
+  else  begin read(term_in,dd);
+@y
+  ddt:=input_int(term_in);
+  if ddt<0 then return
+  else if ddt=0 then
+    dump_core
+  else  begin dd:=input_int(term_in);
+@z
+
 @x [261] print newline at end of run and exit based upon value of history
 print_ln(banner); {print a ``banner line''}
 @y

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tangle.ch.diff"

--- tangle.ch.orig	Thu Jan 25 10:36:17 2001
+++ tangle.ch	Thu Jan 25 10:45:01 2001
@@ -359,6 +359,22 @@
 @y
 @z
 
+@x [181] Handle reading integers from stdin and breakpoints (see tex.ch)
+  read(term_in,ddt); {read a list of integers}
+  if ddt<0 then return
+  else if ddt=0 then
+    begin goto breakpoint;@\ {go to every label at least once}
+    breakpoint: ddt:=0;@\
+    end
+  else  begin read(term_in,dd);
+@y
+  ddt:=input_int(term_in);
+  if ddt<0 then return
+  else if ddt=0 then
+    dump_core
+  else  begin dd:=input_int(term_in);
+@z
+
 @x [182] write newline just before exit; use value of |history|
 print_ln(banner); {print a ``banner line''}
 @y

--NzB8fVQJ5HfG6fxh--