Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch_with_backtrace/3 doesn't produce a backtrace message #1231

Open
kamahen opened this issue Feb 3, 2024 · 0 comments
Open

catch_with_backtrace/3 doesn't produce a backtrace message #1231

kamahen opened this issue Feb 3, 2024 · 0 comments

Comments

@kamahen
Copy link
Member

kamahen commented Feb 3, 2024

I modified packages/ltx2htm/latex2html.pl to output a backtrace on error, but didn't generate a backtrace when run as part of the build. When I ran the program by hand (using the -l option to avoid the automatic call to main/1), it trapped to the debugger and I could use the g command to get a backtrace. (The traceback shows catch_with_backtrace twice -- is this expected?)

@@ -81,6 +81,7 @@
 :- autoload(library(option),[option/2,select_option/3]).
 :- autoload(library(readutil),[read_file_to_codes/3]).
 :- autoload(library(statistics),[statistics/0]).
+:- use_module(library(prolog_stack)). % For catch_with_backtrace
 
 ltx2htm_version('0.98').                % for SWI-Prolog 5.6.18
 
@@ -3224,6 +3225,12 @@ cmd_layout(sloppy,     end,   1, 1).
 :- initialization(main, main).
 
 main(Argv) :-
+    catch_with_backtrace(main0(Argv),
+                         Error,
+                         (   print_message(error, Error),
+                             halt(1) )).
+
+main0(Argv) :-
     argv_options(Argv, Files, Options),
     set_debugging(Options),
     set_quiet(Options),

When I ran this by hand (reproducing what the build did), I got:

(cd /home/peter/src/swipl-devel/build.debug/packages/swipy && /home/peter/src/swipl-devel/build.debug/src/swipl -f none --no-packs /home/peter/src/swipl-devel/build.debug/home/library/ext/ltx2htm/latex2html.pl -- --quiet janus && /usr/bin/cmake -E remove /home/peter/src/swipl-devel/build.debug/home/doc/manindex.db)
ERROR: put_html_token/1: instantiation error
   Redo: (1,353) tex:write_html(nospace([])) ? 20g
  [1,353] tex:write_html(nospace([]))
  [1,352] tex:write_html([nospace([])])
  [1,351] tex:write_html([[nospace([])], nospace(')')])
  [1,349] tex:write_html([[nospace('('), [nospace([])], nospace(')')]])
  [1,347] tex:write_html([[py_dict_as, [nospace('('), [nospace([])], nospace(')')]], html('</b>')])
  [1,344] tex:write_html([lref(func, 'py_dict_as()', [py_dict_as, [nospace('('), [nospace(...)], nospace(...)]]), html('</code>'), html('</td>'), html('</tr>'), html('<tr>'), html('<td>'), lref(..., ..., ...)|...])
     [16] tex:run_latex2html('/home/peter/src/swipl-devel/build.debug/packages/swipy/janus.tex')
     [15] tex:latex2html(janus, [quiet(true)])
     [12] catch_with_backtrace('<garbage_collected>', '<garbage_collected>', '<garbage_collected>')
     [11] tex:main('<garbage_collected>')
      [9] catch_with_backtrace('<garbage_collected>', '<garbage_collected>', '<garbage_collected>')
      [8] prolog_main:main
      [5] run_init_goal('<garbage_collected>', @(tex:main, '/home/peter/src/swipl-devel/build.debug/home/library/ext/ltx2htm/latex2html.pl':3225))
   Redo: (1,353) tex:write_html(nospace([])) ? a
ERROR: Execution Aborted

When I ran this as part of the build, I got:

FAILED: packages/swipy/janus.html 
cd /home/peter/src/swipl-devel/build.debug/packages/swipy && /home/peter/src/swipl-devel/build.debug/src/swipl -f none --no-packs /home/peter/src/swipl-devel/build.debug/home/library/ext/ltx2htm/latex2html.pl -- --quiet janus && /usr/bin/cmake -E remove /home/peter/src/swipl-devel/build.debug/home/doc/manindex.db
ERROR: put_html_token/1: instantiation error
   Redo: (1,353) tex:write_html(nospace([])) ? EOF: exit (status 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant