Functions

debug.cc File Reference

#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include "file-stat.h"
#include "singleton-cleanup.h"
#include "defun.h"
#include "error.h"
#include "help.h"
#include "input.h"
#include "pager.h"
#include "oct-obj.h"
#include "utils.h"
#include "parse.h"
#include "symtab.h"
#include "gripes.h"
#include "ov.h"
#include "ov-usr-fcn.h"
#include "ov-fcn.h"
#include "ov-struct.h"
#include "pt-pr-code.h"
#include "pt-bp.h"
#include "pt-eval.h"
#include "pt-stmt.h"
#include "toplev.h"
#include "unwind-prot.h"
#include "variables.h"
#include "debug.h"
Include dependency graph for debug.cc:

Go to the source code of this file.

Functions

 DEFALIAS (dbnext, dbstep)
 DEFUN (dbstop, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{rline} =} dbstop (\"@var{func}\")\n\ @deftypefnx {Loadable Function} {@var{rline} =} dbstop (\"@var{func}\", @var{line}, @dots{})\n\ Set a breakpoint in function @var{func}.\n\ \n\ Arguments are\n\ \n\ @table @var\n\ @item func\n\ Function name as a string variable. When already in debug\n\ mode this should be left out and only the line should be given.\n\ \n\ @item line\n\ Line number where the breakpoint should be set. Multiple\n\ lines may be given as separate arguments or as a vector.\n\ @end table\n\ \n\ When called with a single argument @var{func}, the breakpoint\n\ is set at the first executable line in the named function.\n\ \n\ The optional output @var{rline} is the real line number where the\n\ breakpoint was set. This can differ from specified line if\n\ the line is not executable. For example, if a breakpoint attempted on a\n\ blank line then Octave will set the real breakpoint at the\n\ next executable line.\n\ @seealso{dbclear, dbstatus, dbstep, debug_on_error, debug_on_warning, debug_on_interrupt}\n\ @end deftypefn")
 DEFUN (dbquit, args,,"-*- texinfo -*-\n\ @deftypefn {Command} {} dbquit\n\ Quit debugging mode immediately without further code execution and\n\ return to the Octave prompt.\n\ @seealso{dbcont, dbstep}\n\ @end deftypefn")
 DEFUN (dbcont, args,,"-*- texinfo -*-\n\ @deftypefn {Command} {} dbcont\n\ Leave command-line debugging mode and continue code execution normally.\n\ @seealso{dbstep, dbquit}\n\ @end deftypefn")
 DEFUN (dbstep, args,,"-*- texinfo -*-\n\ @deftypefn {Command} {} dbstep\n\ @deftypefnx {Command} {} dbstep @var{n}\n\ @deftypefnx {Command} {} dbstep in\n\ @deftypefnx {Command} {} dbstep out\n\ @deftypefnx {Command} {} dbnext @dots{}\n\ In debugging mode, execute the next @var{n} lines of code.\n\ If @var{n} is omitted, execute the next single line of code.\n\ If the next line of code is itself defined in terms of an m-file remain in\n\ the existing function.\n\ \n\ Using @code{dbstep in} will cause execution of the next line to step into\n\ any m-files defined on the next line. Using @code{dbstep out} will cause\n\ execution to continue until the current function returns.\n\ \n\ @code{dbnext} is an alias for @code{dbstep}.\n\ @seealso{dbcont, dbquit}\n\ @end deftypefn")
 DEFUN (dbstack, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} dbstack ()\n\ @deftypefnx {Loadable Function} {} dbstack (@var{n})\n\ @deftypefnx {Loadable Function} {[@var{stack}, @var{idx}] =} dbstack (@dots{})\n\ Display or return current debugging function stack information.\n\ With optional argument @var{n}, omit the @var{n} innermost stack frames.\n\ \n\ The optional return argument @var{stack} is a struct array with the\n\ following fields:\n\ \n\ @table @asis\n\ @item file\n\ The name of the m-file where the function code is located.\n\ \n\ @item name\n\ The name of the function with a breakpoint.\n\ \n\ @item line\n\ The line number of an active breakpoint.\n\ \n\ @item column\n\ The column number of the line where the breakpoint begins.\n\ \n\ @item scope\n\ Undocumented.\n\ \n\ @item context\n\ Undocumented.\n\ @end table\n\ \n\ The return argument @var{idx} specifies which element of the @var{stack}\n\ struct array is currently active.\n\ @seealso{dbup, dbdown, dbwhere, dbstatus}\n\ @end deftypefn")
 DEFUN (dbup, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} dbup\n\ @deftypefnx {Loadable Function} {} dbup (@var{n})\n\ In debugging mode, move up the execution stack @var{n} frames.\n\ If @var{n} is omitted, move up one frame.\n\ @seealso{dbstack, dbdown}\n\ @end deftypefn")
 DEFUN (dbdown, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} dbdown\n\ @deftypefnx {Loadable Function} {} dbdown (@var{n})\n\ In debugging mode, move down the execution stack @var{n} frames.\n\ If @var{n} is omitted, move down one frame.\n\ @seealso{dbstack, dbup}\n\ @end deftypefn")
 DEFUN (dbclear, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} dbclear (\"@var{func}\")\n\ @deftypefnx {Loadable Function} {} dbclear (\"@var{func}\", @var{line}, @dots{})\n\ Delete a breakpoint in the function @var{func}.\n\ \n\ Arguments are\n\ \n\ @table @var\n\ @item func\n\ Function name as a string variable. When already in debug\n\ mode this should be left out and only the line should be given.\n\ \n\ @item line\n\ Line number from which to remove a breakpoint. Multiple\n\ lines may be given as separate arguments or as a vector.\n\ @end table\n\ \n\ When called without a line number specification all breakpoints\n\ in the named function are cleared.\n\ \n\ If the requested line is not a breakpoint no action is performed.\n\ @seealso{dbstop, dbstatus, dbwhere}\n\ @end deftypefn")
 DEFUN (dbstatus, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} dbstatus ()\n\ @deftypefnx {Loadable Function} {@var{brk_list} =} dbstatus ()\n\ @deftypefnx {Loadable Function} {@var{brk_list} =} dbstatus (\"@var{func}\")\n\ Report the location of active breakpoints.\n\ \n\ When called with no input or output arguments, print the list of\n\ all functions with breakpoints and the line numbers where those\n\ breakpoints are set.\n\ If a function name @var{func} is specified then only report breakpoints\n\ for the named function.\n\ \n\ The optional return argument @var{brk_list} is a struct array with the\n\ following fields.\n\ \n\ @table @asis\n\ @item name\n\ The name of the function with a breakpoint.\n\ \n\ @item file\n\ The name of the m-file where the function code is located.\n\ \n\ @item line\n\ A line number, or vector of line numbers, with a breakpoint.\n\ @end table\n\ \n\ @seealso{dbclear, dbwhere}\n\ @end deftypefn")
 DEFUN (dbwhere,,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} dbwhere ()\n\ In debugging mode, report the current file and line number where\n\ execution is stopped.\n\ @seealso{dbstatus, dbcont, dbstep, dbup}\n\ @end deftypefn")
 DEFUN (dbtype, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} dbtype ()\n\ @deftypefnx {Loadable Function} {} dbtype (\"startl:endl\")\n\ @deftypefnx {Loadable Function} {} dbtype (\"@var{func}\")\n\ @deftypefnx {Loadable Function} {} dbtype (\"@var{func}\", \"startl:endl\")\n\ When in debugging mode and called with no arguments, list the script file\n\ being debugged with line numbers. An optional range specification,\n\ specified as a string, can be used to list only a portion of the file.\n\ \n\ When called with the name of a function, list that script file\n\ with line numbers.\n\ @seealso{dbstatus, dbstop}\n\ @end deftypefn")
 DEFUN (isdebugmode, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} isdebugmode ()\n\ Return true if in debugging mode, otherwise false.\n\ @seealso{dbwhere, dbstack, dbstatus}\n\ @end deftypefn")
static octave_value_list do_dbstack (const octave_value_list &args, int nargout, std::ostream &os)
void do_dbtype (std::ostream &os, const std::string &name, int start, int end)
static void do_dbupdown (const octave_value_list &args, const std::string &who)
std::string do_find_bkpt_list (octave_value_list slist, std::string match)
std::string get_file_line (const std::string &fname, size_t line)
static std::deque< size_t > get_line_offsets (const std::string &buf)
static octave_user_codeget_user_code (const std::string &fname=std::string())
static octave_value intmap_to_ov (const bp_table::intmap &line)
static void parse_dbfunction_params (const char *who, const octave_value_list &args, std::string &symbol_name, bp_table::intmap &lines)
void show_octave_dbstack (void)
static std::string snarf_file (const std::string &fname)

Function Documentation

DEFALIAS ( dbnext  ,
dbstep   
)
DEFUN ( dbstop  ,
args   
)
DEFUN ( dbquit  ,
args   
)
DEFUN ( dbcont  ,
args   
)
DEFUN ( dbstep  ,
args   
)
DEFUN ( dbstack  ,
args  ,
nargout   
)

Definition at line 1005 of file debug.cc.

References do_dbstack(), and octave_stdout.

DEFUN ( dbup  ,
args   
)

Definition at line 1073 of file debug.cc.

References do_dbupdown().

DEFUN ( dbdown  ,
args   
)

Definition at line 1089 of file debug.cc.

References do_dbupdown().

DEFUN ( dbclear  ,
args   
)

Definition at line 549 of file debug.cc.

References error_state, parse_dbfunction_params(), and bp_table::remove_breakpoint().

DEFUN ( dbstatus  ,
args  ,
nargout   
)
DEFUN ( dbwhere   ) 
DEFUN ( dbtype  ,
args   
)
DEFUN ( isdebugmode  ,
args   
)

Definition at line 1235 of file debug.cc.

References print_usage(), and Vdebugging.

static octave_value_list do_dbstack ( const octave_value_list args,
int  nargout,
std::ostream &  os 
) [static]
void do_dbtype ( std::ostream &  os,
const std::string &  name,
int  start,
int  end 
)

Definition at line 751 of file debug.cc.

References fcn_file_in_path().

Referenced by DEFUN().

static void do_dbupdown ( const octave_value_list args,
const std::string &  who 
) [static]
std::string do_find_bkpt_list ( octave_value_list  slist,
std::string  match 
)

Definition at line 424 of file debug.cc.

References octave_value_list::length().

Referenced by bp_table::do_get_breakpoint_list().

std::string get_file_line ( const std::string &  fname,
size_t  line 
)

Definition at line 132 of file debug.cc.

References get_line_offsets(), and snarf_file().

Referenced by DEFUN(), and get_debug_input().

static std::deque<size_t> get_line_offsets ( const std::string &  buf  )  [static]

Definition at line 98 of file debug.cc.

Referenced by get_file_line().

static octave_user_code* get_user_code ( const std::string &  fname = std::string ()  )  [static]
static octave_value intmap_to_ov ( const bp_table::intmap line  )  [static]

Definition at line 483 of file debug.cc.

References Array< T >::resize().

Referenced by DEFUN().

static void parse_dbfunction_params ( const char who,
const octave_value_list args,
std::string &  symbol_name,
bp_table::intmap lines 
) [static]
void show_octave_dbstack ( void   ) 

Definition at line 1000 of file debug.cc.

References do_dbstack().

static std::string snarf_file ( const std::string &  fname  )  [static]

Definition at line 65 of file debug.cc.

References error(), and base_file_stat::size().

Referenced by get_file_line().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines