Back to index

texmacs  1.0.7.15
Functions | Variables
tm_debug.cpp File Reference
#include "tm_server.hpp"
#include "file.hpp"
#include "tm_link.hpp"
#include "sys_utils.hpp"

Go to the source code of this file.

Functions

string get_system_information ()
string path_as_string (path p)
string get_editor_status_report ()
void tree_report (string &s, tree t, path p, int indent)
string tree_report (tree t, path p)
string get_crash_report (const char *msg)
void tm_failure (const char *msg)

Variables

bool rescue_mode = false

Function Documentation

string get_crash_report ( const char *  msg)

Definition at line 111 of file tm_debug.cpp.

                                   {
  string r;
  r << "Error message:\n  " << msg << "\n"
    << "\n" << get_system_information ()
    << "\n" << get_editor_status_report ()
    << "\n" << get_stacktrace ();
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 60 of file tm_debug.cpp.

                            {
  string r;
  r << "Editor status:\n";
  server sv= get_server ();
  editor ed= sv -> get_editor ();
  path start_p, end_p;
  ed->get_selection (start_p, end_p);
  selection sel;
  ed->selection_get (sel);
  r << "  Root path          : "
    << path_as_string (ed->rp) << "\n"
    << "  Current path       : "
    << path_as_string (ed->the_path ()) << "\n"
    << "  Shifted path       : "
    << path_as_string (ed->the_shifted_path ()) << "\n"
    << "  Physical selection : "
    << path_as_string (start_p) << " -- "
    << path_as_string (end_p) << "\n"
    << "  Logical selection  : "
    << path_as_string (sel->start) << " -- "
    << path_as_string (sel->end) << "\n";
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 25 of file tm_debug.cpp.

                          {
  string r;
  r << "System information:\n";
  r << "  TeXmacs version  : "
    << TEXMACS_VERSION << "\n";
  r << "  Built by         : "
    << BUILD_USER << "\n";
  r << "  Building date    : "
    << BUILD_DATE << "\n";
  r << "  Operating system : "
    << HOST_OS << "\n";
  r << "  Vendor           : "
    << HOST_VENDOR << "\n";
  r << "  Processor        : "
    << HOST_CPU << "\n";
  r << "  Crash date       : "
    << var_eval_system ("date") << "\n";
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 46 of file tm_debug.cpp.

                        {
  if (is_nil (p)) return "[]";
  string r= "[ ";
  r << as_string (p->item);
  p= p->next;
  while (!is_nil (p)) {
    r << ", " << as_string (p->item);
    p= p->next;
  }
  r << " ]";
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tm_failure ( const char *  msg)

Definition at line 121 of file tm_debug.cpp.

                             {
  if (rescue_mode) {
    fprintf (stderr, "\nTeXmacs] Fatal unrecoverable error, %s\n", msg);
    exit (1);
  }
  rescue_mode= true;
  cerr << "\nTeXmacs] Fatal error, " << msg << "\n";

  string report= get_crash_report (msg);
  url dir ("$TEXMACS_HOME_PATH/system/crash");
  url err= url_numbered (dir, "crash_report_", "");
  if (!save_string (err, report))
    cerr << "TeXmacs] Crash report saved in " << err << "\n";
  else
    cerr << "TeXmacs] Crash report could not be saved in "
         << err << "\n"
         << "TeXmacs] Dumping report below\n\n"
         << report << "\n";

  server sv= get_server ();
  editor ed= sv -> get_editor ();
  string buf= tree_report (subtree (the_et, ed->rp), ed->rp);
  url buf_err= glue (err, "_tree");
  if (!save_string (buf_err, buf))
    cerr << "TeXmacs] Current buffer report saved in " << buf_err << "\n";
  else
    cerr << "TeXmacs] Current buffer report could not be saved in "
         << buf_err << "\n"
         << "TeXmacs] Dumping report below\n\n"
         << buf << "\n";

  auto_save ();
  close_all_pipes ();
  call ("quit-TeXmacs-scheme");
  clear_pending_commands ();
  //exit (1);
}

Here is the call graph for this function:

void tree_report ( string s,
tree  t,
path  p,
int  indent 
)

Definition at line 85 of file tm_debug.cpp.

                                                    {
  for (int i=0; i<indent; i++) s << " ";
  if (is_atomic (t)) {
    s << raw_quote (t->label);
    s << " -- " << path_as_string (p) << "\n";
  }
  else {
    s << as_string (L(t));
    s << " -- " << path_as_string (p) << "\n";
    for (int i=0; i<N(t); i++)
      tree_report (s, t[i], p * i, indent+2);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

string tree_report ( tree  t,
path  p 
)

Definition at line 100 of file tm_debug.cpp.

                               {
  string s;
  tree_report (s, t, p, 0);
  return s;
}

Here is the call graph for this function:


Variable Documentation

bool rescue_mode = false

Definition at line 18 of file tm_debug.cpp.