annotate libinterp/corefcn/debug.cc @ 31605:e88a07dec498 stable

maint: Use macros to begin/end C++ namespaces. * oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE, OCTAVE_END_NAMESPACE) that can be used to start/end a namespace. * mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc, __dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc, auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc, display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h, mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc, pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, __delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc, ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h, anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author Rik <rik@octave.org>
date Thu, 01 Dec 2022 14:23:45 -0800
parents 23520a50d74d
children aac27ad79be6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30390
diff changeset
3 // Copyright (C) 2001-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
23137
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23127
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21703
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21259
diff changeset
27 # include "config.h"
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
28 #endif
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
29
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
30 #include <deque>
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
31 #include <fstream>
10839
65bc065bec95 still more debugger fixes
John W. Eaton <jwe@octave.org>
parents: 10315
diff changeset
32 #include <iomanip>
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
33 #include <iostream>
21703
4bf980861fd6 Allow breakpoints in nested functions, and in mixed subfunctions (bug #47917).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21662
diff changeset
34 #include <limits>
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
35 #include <set>
3948
126177939aae [project @ 2002-05-23 01:17:29 by jwe]
jwe
parents: 3947
diff changeset
36 #include <string>
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
37
23137
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23127
diff changeset
38 #include "dNDArray.h"
7082
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
39
23137
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23127
diff changeset
40 #include "bp-table.h"
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
41 #include "defun.h"
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
42 #include "error.h"
23137
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23127
diff changeset
43 #include "errwarn.h"
21258
b248c28d9a7b Make dbstatus return correct filename and function name (bug #41540).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21200
diff changeset
44 #include "file-ops.h"
7082
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
45 #include "help.h"
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
46 #include "input.h"
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
47 #include "interpreter-private.h"
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
48 #include "interpreter.h"
25548
d6050ba12c0c Call get_ASCII_filename for std::ifstream (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25402
diff changeset
49 #include "lo-sysdep.h"
20925
667861ffffab Extracted header class octave-preserve-stream-state from utils.{cc/h}.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20918
diff changeset
50 #include "octave-preserve-stream-state.h"
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
51 #include "ov-usr-fcn.h"
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
52 #include "ov.h"
23137
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23127
diff changeset
53 #include "ovl.h"
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23127
diff changeset
54 #include "pager.h"
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23127
diff changeset
55 #include "parse.h"
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
56 #include "pt-eval.h"
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
57 #include "unwind-prot.h"
17818
f1b59ef34eda attempt to avoid setting persistent state on i/o streams (bug #40396)
John W. Eaton <jwe@octave.org>
parents: 17787
diff changeset
58 #include "utils.h"
23137
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23127
diff changeset
59 #include "utils.h"
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
60 #include "variables.h"
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
61
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31603
diff changeset
62 OCTAVE_BEGIN_NAMESPACE(octave)
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29688
diff changeset
63
7082
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
64 static octave_value
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
65 bp_lines_to_ov (const octave::bp_table::bp_lines& lines)
7082
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
66 {
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
67 int idx = 0;
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
68
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
69 NDArray retval (dim_vector (1, lines.size ()));
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
70
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
71 for (const auto& lineno : lines)
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
72 retval(idx++) = lineno;
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
73
7082
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
74 retval.resize (dim_vector (1, idx));
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
75
7082
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
76 return retval;
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
77 }
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
78
25346
dd416c31761e access bp_table through interpreter where possible
John W. Eaton <jwe@octave.org>
parents: 25342
diff changeset
79 DEFMETHOD (dbstop, interp, args, ,
dd416c31761e access bp_table through interpreter where possible
John W. Eaton <jwe@octave.org>
parents: 25342
diff changeset
80 doc: /* -*- texinfo -*-
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
81 @deftypefn {} {} dbstop @var{fcn}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
82 @deftypefnx {} {} dbstop @var{fcn} @var{line}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
83 @deftypefnx {} {} dbstop @var{fcn} @var{line1} @var{line2} @dots{}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
84 @deftypefnx {} {} dbstop @var{line1} @dots{}
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
85 @deftypefnx {} {} dbstop in @var{fcn}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
86 @deftypefnx {} {} dbstop in @var{fcn} at @var{line}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
87 @deftypefnx {} {} dbstop in @var{fcn} at @var{line} if "@var{condition}"
26954
6e50f1fedeb5 dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents: 26899
diff changeset
88 @deftypefnx {} {} dbstop in @var{class} at @var{method}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
89 @deftypefnx {} {} dbstop if @var{event}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
90 @deftypefnx {} {} dbstop if @var{event} @var{ID}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
91 @deftypefnx {} {} dbstop (@var{bp_struct})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
92 @deftypefnx {} {@var{rline} =} dbstop @dots{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
93
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
94 Set breakpoints for the built-in debugger.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
95
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
96 @var{fcn} is the name of a function on the current @code{path}. When
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
97 already in debug mode the @var{fcn} argument can be omitted and the current
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
98 function will be used. Breakpoints at subfunctions are set with the scope
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
99 operator @samp{>}. For example, If @file{file.m} has a subfunction
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
100 @code{fcn2}, then a breakpoint in @code{fcn2} can be specified by
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
101 @code{file>fcn2}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
102
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
103 @var{line} is the line number at which to break. If @var{line} is not
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
104 specified, it defaults to the first executable line in the file
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
105 @file{fcn.m}. Multiple lines can be specified in a single command; when
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
106 function syntax is used, the lines may also be passed as a single vector
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
107 argument (@code{[@var{line1}, @var{line2}, @dots{}]}).
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
108
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
109 @var{condition} is any Octave expression that can be evaluated in the code
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
110 context that exists at the breakpoint. When the breakpoint is encountered,
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
111 @var{condition} will be evaluated, and execution will stop if
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
112 @var{condition} is true. If @var{condition} cannot be evaluated, for
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
113 example because it refers to an undefined variable, an error will be thrown.
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
114 Expressions with side effects (such as @code{y++ > 1}) will alter variables,
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
115 and should generally be avoided. Conditions containing quotes (@samp{"},
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
116 @samp{'}) or comment characters (@samp{#}, @samp{%}) must be enclosed in
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
117 quotes. (This does not apply to conditions entered from the editor's context
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
118 menu.) For example:
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
119
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
120 @example
25763
8dc8edbffa17 strread.m: Make m-file a legacy function.
Rik <rik@octave.org>
parents: 25646
diff changeset
121 dbstop in axis at 246 if 'any (opt == "x")'
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
122 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
123
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
124 The form specifying @var{event} does not cause a specific breakpoint at a given
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
125 function and line number. Instead it causes debug mode to be entered when
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
126 certain unexpected events are encountered. Possible values are
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
127
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
128 @table @code
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
129 @item error
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
130 Stop when an error is reported. This is equivalent to specifying both
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
131 @code{debug_on_error (true)} and @code{debug_on_interrupt (true)}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
132
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
133 @item caught error
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
134 Stop when an error is caught by a try-catch block (not yet implemented).
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
135
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
136 @item interrupt
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
137 Stop when an interrupt (@kbd{Ctrl-C}) occurs.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
138
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
139 @item naninf
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
140 Stop when code returns a non-finite value (not yet implemented).
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
141
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
142 @item warning
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
143 Stop when a warning is reported. This is equivalent to specifying
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
144 @code{debug_on_warning (true)}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
145 @end table
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
146
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
147 The events @code{error}, @code{caught error}, and @code{warning} can all be
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
148 followed by a string specifying an error ID or warning ID@. If that is done,
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
149 only errors with the specified ID will cause execution to stop. To stop on one
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
150 of a set of IDs, multiple @code{dbstop} commands must be issued.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
151
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
152 Breakpoints and events can be removed using the @code{dbclear} command with
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
153 the same syntax.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
154
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
155 It is possible to save all breakpoints and restore them at once by issuing
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
156 the commands @code{bp_state = dbstatus; @dots{}; dbstop (bp_state)}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
157
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
158 The optional output @var{rline} is the real line number where the breakpoint
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
159 was set. This can differ from the specified line if the line is not
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
160 executable. For example, if a breakpoint attempted on a blank line then Octave
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
161 will set the real breakpoint at the next executable line.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
162
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
163 When a file is re-parsed, such as when it is modified outside the GUI, all
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
164 breakpoints within the file are cleared.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
165
30329
81d26e8481a6 maint: Shorten @seealso lines to less than 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29958
diff changeset
166 @seealso{dbclear, dbstatus, dbstep, debug_on_error, debug_on_warning,
81d26e8481a6 maint: Shorten @seealso lines to less than 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29958
diff changeset
167 debug_on_interrupt}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
168 @end deftypefn */)
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
169 {
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
170 octave::bp_table::bp_lines retmap;
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
171 std::string symbol_name = ""; // stays empty for "dbstop if error" etc
26954
6e50f1fedeb5 dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents: 26899
diff changeset
172 std::string class_name = "";
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
173 octave::bp_table::bp_lines lines;
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
174 std::string condition = "";
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
175 octave_value retval;
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
176
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
177 octave::tree_evaluator& tw = interp.get_evaluator ();
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
178
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
179 octave::bp_table& bptab = tw.get_bp_table ();
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
180
23584
7ed6b258db91 maint: Deprecate is_map and replace with isstruct.
Rik <rik@octave.org>
parents: 23577
diff changeset
181 if (args.length() >= 1 && ! args(0).isstruct ())
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
182 {
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
183 // explicit function / line / condition
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
184 bptab.parse_dbfunction_params ("dbstop", args, symbol_name,
26954
6e50f1fedeb5 dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents: 26899
diff changeset
185 class_name, lines, condition);
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
186
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
187 if (lines.size () == 0)
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
188 lines.insert (1);
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
189
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
190 if (symbol_name != "")
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
191 {
29458
c0f86150aa6c begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents: 29457
diff changeset
192 retmap = bptab.add_breakpoints_in_function (symbol_name, class_name,
c0f86150aa6c begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents: 29457
diff changeset
193 lines, condition);
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
194 retval = bp_lines_to_ov (retmap);
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
195 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
196 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
197 else if (args.length () != 1)
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
198 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
199 print_usage ();
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
200 }
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
201 else // structure of the form output by dbstatus
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
202 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
203 octave_map mv = args(0).map_value ();
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
204 if (mv.isfield ("bkpt") || mv.isfield ("errs") || mv.isfield ("warn")
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
205 || mv.isfield ("intr"))
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
206 {
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
207 bptab.dbstop_process_map_args (mv);
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 6317
diff changeset
208
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
209 // Replace mv by "bkpt", to use the processing below.
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
210 octave_value bkpt = mv.getfield ("bkpt");
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
211 if (bkpt.isempty ())
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
212 mv = octave_map ();
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
213 else
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
214 {
23576
00e518162fda maint: Deprecate is_cell and replace with iscell.
Rik <rik@octave.org>
parents: 23553
diff changeset
215 if (bkpt.iscell () && bkpt.cell_value ().numel () > 0
23584
7ed6b258db91 maint: Deprecate is_map and replace with isstruct.
Rik <rik@octave.org>
parents: 23577
diff changeset
216 && bkpt.cell_value () (0).isstruct ())
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
217 mv = bkpt.cell_value () (0).map_value ();
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
218 else
28975
bbff46267cad maint: Remove redundant never-executed statements following error() in libinterp/.
Rik <rik@octave.org>
parents: 28961
diff changeset
219 error ("dbstop: invalid 'bkpt' field");
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
220 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
221 }
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
222 if (mv.isempty ())
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
223 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
224 // no changes requested. Occurs if "errs" non-empty but "bkpt" empty
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
225 }
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
226 else if (! mv.isfield ("name") || ! mv.isfield ("line"))
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
227 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
228 error ("dbstop: Cell array must contain fields 'name' and 'line'");
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
229 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
230 else
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
231 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
232 bool use_cond = mv.isfield ("cond");
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
233 Cell name = mv.getfield ("name");
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
234 Cell line = mv.getfield ("line");
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
235 Cell cond = (use_cond ? mv.getfield ("cond") : Cell ());
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
236 std::string unconditional = "";
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
237 for (octave_idx_type i = 0; i < line.numel (); i++)
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
238 {
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
239 lines.insert (line(i).int_value ());
29458
c0f86150aa6c begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents: 29457
diff changeset
240 bptab.add_breakpoints_in_function (name(i).string_value (),
c0f86150aa6c begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents: 29457
diff changeset
241 "", lines,
c0f86150aa6c begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents: 29457
diff changeset
242 (use_cond
c0f86150aa6c begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents: 29457
diff changeset
243 ? cond(i).string_value ()
c0f86150aa6c begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents: 29457
diff changeset
244 : unconditional));
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
245 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
246 retval = octave_value (line.numel ());
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
247 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
248 }
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
249
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
250 // If we add a breakpoint, we also need to reset debug_mode.
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
251 tw.reset_debug_state ();
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
252
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
253 return retval;
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
254 }
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
255
25346
dd416c31761e access bp_table through interpreter where possible
John W. Eaton <jwe@octave.org>
parents: 25342
diff changeset
256 DEFMETHOD (dbclear, interp, args, ,
dd416c31761e access bp_table through interpreter where possible
John W. Eaton <jwe@octave.org>
parents: 25342
diff changeset
257 doc: /* -*- texinfo -*-
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
258 @deftypefn {} {} dbclear @var{fcn}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
259 @deftypefnx {} {} dbclear @var{fcn} @var{line}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
260 @deftypefnx {} {} dbclear @var{fcn} @var{line1} @var{line2} @dots{}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
261 @deftypefnx {} {} dbclear @var{line} @dots{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
262 @deftypefnx {} {} dbclear all
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
263 @deftypefnx {} {} dbclear in @var{fcn}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
264 @deftypefnx {} {} dbclear in @var{fcn} at @var{line}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
265 @deftypefnx {} {} dbclear if @var{event}
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
266 @deftypefnx {} {} dbclear ("@var{fcn}")
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
267 @deftypefnx {} {} dbclear ("@var{fcn}", @var{line})
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
268 @deftypefnx {} {} dbclear ("@var{fcn}", @var{line1}, @var{line2}, @dots{})
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
269 @deftypefnx {} {} dbclear ("@var{fcn}", @var{line1}, @dots{})
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
270 @deftypefnx {} {} dbclear (@var{line}, @dots{})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
271 @deftypefnx {} {} dbclear ("all")
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
272 Delete a breakpoint at line number @var{line} in the function @var{fcn}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
273
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
274 Arguments are
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
275
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
276 @table @var
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
277 @item fcn
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
278 Function name as a string variable. When already in debug mode this
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
279 argument can be omitted and the current function will be used.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
280
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
281 @item line
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
282 Line number from which to remove a breakpoint. Multiple lines may be given
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
283 as separate arguments or as a vector.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
284
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
285 @item event
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
286 An event such as @code{error}, @code{interrupt}, or @code{warning}
28961
d9d028b479ac doc: Use @code{} within alternate text for @xref,@pxref macros in libinterp/
Rik <rik@octave.org>
parents: 28823
diff changeset
287 (@pxref{XREFdbstop,,@code{dbstop}} for details).
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
288 @end table
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
289
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
290 When called without a line number specification all breakpoints in the named
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
291 function are cleared.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
292
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
293 If the requested line is not a breakpoint no action is performed.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
294
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
295 The special keyword @qcode{"all"} will clear all breakpoints from all
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
296 files.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
297 @seealso{dbstop, dbstatus, dbwhere}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
298 @end deftypefn */)
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
299 {
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
300 std::string symbol_name = ""; // stays empty for "dbclear if error" etc
26954
6e50f1fedeb5 dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents: 26899
diff changeset
301 std::string class_name = "";
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
302 octave::bp_table::bp_lines lines;
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
303 std::string dummy; // "if" condition -- only used for dbstop
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
304
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
305 octave::tree_evaluator& tw = interp.get_evaluator ();
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
306
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
307 octave::bp_table& bptab = tw.get_bp_table ();
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
308
29457
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
309 bptab.parse_dbfunction_params ("dbclear", args, symbol_name, class_name,
313b8b897733 revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
310 lines, dummy);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
311
31603
23520a50d74d maint: Review C++ files for style and coding conventions.
Rik <rik@octave.org>
parents: 31105
diff changeset
312 if (args.length () == 1 && symbol_name == "all")
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
313 {
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
314 bptab.remove_all_breakpoints ();
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
315 bptab.dbclear_all_signals ();
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
316 }
18379
80d39575fd44 Add new input keyword "all" for dbclear to remove all breakpoints.
Rik <rik@octave.org>
parents: 18377
diff changeset
317 else
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
318 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
319 if (symbol_name != "")
29458
c0f86150aa6c begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents: 29457
diff changeset
320 bptab.remove_breakpoints_from_function (symbol_name, lines);
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
321 }
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
322
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
323 // If we remove a breakpoint, we also need to reset debug_mode.
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
324 tw.reset_debug_state ();
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
325
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
326 return ovl ();
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
327 }
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
328
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23675
diff changeset
329 DEFMETHOD (dbstatus, interp, args, nargout,
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23675
diff changeset
330 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
331 @deftypefn {} {} dbstatus
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
332 @deftypefnx {} {} dbstatus @var{fcn}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
333 @deftypefnx {} {@var{bp_list} =} dbstatus @dots{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
334 Report the location of active breakpoints.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
335
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
336 When called with no input or output arguments, print the list of all
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
337 functions with breakpoints and the line numbers where those breakpoints are
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
338 set.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
339
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
340 If a function name @var{fcn} is specified then only report breakpoints
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
341 for the named function and its subfunctions.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
342
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
343 The optional return argument @var{bp_list} is a struct array with the
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30570
diff changeset
344 following fields:
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
345
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
346 @table @asis
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
347 @item name
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
348 The name of the function with a breakpoint. A subfunction, say @code{fcn2}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
349 within an m-file, say @file{file.m}, is specified as @code{file>fcn2}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
350
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
351 @item file
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
352 The name of the m-file where the function code is located.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
353
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
354 @item line
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
355 The line number with the breakpoint.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
356
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
357 @item cond
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
358 The condition that must be satisfied for the breakpoint to be active, or
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
359 the empty string for unconditional breakpoints.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
360 @end table
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
361
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
362 @c Note: When @code{dbstatus} is called from the debug prompt within a function,
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
363 @c the list of breakpoints is automatically trimmed to the breakpoints in the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
364 @c current function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
365 If @code{dbstop if error} is true but no explicit IDs are specified, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
366 return value will have an empty field called @qcode{"errs"}. If IDs are
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
367 specified, the @code{errs} field will have one row per ID@. If
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
368 @code{dbstop if error} is false, there is no @qcode{"errs"} field.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
369 The @qcode{"warn"} field is set similarly by @code{dbstop if warning}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
370
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
371 @seealso{dbstop, dbclear, dbwhere, dblist, dbstack}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
372 @end deftypefn */)
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
373 {
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
374 int nargin = args.length ();
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
375
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
376 if (nargin != 0 && nargin != 1)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
377 error ("dbstatus: only zero or one arguments accepted\n");
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
378
7082
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
379 octave_value_list fcn_list;
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
380 octave::bp_table::fname_bp_map bp_list;
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
381 std::string symbol_name;
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
382
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
383 octave::tree_evaluator& tw = interp.get_evaluator ();
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
384
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
385 octave::bp_table& bptab = tw.get_bp_table ();
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
386
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
387 if (nargin == 1)
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
388 {
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
389 if (! args(0).is_string ())
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21094
diff changeset
390 err_wrong_type_arg ("dbstatus", args(0));
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
391
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
392 symbol_name = args(0).string_value ();
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
393 fcn_list(0) = symbol_name;
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
394 bp_list = bptab.get_breakpoint_list (fcn_list);
7082
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
395 }
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
396 else
ac7179f00422 [project @ 2007-10-31 01:24:12 by jwe]
jwe
parents: 7017
diff changeset
397 {
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
398 /*
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
399 if (tw.in_debug_repl ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17753
diff changeset
400 {
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
401 octave_user_code *dbg_fcn = tw.get_user_code ();
18376
bb162f81881d Correctly return all breakpoints when called with no arguments (bug #41338).
Rik <rik@octave.org>
parents: 18375
diff changeset
402 if (dbg_fcn)
bb162f81881d Correctly return all breakpoints when called with no arguments (bug #41338).
Rik <rik@octave.org>
parents: 18375
diff changeset
403 {
bb162f81881d Correctly return all breakpoints when called with no arguments (bug #41338).
Rik <rik@octave.org>
parents: 18375
diff changeset
404 symbol_name = dbg_fcn->name ();
bb162f81881d Correctly return all breakpoints when called with no arguments (bug #41338).
Rik <rik@octave.org>
parents: 18375
diff changeset
405 fcn_list(0) = symbol_name;
bb162f81881d Correctly return all breakpoints when called with no arguments (bug #41338).
Rik <rik@octave.org>
parents: 18375
diff changeset
406 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17753
diff changeset
407 }
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
408 */
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
409
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
410 bp_list = bptab.get_breakpoint_list (fcn_list);
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
411 }
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
412
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
413 if (nargout == 0)
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
414 {
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
415 // Print out the breakpoint information.
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
416
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
417 for (auto& fnm_bp_p: bp_list)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
418 {
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
419 std::list<octave::bp_type> m = fnm_bp_p.second;
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
420
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
421 // print unconditional breakpoints, if any, on a single line
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
422
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
423 // first, check to see if there are any
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
424 int have_unconditional = 0;
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
425 for (const auto& bp : m)
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
426 {
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
427 if (bp.cond == "")
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
428 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
429 if (have_unconditional++)
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
430 break; // stop once we know its plural
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
431 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
432 }
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
433 // If we actually have some, print line numbers only
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
434 if (have_unconditional)
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
435 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
436 const char *_s_ = (have_unconditional > 1) ? "s" : "";
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23728
diff changeset
437 octave_stdout << "breakpoint" << _s_ << " in " << fnm_bp_p.first
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23728
diff changeset
438 << " at line" << _s_ << ' ';
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
439
21877
dc0347131364 maint: More code cleanup for debug.cc and C++11.
Rik <rik@octave.org>
parents: 21875
diff changeset
440 for (const auto& bp : m)
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
441 {
21877
dc0347131364 maint: More code cleanup for debug.cc and C++11.
Rik <rik@octave.org>
parents: 21875
diff changeset
442 if (bp.cond == "")
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23728
diff changeset
443 octave_stdout << bp.line << ' ';
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
444 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
445 octave_stdout << std::endl;
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
446 }
14228
0beb62668d69 Use correct plural for dbstatus if there is more than 1 breakpoint set in file.
Rik <octave@nomad.inbox5.com>
parents: 14227
diff changeset
447
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
448 // print conditional breakpoints, one per line, with conditions
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
449 for (const auto& bp : m)
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
450 {
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
451 if (bp.cond != "")
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
452 octave_stdout << "breakpoint in " << fnm_bp_p.first
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
453 << " at line " << bp.line
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
454 << " if " << bp.cond << "\n";
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
455 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
456 }
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
457
24738
3695c2cd69b8 don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
458 bptab.stop_on_err_warn_status (true);
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
459
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
460 return ovl ();
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
461 }
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
462 else
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
463 {
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23675
diff changeset
464 octave::help_system& help_sys = interp.get_help_system ();
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23675
diff changeset
465
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
466 // Fill in an array for return.
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
467 int i = 0;
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
468 octave_map retmap;
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
469 octave_value retval;
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
470
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
471 // count the number of breakpoints in all files
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
472 int count = 0;
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
473 for (const auto& fnm_bp_p : bp_list)
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
474 count += fnm_bp_p.second.size ();
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
475
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
476 Cell names (dim_vector (count, 1));
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
477 Cell file (dim_vector (count, 1));
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
478 Cell line (dim_vector (count, 1));
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
479 Cell cond (dim_vector (count, 1));
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
480
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
481 for (const auto& fnm_bp_p : bp_list)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
482 {
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
483 std::string filename = fnm_bp_p.first;
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
484 const char *sub_fcn = strchr (filename.c_str (), '>');
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
485 if (sub_fcn)
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
486 filename = filename.substr(0, sub_fcn - filename.c_str ());
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
487 octave_value path_name;
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23675
diff changeset
488 path_name
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23675
diff changeset
489 = octave::sys::canonicalize_file_name (help_sys.which (filename));
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
490
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
491 for (const auto& bp : fnm_bp_p.second)
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
492 {
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
493 names(i) = fnm_bp_p.first;
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
494 file(i) = path_name;
21875
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
495 line(i) = octave_value (bp.line);
6c09e42b7ac4 debug.[cc|h]: Use C++ for-range syntax.
Rik <rik@octave.org>
parents: 21758
diff changeset
496 cond(i) = octave_value (bp.cond);
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
497 i++;
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
498 }
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
499 }
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
500
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
501 retmap.assign ("name", names);
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
502 retmap.assign ("file", file);
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
503 retmap.assign ("line", line);
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
504 retmap.assign ("cond", cond);
7083
24fde8abfb90 [project @ 2007-10-31 02:12:16 by jwe]
jwe
parents: 7082
diff changeset
505
25342
416856765a55 be more careful with using auto in place of explicit const iterator decls
John W. Eaton <jwe@octave.org>
parents: 25337
diff changeset
506 const octave_map ew = bptab.stop_on_err_warn_status (false);
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
507 if (ew.isempty ())
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
508 {
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
509 retval = octave_value (retmap);
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
510 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
511 else
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
512 {
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30329
diff changeset
513 octave_map outer (dim_vector (3, 1));
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
514 outer.assign ("bkpt", Cell (retmap));
25337
3ff9192b676e use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents: 25185
diff changeset
515 for (auto f = ew.begin (); f != ew.end (); f++)
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
516 outer.setfield (f->first, ew.contents (f));
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
517
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
518 retval = octave_value (outer);
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
519 }
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
520
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21127
diff changeset
521 return retval;
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
522 }
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
523 }
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
524
21258
b248c28d9a7b Make dbstatus return correct filename and function name (bug #41540).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21200
diff changeset
525 /*
b248c28d9a7b Make dbstatus return correct filename and function name (bug #41540).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21200
diff changeset
526 %!test
25645
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
527 %! if (isguirunning ())
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27240
diff changeset
528 %! orig_show_dbg = __event_manager_gui_preference__ ("editor/show_dbg_file",
30570
d3b1d0e770e2 Update debug BIST test failing after cset 82b685157e2b.
Rik <rik@octave.org>
parents: 30565
diff changeset
529 %! "0");
25645
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
530 %! endif
25828
8b548f2f8086 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 25763
diff changeset
531 %! unwind_protect
25645
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
532 %! dbclear all; # Clear out breakpoints before test
26899
236d8f52cbb3 identify "x .foo@bar" or "x @foo" as command syntax (bug #55891)
John W. Eaton <jwe@octave.org>
parents: 26708
diff changeset
533 %! dbstop @ftp/dir;
30570
d3b1d0e770e2 Update debug BIST test failing after cset 82b685157e2b.
Rik <rik@octave.org>
parents: 30565
diff changeset
534 %! dbstop @audioplayer/set 75;
25645
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
535 %! dbstop quantile>__quantile__;
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
536 %! dbstop ls;
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
537 %! s = dbstatus;
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
538 %! dbclear all;
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
539 %! assert (s(1).name, "@audioplayer/set>setproperty");
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
540 %! assert (s(2).name, "@ftp/dir");
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
541 %! assert (s(3).name, "ls");
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
542 %! assert (s(4).name, "quantile>__quantile__");
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
543 %! assert (s(2).file(end-10:end), [filesep "@ftp" filesep "dir.m"]);
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
544 %! unwind_protect_cleanup
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
545 %! if (isguirunning ())
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27240
diff changeset
546 %! __event_manager_gui_preference__ ("editor/show_dbg_file", orig_show_dbg);
25645
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
547 %! endif
0214d9dabba2 Disable opening GUI editor on breakpoints when running BIST tests for dbstop (bug #49119)
Rik <rik@octave.org>
parents: 25604
diff changeset
548 %! end_unwind_protect
21258
b248c28d9a7b Make dbstatus return correct filename and function name (bug #41540).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21200
diff changeset
549 */
b248c28d9a7b Make dbstatus return correct filename and function name (bug #41540).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21200
diff changeset
550
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
551 DEFMETHOD (dbwhere, interp, , ,
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
552 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
553 @deftypefn {} {} dbwhere
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
554 In debugging mode, report the current file and line number where execution
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
555 is stopped.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
556 @seealso{dbstack, dblist, dbstatus, dbcont, dbstep, dbup, dbdown}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
557 @end deftypefn */)
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
558 {
27205
6648d1ae05fe eliminate direct access to call stack in debug functions
John W. Eaton <jwe@octave.org>
parents: 27037
diff changeset
559 octave::tree_evaluator& tw = interp.get_evaluator ();
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
560
27205
6648d1ae05fe eliminate direct access to call stack in debug functions
John W. Eaton <jwe@octave.org>
parents: 27037
diff changeset
561 tw.debug_where (octave_stdout);
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
562
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
563 return ovl ();
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
564 }
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
565
23143
898c33f4b9c0 declare some functions that are only used once "static"
John W. Eaton <jwe@octave.org>
parents: 23137
diff changeset
566 static void
3949
294f13627ee8 [project @ 2002-05-23 01:22:11 by jwe]
jwe
parents: 3948
diff changeset
567 do_dbtype (std::ostream& os, const std::string& name, int start, int end)
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
568 {
25646
4d565baa475e move libinterp/utils functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25645
diff changeset
569 std::string ff = octave::fcn_file_in_path (name);
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
570
21077
40f931a63a91 Undo incorrect if/else inversion in cset 3aa293be0e8d.
Rik <rik@octave.org>
parents: 21017
diff changeset
571 if (ff.empty ())
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
572 os << "dbtype: unknown function " << name << "\n";
21077
40f931a63a91 Undo incorrect if/else inversion in cset 3aa293be0e8d.
Rik <rik@octave.org>
parents: 21017
diff changeset
573 else
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
574 {
28467
159b6a1eb408 Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
575 std::ifstream fs = octave::sys::ifstream (ff.c_str (), std::ios::in);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
576
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
577 if (! fs)
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
578 os << "dbtype: unable to open '" << ff << "' for reading!\n";
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
579 else
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
580 {
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
581 int line = 1;
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
582 std::string text;
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
583
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
584 while (std::getline (fs, text) && line <= end)
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
585 {
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
586 if (line >= start)
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
587 os << line << "\t" << text << "\n";
21077
40f931a63a91 Undo incorrect if/else inversion in cset 3aa293be0e8d.
Rik <rik@octave.org>
parents: 21017
diff changeset
588
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
589 line++;
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22323
diff changeset
590 }
21077
40f931a63a91 Undo incorrect if/else inversion in cset 3aa293be0e8d.
Rik <rik@octave.org>
parents: 21017
diff changeset
591 }
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
592 }
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
593
6646
bd0a70c3f2db [project @ 2007-05-22 02:27:43 by jwe]
jwe
parents: 6317
diff changeset
594 os.flush ();
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
595 }
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
596
25347
af3319d86a5f eliminate some global references to interpreter internals
John W. Eaton <jwe@octave.org>
parents: 25346
diff changeset
597 DEFMETHOD (dbtype, interp, args, ,
af3319d86a5f eliminate some global references to interpreter internals
John W. Eaton <jwe@octave.org>
parents: 25346
diff changeset
598 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
599 @deftypefn {} {} dbtype
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
600 @deftypefnx {} {} dbtype @var{lineno}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
601 @deftypefnx {} {} dbtype @var{startl:endl}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
602 @deftypefnx {} {} dbtype @var{startl:end}
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
603 @deftypefnx {} {} dbtype @var{fcn}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
604 @deftypefnx {} {} dbtype @var{fcn} @var{lineno}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
605 @deftypefnx {} {} dbtype @var{fcn} @var{startl:endl}
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
606 @deftypefnx {} {} dbtype @var{fcn} @var{startl:end}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
607 Display a script file with line numbers.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
608
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
609 When called with no arguments in debugging mode, display the script file
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
610 currently being debugged.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
611
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
612 An optional range specification can be used to list only a portion of the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
613 file. The special keyword @qcode{"end"} is a valid line number
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
614 specification for the last line of the file.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
615
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
616 When called with the name of a function, list that script file with line
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
617 numbers.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
618 @seealso{dblist, dbwhere, dbstatus, dbstop}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
619 @end deftypefn */)
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
620 {
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7539
diff changeset
621 octave_user_code *dbg_fcn;
3946
eab957395758 [project @ 2002-05-23 00:42:15 by jwe]
jwe
parents: 3895
diff changeset
622
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
623 string_vector argv = args.make_argv ("dbtype");
3946
eab957395758 [project @ 2002-05-23 00:42:15 by jwe]
jwe
parents: 3895
diff changeset
624
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
625 octave::tree_evaluator& tw = interp.get_evaluator ();
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
626
20819
f428cbe7576f eliminate unnecessary uses of nargin
John W. Eaton <jwe@octave.org>
parents: 20817
diff changeset
627 switch (args.length ())
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
628 {
21259
4ee768b71a0e maint: Clean up debug.cc file.
Rik <rik@octave.org>
parents: 21258
diff changeset
629 case 0: // dbtype
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
630 dbg_fcn = tw.get_user_code ();
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
631
20980
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
632 if (! dbg_fcn)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
633 error ("dbtype: must be inside a user function to give no arguments to dbtype\n");
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
634
20980
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
635 do_dbtype (octave_stdout, dbg_fcn->fcn_file_name (),
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
636 0, std::numeric_limits<int>::max ());
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
637
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
638 break;
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
639
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
640 case 1: // (dbtype start:end) || (dbtype fcn) || (dbtype lineno)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
641 {
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
642 std::string arg = argv[1];
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
643
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
644 std::size_t ind = arg.find (':');
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
645
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
646 if (ind != std::string::npos) // (dbtype start:end)
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
647 {
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
648 dbg_fcn = tw.get_user_code ();
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
649
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
650 if (dbg_fcn)
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
651 {
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
652 std::string start_str = arg.substr (0, ind);
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
653 std::string end_str = arg.substr (ind + 1);
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
654
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
655 int start, end;
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
656 start = atoi (start_str.c_str ());
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
657 if (end_str == "end")
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
658 end = std::numeric_limits<int>::max ();
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
659 else
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
660 end = atoi (end_str.c_str ());
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
661
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
662 if (std::min (start, end) <= 0)
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20819
diff changeset
663 error ("dbtype: start and end lines must be >= 1\n");
18393
6a2cc29f55fc Correctly handle 'dbtype lineno' case.
Rik <rik@octave.org>
parents: 18392
diff changeset
664
20980
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
665 if (start > end)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
666 error ("dbtype: start line must be less than end line\n");
20980
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
667
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
668 do_dbtype (octave_stdout, dbg_fcn->fcn_file_name (),
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
669 start, end);
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
670 }
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
671 }
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
672 else // (dbtype fcn) || (dbtype lineno)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
673 {
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
674 int line = atoi (arg.c_str ());
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
675
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
676 if (line == 0) // (dbtype fcn)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
677 {
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
678 dbg_fcn = tw.get_user_code (arg);
14227
c24833c6ebc2 Add error messages to dbtype(). Allow use of "end" keyword in linespec.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
679
20980
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
680 if (! dbg_fcn)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
681 error ("dbtype: function <%s> not found\n", arg.c_str ());
20980
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
682
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
683 do_dbtype (octave_stdout, dbg_fcn->fcn_file_name (),
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
684 0, std::numeric_limits<int>::max ());
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
685 }
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
686 else // (dbtype lineno)
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
687 {
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
688 if (line <= 0)
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20819
diff changeset
689 error ("dbtype: start and end lines must be >= 1\n");
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
690
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
691 dbg_fcn = tw.get_user_code ();
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
692
14227
c24833c6ebc2 Add error messages to dbtype(). Allow use of "end" keyword in linespec.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
693 if (dbg_fcn)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
694 do_dbtype (octave_stdout, dbg_fcn->fcn_file_name (),
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
695 line, line);
14227
c24833c6ebc2 Add error messages to dbtype(). Allow use of "end" keyword in linespec.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
696 }
c24833c6ebc2 Add error messages to dbtype(). Allow use of "end" keyword in linespec.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
697 }
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
698 }
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
699 break;
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
700
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30888
diff changeset
701 case 2: // (dbtype fcn start:end) || (dbtype fcn start)
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
702 {
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
703 dbg_fcn = tw.get_user_code (argv[1]);
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
704
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
705 if (! dbg_fcn)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
706 error ("dbtype: function <%s> not found\n", argv[1].c_str ());
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
707
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
708 std::string arg = argv[2];
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
709 int start, end;
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
710 std::size_t ind = arg.find (':');
6317
8c67f8be341d [project @ 2007-02-16 08:10:53 by jwe]
jwe
parents: 5744
diff changeset
711
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
712 if (ind != std::string::npos)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
713 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
714 std::string start_str = arg.substr (0, ind);
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
715 std::string end_str = arg.substr (ind + 1);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
716
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
717 start = atoi (start_str.c_str ());
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
718 if (end_str == "end")
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
719 end = std::numeric_limits<int>::max ();
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
720 else
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
721 end = atoi (end_str.c_str ());
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
722 }
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
723 else
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
724 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
725 start = atoi (arg.c_str ());
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
726 end = start;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
727 }
14227
c24833c6ebc2 Add error messages to dbtype(). Allow use of "end" keyword in linespec.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
728
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
729 if (std::min (start, end) <= 0)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
730 error ("dbtype: start and end lines must be >= 1\n");
20980
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
731
81c2b14c209f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
732 if (start > end)
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
733 error ("dbtype: start line must be less than end line\n");
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
734
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
735 do_dbtype (octave_stdout, dbg_fcn->fcn_file_name (), start, end);
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
736 }
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
737 break;
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
738
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
739 default:
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
740 error ("dbtype: expecting zero, one, or two arguments\n");
3895
d38c7538b954 [project @ 2002-04-10 19:18:39 by jwe]
jwe
parents: 3805
diff changeset
741 }
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
742
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
743 return ovl ();
3805
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
744 }
44386b0e53da [project @ 2001-03-01 16:54:31 by jwe]
jwe
parents:
diff changeset
745
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
746 DEFMETHOD (dblist, interp, args, ,
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
747 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
748 @deftypefn {} {} dblist
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
749 @deftypefnx {} {} dblist @var{n}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
750 In debugging mode, list @var{n} lines of the function being debugged
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
751 centered around the current line to be executed.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
752
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
753 If unspecified @var{n} defaults to 10 (+/- 5 lines)
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
754 @seealso{dbwhere, dbtype, dbstack}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
755 @end deftypefn */)
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
756 {
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
757 int n = 10;
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
758
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
759 if (args.length () == 1)
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
760 {
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
761 octave_value arg = args(0);
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
762
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
763 if (arg.is_string ())
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
764 {
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
765 std::string s_arg = arg.string_value ();
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
766
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
767 n = atoi (s_arg.c_str ());
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
768 }
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
769 else
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
770 n = args(0).int_value ();
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
771
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
772 if (n < 0)
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
773 error ("dblist: N must be a non-negative integer");
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
774 }
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
775
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
776 octave::tree_evaluator& tw = interp.get_evaluator ();
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
777
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
778 octave_user_code *dbg_fcn = tw.get_user_code ();
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
779
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
780 if (! dbg_fcn)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
781 error ("dblist: must be inside a user function to use dblist\n");
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
782
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
783 bool have_file = true;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
784
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
785 std::string name = dbg_fcn->fcn_file_name ();
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
786
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
787 if (name.empty ())
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
788 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
789 have_file = false;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
790 name = dbg_fcn->name ();
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
791 }
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
792
27205
6648d1ae05fe eliminate direct access to call stack in debug functions
John W. Eaton <jwe@octave.org>
parents: 27037
diff changeset
793 int l = tw.debug_user_code_line ();
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
794
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
795 if (l > 0)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
796 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
797 if (have_file)
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
798 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
799 int l_min = std::max (l - n/2, 0);
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
800 int l_max = l + n/2;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
801 do_dbtype (octave_stdout, name, l_min, l-1);
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
802
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
803 std::string line = dbg_fcn->get_code_line (l);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
804
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
805 if (! line.empty ())
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
806 octave_stdout << l << "-->\t" << line << std::endl;
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
807
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
808 do_dbtype (octave_stdout, name, l+1, l_max);
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
809 }
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
810 }
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
811 else
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
812 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
813 octave_stdout << "dblist: unable to determine source code line"
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
814 << std::endl;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
815 }
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
816
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
817 return ovl ();
16842
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
818 }
035b5fe157ad Add new dblist command to debugger (bug #38953)
Rik <rik@octave.org>
parents: 16771
diff changeset
819
13689
b68d95054947 print show_octave_dbstack output to std::cerr
John W. Eaton <jwe@octave.org>
parents: 13326
diff changeset
820 static octave_value_list
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
821 do_dbstack (octave::interpreter& interp, const octave_value_list& args,
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
822 int nargout, std::ostream& os)
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
823 {
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
824 int nargin = args.length ();
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
825
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
826 if (nargin > 2)
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
827 print_usage ();
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
828
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
829 octave_value_list retval;
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
830
7901
3e4c9b69069d call stack changes
John W. Eaton <jwe@octave.org>
parents: 7897
diff changeset
831 octave_idx_type curr_frame = -1;
7890
73ef513855e7 dbstack fixes
John W. Eaton <jwe@octave.org>
parents: 7818
diff changeset
832
29672
68d64190da65 Return proper number of stack frames for dbstack (N) call (bug #60531).
Rik <rik@octave.org>
parents: 29656
diff changeset
833 octave_idx_type nskip = 0;
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
834
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
835 if (nargin == 1 || nargin == 2)
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
836 {
7890
73ef513855e7 dbstack fixes
John W. Eaton <jwe@octave.org>
parents: 7818
diff changeset
837 int n = 0;
73ef513855e7 dbstack fixes
John W. Eaton <jwe@octave.org>
parents: 7818
diff changeset
838
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
839 for (octave_idx_type i = 0; i < nargin; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
840 {
17649
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
841 octave_value arg = args(i);
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
842
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
843 if (arg.is_string ())
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
844 {
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
845 std::string s_arg = arg.string_value ();
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
846
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
847 // Skip "-completenames", octave returns full names anyway.
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
848 if (s_arg == "-completenames")
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
849 continue;
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
850
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
851 n = atoi (s_arg.c_str ());
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
852 }
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
853 else
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
854 n = arg.int_value ();
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
855
29674
fc8d0a32d840 Accept 0 as an argument to dbstack for Matlab compatibility.
Rik <rik@octave.org>
parents: 29673
diff changeset
856 if (n < 0)
17649
a09511ebf7ef Make dbstack to accept -completenames.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17281
diff changeset
857 error ("dbstack: N must be a non-negative integer");
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
858 }
7890
73ef513855e7 dbstack fixes
John W. Eaton <jwe@octave.org>
parents: 7818
diff changeset
859
73ef513855e7 dbstack fixes
John W. Eaton <jwe@octave.org>
parents: 7818
diff changeset
860 if (n > 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
861 nskip = n;
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
862 }
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
863
27205
6648d1ae05fe eliminate direct access to call stack in debug functions
John W. Eaton <jwe@octave.org>
parents: 27037
diff changeset
864 octave::tree_evaluator& tw = interp.get_evaluator ();
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
865
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
866 if (nargout == 0)
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
867 {
27205
6648d1ae05fe eliminate direct access to call stack in debug functions
John W. Eaton <jwe@octave.org>
parents: 27037
diff changeset
868 octave_map stk = tw.backtrace (curr_frame);
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
869 octave_idx_type nframes = stk.numel ();
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
870
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
871 if (nframes > 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
872 {
23675
f71c0195b19d move octave_preserve_stream_state to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23584
diff changeset
873 octave::preserve_stream_state stream_state (os);
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
874
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
875 os << "stopped in:\n\n";
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
876
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
877 Cell names = stk.contents ("name");
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
878 Cell files = stk.contents ("file");
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
879 Cell lines = stk.contents ("line");
10839
65bc065bec95 still more debugger fixes
John W. Eaton <jwe@octave.org>
parents: 10315
diff changeset
880
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
881 bool show_top_level = true;
10839
65bc065bec95 still more debugger fixes
John W. Eaton <jwe@octave.org>
parents: 10315
diff changeset
882
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
883 std::size_t max_name_len = 0;
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
884
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
885 for (octave_idx_type i = nskip; i < nframes; i++)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
886 {
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
887 std::string name = names(i).string_value ();
10839
65bc065bec95 still more debugger fixes
John W. Eaton <jwe@octave.org>
parents: 10315
diff changeset
888
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
889 max_name_len = std::max (name.length (), max_name_len);
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
890 }
7890
73ef513855e7 dbstack fixes
John W. Eaton <jwe@octave.org>
parents: 7818
diff changeset
891
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
892 for (octave_idx_type i = nskip; i < nframes; i++)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
893 {
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
894 std::string name = names(i).string_value ();
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
895 std::string file = files(i).string_value ();
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
896 int line = lines(i).int_value ();
10839
65bc065bec95 still more debugger fixes
John W. Eaton <jwe@octave.org>
parents: 10315
diff changeset
897
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
898 if (show_top_level && i == curr_frame)
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
899 show_top_level = false;
10839
65bc065bec95 still more debugger fixes
John W. Eaton <jwe@octave.org>
parents: 10315
diff changeset
900
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
901 os << (i == curr_frame ? " --> " : " ")
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
902 << std::setw (max_name_len) << name
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
903 << " at line " << line
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23728
diff changeset
904 << " [" << file << ']'
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
905 << std::endl;
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
906 }
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
907
27205
6648d1ae05fe eliminate direct access to call stack in debug functions
John W. Eaton <jwe@octave.org>
parents: 27037
diff changeset
908 if (tw.at_top_level () && show_top_level)
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
909 os << " --> top level" << std::endl;
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
910 }
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
911 }
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
912 else
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
913 {
27205
6648d1ae05fe eliminate direct access to call stack in debug functions
John W. Eaton <jwe@octave.org>
parents: 27037
diff changeset
914 octave_map stk = tw.backtrace (curr_frame, false);
18440
96a495813047 Don't put parent function in subfunction stack structure name (bug #41506).
Rik <rik@octave.org>
parents: 18398
diff changeset
915
29672
68d64190da65 Return proper number of stack frames for dbstack (N) call (bug #60531).
Rik <rik@octave.org>
parents: 29656
diff changeset
916 octave_idx_type num_skip = std::min (nskip, stk.numel ());
68d64190da65 Return proper number of stack frames for dbstack (N) call (bug #60531).
Rik <rik@octave.org>
parents: 29656
diff changeset
917
29688
b36e83cdbf05 ensure idx_vector(int) constructor is defined (bug #60531)
John W. Eaton <jwe@octave.org>
parents: 29677
diff changeset
918 idx_vector first = idx_vector (0);
29676
e84f7449a0d8 Avoid ambiguous match of overloaded function (bug #60531).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29672
diff changeset
919
29672
68d64190da65 Return proper number of stack frames for dbstack (N) call (bug #60531).
Rik <rik@octave.org>
parents: 29656
diff changeset
920 for (octave_idx_type i = 0; i < num_skip; i++)
29676
e84f7449a0d8 Avoid ambiguous match of overloaded function (bug #60531).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29672
diff changeset
921 stk.delete_elements (first);
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
922
29672
68d64190da65 Return proper number of stack frames for dbstack (N) call (bug #60531).
Rik <rik@octave.org>
parents: 29656
diff changeset
923 curr_frame -= num_skip;
68d64190da65 Return proper number of stack frames for dbstack (N) call (bug #60531).
Rik <rik@octave.org>
parents: 29656
diff changeset
924 curr_frame = (curr_frame < 0 ? 0 : curr_frame + 1);
68d64190da65 Return proper number of stack frames for dbstack (N) call (bug #60531).
Rik <rik@octave.org>
parents: 29656
diff changeset
925
68d64190da65 Return proper number of stack frames for dbstack (N) call (bug #60531).
Rik <rik@octave.org>
parents: 29656
diff changeset
926 retval = ovl (stk, curr_frame);
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
927 }
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
928
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
929 return retval;
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
930 }
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
931
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
932 // A function that can be easily called from a debugger print the Octave stack.
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
933 // This can be useful for finding what line of code the interpreter is
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
934 // currently executing when the debugger is stopped in some C++ function,
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
935 // for example.
13326
23cc9c13b622 show_octave_dbstack: new convenience function for debugging
John W. Eaton <jwe@octave.org>
parents: 12642
diff changeset
936
13784
0bbe319bf26b octave_class::size: return matrix with correct dimensions
John W. Eaton <jwe@octave.org>
parents: 13689
diff changeset
937 void
13326
23cc9c13b622 show_octave_dbstack: new convenience function for debugging
John W. Eaton <jwe@octave.org>
parents: 12642
diff changeset
938 show_octave_dbstack (void)
23cc9c13b622 show_octave_dbstack: new convenience function for debugging
John W. Eaton <jwe@octave.org>
parents: 12642
diff changeset
939 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30896
diff changeset
940 do_dbstack (octave::__get_interpreter__ (),
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
941 octave_value_list (), 0, std::cerr);
13689
b68d95054947 print show_octave_dbstack output to std::cerr
John W. Eaton <jwe@octave.org>
parents: 13326
diff changeset
942 }
b68d95054947 print show_octave_dbstack output to std::cerr
John W. Eaton <jwe@octave.org>
parents: 13326
diff changeset
943
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
944 DEFMETHOD (dbstack, interp, args, nargout,
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
945 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
946 @deftypefn {} {} dbstack
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
947 @deftypefnx {} {} dbstack @var{n}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
948 @deftypefnx {} {} dbstack @var{-completenames}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
949 @deftypefnx {} {[@var{stack}, @var{idx}] =} dbstack (@dots{})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
950 Display or return current debugging function stack information.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
951
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
952 With optional argument @var{n}, omit the @var{n} innermost stack frames.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
953
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
954 Although accepted, the argument @var{-completenames} is silently ignored.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
955 Octave always returns absolute filenames.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
956
29674
fc8d0a32d840 Accept 0 as an argument to dbstack for Matlab compatibility.
Rik <rik@octave.org>
parents: 29673
diff changeset
957 The arguments @var{n} and @var{-completenames} can both be specified and may
fc8d0a32d840 Accept 0 as an argument to dbstack for Matlab compatibility.
Rik <rik@octave.org>
parents: 29673
diff changeset
958 appear in any order.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
959
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
960 The optional return argument @var{stack} is a struct array with the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
961 following fields:
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
962
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
963 @table @asis
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
964 @item file
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
965 The name of the m-file where the function code is located.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
967 @item name
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
968 The name of the function with a breakpoint.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
969
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
970 @item line
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
971 The line number of an active breakpoint.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
972
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
973 @item column
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
974 The column number of the line where the breakpoint begins.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
975
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
976 @end table
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
977
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
978 The return argument @var{idx} specifies which element of the @var{stack}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
979 struct array is currently active.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
980 @seealso{dbup, dbdown, dbwhere, dblist, dbstatus}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
981 @end deftypefn */)
13689
b68d95054947 print show_octave_dbstack output to std::cerr
John W. Eaton <jwe@octave.org>
parents: 13326
diff changeset
982 {
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
983 return do_dbstack (interp, args, nargout, octave_stdout);
13326
23cc9c13b622 show_octave_dbstack: new convenience function for debugging
John W. Eaton <jwe@octave.org>
parents: 12642
diff changeset
984 }
23cc9c13b622 show_octave_dbstack: new convenience function for debugging
John W. Eaton <jwe@octave.org>
parents: 12642
diff changeset
985
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
986 static void
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
987 do_dbupdown (octave::interpreter& interp, const octave_value_list& args,
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
988 const std::string& who)
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
989 {
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
990 int n = 1;
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
991
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
992 if (args.length () == 1)
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
993 {
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
994 octave_value arg = args(0);
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
995
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
996 if (arg.is_string ())
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
997 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
998 std::string s_arg = arg.string_value ();
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
999
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1000 n = atoi (s_arg.c_str ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1001 }
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1002 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1003 n = args(0).int_value ();
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1004 }
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1005
20557
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
1006 if (who == "dbup")
b10432a40432 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20428
diff changeset
1007 n = -n;
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1008
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1009 octave::tree_evaluator& tw = interp.get_evaluator ();
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1010
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1011 tw.dbupdown (n, true);
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1012 }
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1013
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1014 DEFMETHOD (dbup, interp, args, ,
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1015 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1016 @deftypefn {} {} dbup
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1017 @deftypefnx {} {} dbup @var{n}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1018 In debugging mode, move up the execution stack @var{n} frames.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1019
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1020 If @var{n} is omitted, move up one frame.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1021 @seealso{dbstack, dbdown}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1022 @end deftypefn */)
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1023 {
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1024 do_dbupdown (interp, args, "dbup");
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1025
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
1026 return ovl ();
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1027 }
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1028
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1029 DEFMETHOD (dbdown, interp, args, ,
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1030 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1031 @deftypefn {} {} dbdown
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1032 @deftypefnx {} {} dbdown @var{n}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1033 In debugging mode, move down the execution stack @var{n} frames.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1034
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1035 If @var{n} is omitted, move down one frame.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1036 @seealso{dbstack, dbup}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1037 @end deftypefn */)
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7736
diff changeset
1038 {
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1039 do_dbupdown (interp, args, "dbdown");
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1040
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
1041 return ovl ();
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1042 }
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1043
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
1044 DEFMETHOD (dbstep, interp, args, ,
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
1045 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1046 @deftypefn {} {} dbstep
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1047 @deftypefnx {} {} dbstep @var{n}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1048 @deftypefnx {} {} dbstep in
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1049 @deftypefnx {} {} dbstep out
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1050 @deftypefnx {} {} dbnext @dots{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1051 In debugging mode, execute the next @var{n} lines of code.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1052
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1053 If @var{n} is omitted, execute the next single line of code. If the next
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1054 line of code is itself defined in terms of an m-file remain in the existing
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1055 function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1056
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1057 Using @code{dbstep in} will cause execution of the next line to step into
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1058 any m-files defined on the next line.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1059
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1060 Using @code{dbstep out} will cause execution to continue until the current
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1061 function returns.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1062
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1063 @code{dbnext} is an alias for @code{dbstep}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1064 @seealso{dbcont, dbquit}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1065 @end deftypefn */)
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1066 {
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1067 octave::tree_evaluator& tw = interp.get_evaluator ();
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1068
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1069 if (! tw.in_debug_repl ())
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1070 error ("dbstep: can only be called in debug mode");
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1071
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1072 int nargin = args.length ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1073
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1074 if (nargin > 1)
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1075 print_usage ();
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1076
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1077 int n = 0;
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
1078
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1079 if (nargin == 1)
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1080 {
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1081 std::string arg
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1082 = args(0).xstring_value ("dbstep: input argument must be a string");
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1083
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1084 if (arg == "in")
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1085 n = -1;
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1086 else if (arg == "out")
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1087 n = -2;
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1088 else
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1089 {
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1090 n = atoi (arg.c_str ());
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1091
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
1092 if (n < 1)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20941
diff changeset
1093 error ("dbstep: invalid argument");
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1094 }
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1095 }
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1096 else
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1097 n = 1;
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1098
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1099 if (n != 0)
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1100 {
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1101 tw.set_dbstep_flag (n);
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1102
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1103 // If we set the dbstep flag, we also need to reset debug_mode.
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1104 tw.reset_debug_state ();
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1105
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1106 }
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1107
20941
a4f5da7c5463 maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents: 20940
diff changeset
1108 return ovl ();
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1109 }
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1110
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
1111 DEFALIAS (dbnext, dbstep);
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
1112
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
1113 DEFMETHOD (dbcont, interp, args, ,
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
1114 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1115 @deftypefn {} {} dbcont
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1116 Leave command-line debugging mode and continue code execution normally.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1117 @seealso{dbstep, dbquit}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1118 @end deftypefn */)
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1119 {
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1120 octave::tree_evaluator& tw = interp.get_evaluator ();
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1121
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1122 if (! tw.in_debug_repl ())
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1123 error ("dbcont: can only be called in debug mode");
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
1124
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1125 if (args.length () != 0)
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1126 print_usage ();
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1127
27282
49c60d16866f improve dbquit and dbcont behavior
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
1128 tw.dbcont ();
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1129
20941
a4f5da7c5463 maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents: 20940
diff changeset
1130 return ovl ();
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1131 }
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1132
25360
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
1133 DEFMETHOD (dbquit, interp, args, ,
bc5f225bc578 eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents: 25347
diff changeset
1134 doc: /* -*- texinfo -*-
27795
afbaad39d25c doc: grammarcheck C++ files in libinterp/ directory.
Rik <rik@octave.org>
parents: 27544
diff changeset
1135 @deftypefn {} {} dbquit
27240
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1136 @deftypefnx {} {} dbquit all
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1137 Quit debugging mode immediately without further code execution. With no
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1138 arguments, exit the current debugging level. With argument @code{all},
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1139 exit all debugging levels and return to the Octave prompt.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1140 @seealso{dbcont, dbstep}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1141 @end deftypefn */)
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1142 {
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1143 octave::tree_evaluator& tw = interp.get_evaluator ();
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1144
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1145 if (! tw.in_debug_repl ())
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1146 error ("dbquit: can only be called in debug mode");
10186
095a1e670e68 make dbstep work with keyboard function
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
1147
27240
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1148 int nargin = args.length ();
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1149
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1150 if (nargin > 1)
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20884
diff changeset
1151 print_usage ();
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8365
diff changeset
1152
27240
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1153 if (nargin == 1)
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1154 {
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1155 std::string arg
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1156 = args(0).xstring_value ("dbquit: input argument must be a string");
27222
f5b967060442 ensure debuger_stack is popped when exiting a debug level (bug #56150)
John W. Eaton <jwe@octave.org>
parents: 27205
diff changeset
1157
27240
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1158 if (arg == "all")
27282
49c60d16866f improve dbquit and dbcont behavior
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
1159 tw.dbquit (true);
27240
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1160 else
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1161 error ("dbquit: unrecognized argument '%s'", arg.c_str ());
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1162 }
336c640c481b make "dbquit all" work and fix dbquit compatibility (bug #56616)
John W. Eaton <jwe@octave.org>
parents: 27222
diff changeset
1163 else
27282
49c60d16866f improve dbquit and dbcont behavior
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
1164 tw.dbquit ();
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1165
20941
a4f5da7c5463 maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents: 20940
diff changeset
1166 return ovl ();
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1167 }
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
1168
27444
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27282
diff changeset
1169 DEFMETHOD (isdebugmode, interp, args, ,
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27282
diff changeset
1170 doc: /* -*- texinfo -*-
30559
841a10208c38 doc: Use TF for output variable in documentation for isXXX functions in libinterp/ directory.
Rik <rik@octave.org>
parents: 30390
diff changeset
1171 @deftypefn {} {@var{tf} =} isdebugmode ()
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1172 Return true if in debugging mode, otherwise false.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1173 @seealso{dbwhere, dbstack, dbstatus}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1174 @end deftypefn */)
8114
cbbea37b95e8 debug.cc (Fisdebugmode): New function.
Krzesimir Nowak <qdlacz@gmail.com>
parents: 8021
diff changeset
1175 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1176 if (args.length () != 0)
8114
cbbea37b95e8 debug.cc (Fisdebugmode): New function.
Krzesimir Nowak <qdlacz@gmail.com>
parents: 8021
diff changeset
1177 print_usage ();
cbbea37b95e8 debug.cc (Fisdebugmode): New function.
Krzesimir Nowak <qdlacz@gmail.com>
parents: 8021
diff changeset
1178
27444
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27282
diff changeset
1179 octave::tree_evaluator& tw = interp.get_evaluator ();
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1180
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
1181 return ovl (tw.in_debug_repl ());
8114
cbbea37b95e8 debug.cc (Fisdebugmode): New function.
Krzesimir Nowak <qdlacz@gmail.com>
parents: 8021
diff changeset
1182 }
19379
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 18236
diff changeset
1183
25402
ef2b9d4abf4a eliminate some global variables from tree_evaluator
John W. Eaton <jwe@octave.org>
parents: 25360
diff changeset
1184 DEFMETHOD (__db_next_breakpoint_quiet__, interp, args, ,
ef2b9d4abf4a eliminate some global variables from tree_evaluator
John W. Eaton <jwe@octave.org>
parents: 25360
diff changeset
1185 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1186 @deftypefn {} {} __db_next_breakpoint_quiet__ ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1187 @deftypefnx {} {} __db_next_breakpoint_quiet__ (@var{flag})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1188 Disable line info printing at the next breakpoint.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1189
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1190 With a logical argument @var{flag}, set the state on or off.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21885
diff changeset
1191 @end deftypefn */)
19379
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 18236
diff changeset
1192 {
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 18236
diff changeset
1193 int nargin = args.length ();
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 18236
diff changeset
1194
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1195 if (nargin > 1)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1196 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1197
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1198 bool state = true;
19379
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 18236
diff changeset
1199
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1200 if (nargin == 1)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20713
diff changeset
1201 state = args(0).bool_value ();
19379
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 18236
diff changeset
1202
25402
ef2b9d4abf4a eliminate some global variables from tree_evaluator
John W. Eaton <jwe@octave.org>
parents: 25360
diff changeset
1203 octave::tree_evaluator& tw = interp.get_evaluator ();
ef2b9d4abf4a eliminate some global variables from tree_evaluator
John W. Eaton <jwe@octave.org>
parents: 25360
diff changeset
1204
ef2b9d4abf4a eliminate some global variables from tree_evaluator
John W. Eaton <jwe@octave.org>
parents: 25360
diff changeset
1205 tw.quiet_breakpoint_flag (state);
19379
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 18236
diff changeset
1206
20941
a4f5da7c5463 maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents: 20940
diff changeset
1207 return ovl ();
19379
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 18236
diff changeset
1208 }
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29688
diff changeset
1209
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31603
diff changeset
1210 OCTAVE_END_NAMESPACE(octave)