Mercurial > octave
annotate libinterp/parse-tree/bp-table.cc @ 30875:5d3faba0342e
doc: Ensure documentation lists output argument when it exists for all m-files.
For new users of Octave it is best to show explicit calling forms
in the documentation and to show a return argument when it exists.
* bp-table.cc, shift.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m,
bitget.m, bitset.m, blkdiag.m, celldisp.m, cplxpair.m, dblquad.m, flip.m,
fliplr.m, flipud.m, idivide.m, int2str.m, interpft.m, logspace.m, num2str.m,
polyarea.m, postpad.m, prepad.m, randi.m, repmat.m, rng.m, rot90.m, rotdim.m,
structfun.m, triplequad.m, uibuttongroup.m, uicontrol.m, uipanel.m,
uipushtool.m, uitoggletool.m, uitoolbar.m, waitforbuttonpress.m, help.m,
__additional_help_message__.m, hsv.m, im2double.m, im2frame.m, javachk.m,
usejava.m, argnames.m, char.m, formula.m, inline.m, __vectorize__.m, findstr.m,
flipdim.m, strmatch.m, vectorize.m, commutation_matrix.m, cond.m, cross.m,
duplication_matrix.m, expm.m, orth.m, rank.m, rref.m, trace.m, vech.m, cast.m,
compare_versions.m, delete.m, dir.m, fileattrib.m, grabcode.m, gunzip.m,
inputname.m, license.m, list_primes.m, ls.m, mexext.m, movefile.m,
namelengthmax.m, nargoutchk.m, nthargout.m, substruct.m, swapbytes.m, ver.m,
verLessThan.m, what.m, fminunc.m, fsolve.m, fzero.m, optimget.m, __fdjac__.m,
matlabroot.m, savepath.m, campos.m, camroll.m, camtarget.m, camup.m, camva.m,
camzoom.m, clabel.m, diffuse.m, legend.m, orient.m, rticks.m, specular.m,
thetaticks.m, xlim.m, xtickangle.m, xticklabels.m, xticks.m, ylim.m,
ytickangle.m, yticklabels.m, yticks.m, zlim.m, ztickangle.m, zticklabels.m,
zticks.m, ellipsoid.m, isocolors.m, isonormals.m, stairs.m, surfnorm.m,
__actual_axis_position__.m, __pltopt__.m, close.m, graphics_toolkit.m, pan.m,
print.m, printd.m, __ghostscript__.m, __gnuplot_print__.m, __opengl_print__.m,
rotate3d.m, subplot.m, zoom.m, compan.m, conv.m, poly.m, polyaffine.m,
polyder.m, polyint.m, polyout.m, polyreduce.m, polyvalm.m, roots.m, prefdir.m,
prefsfile.m, profexplore.m, profexport.m, profshow.m, powerset.m, unique.m,
arch_rnd.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m,
durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, fractdiff.m, hamming.m,
hanning.m, hurst.m, ifftshift.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m,
sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m,
ilu.m, __sprand__.m, sprand.m, sprandn.m, sprandsym.m, treelayout.m, beta.m,
betainc.m, betaincinv.m, betaln.m, cosint.m, expint.m, factorial.m, gammainc.m,
gammaincinv.m, lcm.m, nthroot.m, perms.m, reallog.m, realpow.m, realsqrt.m,
sinint.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m, rosser.m,
toeplitz.m, vander.m, wilkinson.m, center.m, corr.m, cov.m, discrete_cdf.m,
discrete_inv.m, discrete_pdf.m, discrete_rnd.m, empirical_cdf.m,
empirical_inv.m, empirical_pdf.m, empirical_rnd.m, kendall.m, kurtosis.m,
mad.m, mean.m, meansq.m, median.m, mode.m, moment.m, range.m, ranks.m,
run_count.m, skewness.m, spearman.m, statistics.m, std.m, base2dec.m,
bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m,
hex2dec.m, index.m, regexptranslate.m, rindex.m, strcat.m, strjust.m,
strtrim.m, strtrunc.m, substr.m, untabify.m, __have_feature__.m,
__prog_output_assert__.m, __run_test_suite__.m, example.m, fail.m, asctime.m,
calendar.m, ctime.m, date.m, etime.m:
Add return arguments to @deftypefn macros where they were missing. Rename
variables in functions (particularly generic "retval") to match documentation.
Rename some return variables for (hopefully) better clarity (e.g., 'ax' to 'hax'
to indicate it is a graphics handle to an axes object).
author | Rik <rik@octave.org> |
---|---|
date | Wed, 30 Mar 2022 20:40:27 -0700 |
parents | 83f9f8bda883 |
children | c9788d7f6e65 |
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:
29688
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:
diff
changeset
|
25 |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 # include "config.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #endif |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
23824
061a343089be
Miscellaneous cleanups of C++11 std::string code.
Rik <rik@octave.org>
parents:
23807
diff
changeset
|
30 #include <algorithm> |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <limits> |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <list> |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include <map> |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 #include <set> |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #include <string> |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 #include "file-ops.h" |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
38 #include "oct-env.h" |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 #include "bp-table.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 #include "defun-int.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 #include "error.h" |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27261
diff
changeset
|
43 #include "event-manager.h" |
25347
af3319d86a5f
eliminate some global references to interpreter internals
John W. Eaton <jwe@octave.org>
parents:
25343
diff
changeset
|
44 #include "interpreter.h" |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
45 #include "interpreter-private.h" |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 #include "oct-map.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 #include "ov-usr-fcn.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 #include "ov.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 #include "ovl.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 #include "pager.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 #include "parse.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 #include "pt-eval.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 #include "pt-exp.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 #include "pt-stmt.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 #include "sighandlers.h" |
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
57 namespace octave |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 { |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
59 class bp_file_info |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
60 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
61 public: |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
62 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
63 bp_file_info (tree_evaluator& tw, const std::string& file) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
64 : m_ok (false), m_file (file), m_dir (), m_fcn (), m_class_name () |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
65 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
66 std::string abs_file = sys::env::make_absolute (file); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
67 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
68 std::string dir = sys::file_ops::dirname (abs_file); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
69 std::string fcn = sys::file_ops::tail (abs_file); |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29458
diff
changeset
|
70 std::size_t len = fcn.length (); |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
71 if (len >= 2 && fcn[len-2] == '.' && fcn[len-1] == 'm') |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
72 fcn = fcn.substr (0, len-2); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
73 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29458
diff
changeset
|
74 std::size_t pos = dir.rfind (sys::file_ops::dir_sep_chars ()); |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
75 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
76 if (pos != std::string::npos && pos < dir.length () - 1) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
77 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
78 if (dir[pos+1] == '@') |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
79 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
80 m_class_name = dir.substr (pos+1); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
81 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
82 fcn = sys::file_ops::concat (m_class_name, fcn); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
83 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
84 dir = dir.substr (0, pos); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
85 } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
86 } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
87 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
88 m_dir = dir; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
89 m_fcn = fcn; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
90 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
91 interpreter& interp = tw.get_interpreter (); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
92 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
93 load_path& lp = interp.get_load_path (); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
94 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
95 if (lp.contains_file_in_dir (m_file, m_dir)) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
96 m_ok = true; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
97 } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
98 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
99 std::string file (void) const { return m_file; } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
100 std::string dir (void) const { return m_fcn; } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
101 std::string fcn (void) const { return m_fcn; } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
102 std::string class_name (void) const { return m_class_name; } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
103 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
104 bool ok (void) const { return m_ok; } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
105 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
106 private: |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
107 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
108 bool m_ok; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
109 std::string m_file; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
110 std::string m_dir; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
111 std::string m_fcn; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
112 std::string m_class_name; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
113 }; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
114 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
115 // Clear all reasons to stop, other than breakpoints. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
116 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
117 void bp_table::dbclear_all_signals (void) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
118 { |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
119 interpreter& interp = m_evaluator.get_interpreter (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
120 error_system& es = interp.get_error_system (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
121 |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
122 es.debug_on_error (false); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
123 bp_table::m_errors_that_stop.clear (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
124 |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
125 es.debug_on_caught (false); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
126 bp_table::m_caught_that_stop.clear (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
127 |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
128 es.debug_on_warning (false); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
129 bp_table::m_warnings_that_stop.clear (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
130 |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
131 Vdebug_on_interrupt = false; |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
132 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
133 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
134 // Process the "warn", "errs", "caught" and "intr" fields for a call of |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
135 // "dbstop (p)". |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
136 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
137 void bp_table::dbstop_process_map_args (const octave_map& mv) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
138 { |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
139 interpreter& interp = m_evaluator.get_interpreter (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
140 error_system& es = interp.get_error_system (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
141 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
142 // process errs |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
143 // why so many levels of indirection needed? |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
144 bool fail = false; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
145 Cell U = mv.contents ("errs"); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
146 if (U.numel () != 1) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
147 fail = (U.numel () > 1); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
148 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
149 { |
29688
b36e83cdbf05
ensure idx_vector(int) constructor is defined (bug #60531)
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
150 Array<octave_value> W = U.index (0); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
151 if (W.isempty () || W(0).isempty ()) |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
152 es.debug_on_error (true); // like "dbstop if error" with no identifier |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
153 else if (! W(0).iscell ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
154 fail = true; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
155 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
156 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
157 Cell V = W(0).cell_value (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
158 for (int i = 0; i < V.numel (); i++) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
159 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
160 m_errors_that_stop.insert (V(i).string_value ()); |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
161 es.debug_on_error (true); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
162 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
163 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
164 } |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
165 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
166 if (fail) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
167 error ("dbstop: invalid 'errs' field"); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
168 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
169 // process caught |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
170 // why so many levels of indirection needed? |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
171 fail = false; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
172 U = mv.contents ("caught"); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
173 if (U.numel () != 1) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
174 fail = (U.numel () > 1); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
175 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
176 { |
29688
b36e83cdbf05
ensure idx_vector(int) constructor is defined (bug #60531)
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
177 Array<octave_value> W = U.index (0); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
178 if (W.isempty () || W(0).isempty ()) |
30346
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
29688
diff
changeset
|
179 es.debug_on_caught (true); // like "dbstop if caught error" with no ID |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
180 else if (! W(0).iscell ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
181 fail = true; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
182 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
183 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
184 Cell V = W(0).cell_value (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
185 for (int i = 0; i < V.numel (); i++) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
186 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
187 m_caught_that_stop.insert (V(i).string_value ()); |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
188 es.debug_on_caught (true); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
189 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
190 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
191 } |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
192 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
193 if (fail) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
194 error ("dbstop: invalid 'caught' field"); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
195 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
196 // process warn |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
197 // why so many levels of indirection needed? |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
198 fail = false; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
199 U = mv.contents ("warn"); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
200 if (U.numel () != 1) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
201 fail = (U.numel () > 1); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
202 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
203 { |
29688
b36e83cdbf05
ensure idx_vector(int) constructor is defined (bug #60531)
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
204 Array<octave_value> W = U.index (0); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
205 if (W.isempty () || W(0).isempty ()) |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
206 es.debug_on_warning (true); // like "dbstop if warning" with no identifier |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
207 else if (! W(0).iscell ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
208 fail = true; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
209 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
210 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
211 Cell V = W(0).cell_value (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
212 for (int i = 0; i < V.numel (); i++) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
213 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
214 m_warnings_that_stop.insert (V(i).string_value ()); |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
215 es.debug_on_warning (true); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
216 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
217 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
218 } |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
219 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
220 if (fail) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
221 error ("dbstop: invalid 'warn' field"); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
222 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
223 // process interrupt |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
224 if (mv.isfield ("intr")) |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
225 Vdebug_on_interrupt = true; |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
226 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
227 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
228 // Insert a breakpoint in function fcn at line within file fname, |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
229 // to stop only when condition is true. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
230 // Record in m_bp_set that fname contains a breakpoint. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
231 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
232 bool bp_table::add_breakpoint_1 (octave_user_code *fcn, |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
233 const std::string& fname, |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
234 const bp_table::bp_lines& line, |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
235 const std::string& condition, |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
236 bp_table::bp_lines& retval) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
237 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
238 bool found = false; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
239 |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
240 tree_statement_list *cmds = fcn->body (); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
241 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
242 std::string file = fcn->fcn_file_name (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
243 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
244 if (cmds) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
245 { |
27261
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
246 interpreter& interp = m_evaluator.get_interpreter (); |
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
247 |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27261
diff
changeset
|
248 event_manager& evmgr = interp.get_event_manager (); |
27261
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
249 |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27261
diff
changeset
|
250 retval = cmds->add_breakpoint (evmgr, file, line, condition); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
251 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
252 for (auto& lineno : retval) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
253 { |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
254 if (lineno != 0) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
255 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
256 // Normalize to store only the file name. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
257 // Otherwise, there can be an entry for both |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
258 // file>subfunction and file, which causes a crash on |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
259 // dbclear all |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
260 const char *s = strchr (fname.c_str (), '>'); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
261 if (s) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
262 m_bp_set.insert (fname.substr (0, s - fname.c_str ())); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
263 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
264 m_bp_set.insert (fname); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
265 found = true; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
266 break; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
267 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
268 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
269 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
271 return found; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
272 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
273 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
274 // Cursory check that cond is a valid condition to use for a breakpoint. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
275 // Currently allows conditions with side-effects, like 'y+=10' and 'y++'; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
276 // it is odd that the former is not flagged by "is_assignment_expression". |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
277 // Throws an exception if not valid. |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
278 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
279 bool bp_table::condition_valid (const std::string& cond) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
280 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
281 if (cond.length () > 0) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
282 { |
25441
143007dad864
store reference instead of pointer to interpreter in lexer
John W. Eaton <jwe@octave.org>
parents:
25438
diff
changeset
|
283 // ; to reject partial expr like "y==" |
143007dad864
store reference instead of pointer to interpreter in lexer
John W. Eaton <jwe@octave.org>
parents:
25438
diff
changeset
|
284 parser parser (cond + " ;", m_evaluator.get_interpreter ()); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
285 parser.reset (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
286 int parse_status = parser.run (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
287 if (parse_status) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
288 error ("dbstop: Cannot parse condition '%s'", cond.c_str ()); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
289 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
290 { |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
291 tree_statement *stmt = nullptr; |
27504
7a31b25e3252
use shared_ptr for storing classdef and statement_list objects in parser
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
292 |
7a31b25e3252
use shared_ptr for storing classdef and statement_list objects in parser
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
293 std::shared_ptr<tree_statement_list> stmt_list |
7a31b25e3252
use shared_ptr for storing classdef and statement_list objects in parser
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
294 = parser.statement_list (); |
7a31b25e3252
use shared_ptr for storing classdef and statement_list objects in parser
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
295 |
7a31b25e3252
use shared_ptr for storing classdef and statement_list objects in parser
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
296 if (! stmt_list) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
297 error ("dbstop: " |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
298 "condition is not empty, but has nothing to evaluate"); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
299 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
300 { |
27504
7a31b25e3252
use shared_ptr for storing classdef and statement_list objects in parser
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
301 if (stmt_list->length () == 1 |
7a31b25e3252
use shared_ptr for storing classdef and statement_list objects in parser
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
302 && (stmt = stmt_list->front ()) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
303 && stmt->is_expression ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
304 { |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
305 tree_expression *expr = stmt->expression (); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
306 if (expr->is_assignment_expression ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
307 error ("dbstop: condition cannot be an assignment. " |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
308 "Did you mean '=='?"); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
309 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
310 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
311 error ("dbstop: condition must be an expression"); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
312 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
313 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
314 } |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
315 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
316 return true; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
317 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
318 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
319 enum dbstop_args |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
320 { |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
321 dbstop_in, |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
322 dbstop_at, |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
323 dbstop_if, |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
324 dbstop_none |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
325 }; |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
326 |
27971
ec769a7ab9fb
fix more spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
327 // FIXME: This function probably needs to be completely overhauled to |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
328 // correctly parse the full syntax of the dbstop command and properly |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
329 // reject incorrect forms. |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
330 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
331 // Parse parameters (args) of dbstop and dbclear commands. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
332 // For dbstop, who=="dbstop"; for dbclear, who=="dbclear". |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
333 // The syntax is: dbstop [[in] symbol] [[at] [method | line [line [...]]]] [if condition] |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
334 // where the form of condition depends on whether or not a file or line has |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
335 // been seen. IF symbol and method are specified, then symbol should |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
336 // be a class name. Otherwise it should be a function name. |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
337 // Also execute "if [error|warning|interrupt|naninf]" clauses. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
338 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
339 void bp_table::parse_dbfunction_params (const char *who, |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
340 const octave_value_list& args, |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
341 std::string& func_name, |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
342 std::string& class_name, |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
343 bp_table::bp_lines& lines, |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
344 std::string& cond) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
345 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
346 int nargin = args.length (); |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
347 func_name = ""; |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
348 class_name = ""; |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
349 lines = bp_table::bp_lines (); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
350 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
351 if (nargin == 0 || ! args(0).is_string ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
352 print_usage (who); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
353 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
354 // elements already processed |
26586
5fec5393a9c8
bp-table.cc: Don't declare and initialize multiple vars on one line.
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
355 bool seen_in = false; |
5fec5393a9c8
bp-table.cc: Don't declare and initialize multiple vars on one line.
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
356 bool seen_at = false; |
5fec5393a9c8
bp-table.cc: Don't declare and initialize multiple vars on one line.
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
357 bool seen_if = false; |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
358 int pos = 0; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
359 dbstop_args tok = dbstop_none; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
360 while (pos < nargin) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
361 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
362 // allow "in" and "at" to be implicit |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
363 if (args(pos).is_string ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
364 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
365 std::string arg = args(pos).string_value (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
366 if (arg == "in") |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
367 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
368 tok = dbstop_in; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
369 pos++; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
370 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
371 else if (arg == "at") |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
372 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
373 tok = dbstop_at; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
374 pos++; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
375 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
376 else if (arg == "if") |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
377 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
378 tok = dbstop_if; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
379 pos++; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
380 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
381 else if (atoi (args(pos).string_value ().c_str ()) > 0) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
382 tok = dbstop_at; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
383 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
384 tok = dbstop_in; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
385 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
386 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
387 tok = dbstop_at; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
388 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
389 if (pos >= nargin) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
390 error ("%s: '%s' missing argument", who, |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
391 (tok == dbstop_in |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
392 ? "in" : (tok == dbstop_at ? "at" : "if"))); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
393 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
394 // process the actual arguments |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
395 switch (tok) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
396 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
397 case dbstop_in: |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
398 func_name = args(pos).string_value (); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
399 if (seen_in) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
400 error ("%s: Too many function names specified -- %s", |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
401 who, func_name.c_str ()); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
402 else if (seen_at || seen_if) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
403 error ("%s: function name must come before line number and 'if'", |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
404 who); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
405 seen_in = true; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
406 pos++; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
407 break; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
408 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
409 case dbstop_at: |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
410 if (seen_at) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
411 error ("%s: Only one 'at' clause is allowed -- %s", |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
412 who, args(pos).string_value ().c_str ()); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
413 else if (seen_if) |
26107
05dfcb24ef12
Supply missing arguments to variable length *printf functions (bug #55046).
Rik <rik@octave.org>
parents:
25441
diff
changeset
|
414 error ("%s: line number must come before 'if' clause\n", who); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
415 seen_at = true; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
416 |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
417 if (seen_if) |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
418 error ("%s: line number must come before 'if' clause\n", who); |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
419 else if (seen_in) |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
420 { |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
421 std::string arg = args(pos).string_value (); |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
422 |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
423 // FIXME: we really want to distinguish number |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
424 // vs. method name here. |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
425 |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
426 if (atoi (arg.c_str ()) == 0) |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
427 { |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
428 // We have class and function names but already |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
429 // stored the class name in func_name. |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
430 class_name = func_name; |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
431 func_name = arg; |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
432 pos++; |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
433 break; |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
434 } |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
435 |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
436 } |
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
437 else |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
438 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
439 // It was a line number. Get function name from debugger. |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27000
diff
changeset
|
440 if (m_evaluator.in_debug_repl ()) |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
441 func_name = m_evaluator.get_user_code ()->profiler_name (); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
442 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
443 error ("%s: function name must come before line number " |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
444 "and 'if'", who); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
445 seen_in = true; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
446 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
447 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
448 // Read a list of line numbers (or arrays thereof) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
449 for ( ; pos < nargin; pos++) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
450 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
451 if (args(pos).is_string ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
452 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
453 int line = atoi (args(pos).string_value ().c_str ()); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
454 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
455 if (line > 0) |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
456 lines.insert (line); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
457 else |
26954
6e50f1fedeb5
dbstop: accept "at CLASS in METHOD" syntax (partial fix for bug #45404)
John W. Eaton <jwe@octave.org>
parents:
26586
diff
changeset
|
458 break; // may be "if" or a method name |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
459 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
460 else if (args(pos).isnumeric ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
461 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
462 const NDArray arg = args(pos).array_value (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
463 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
464 for (octave_idx_type j = 0; j < arg.numel (); j++) |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
465 lines.insert (static_cast<int> (arg.elem (j))); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
466 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
467 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
468 error ("%s: Invalid argument type %s", |
26107
05dfcb24ef12
Supply missing arguments to variable length *printf functions (bug #55046).
Rik <rik@octave.org>
parents:
25441
diff
changeset
|
469 who, args(pos).type_name ().c_str ()); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
470 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
471 break; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
472 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
473 case dbstop_if: |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
474 if (seen_in) // conditional breakpoint |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
475 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
476 cond = ""; // remaining arguments form condition |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
477 for (; pos < nargin; pos++) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
478 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
479 if (args(pos).is_string ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
480 cond += ' ' + args(pos).string_value (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
481 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
482 error ("%s: arguments to 'if' must all be strings", who); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
483 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
484 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
485 cond = cond.substr (1); // omit initial space |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
486 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
487 else // stop on event (error, warning, interrupt, NaN/inf) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
488 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
489 std::string condition = args(pos).string_value (); |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
490 bool on_off = ! strcmp (who, "dbstop"); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
491 |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
492 // FIXME: the following seems a bit messy in the way it |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
493 // duplicates checks on CONDITION. |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
494 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
495 if (condition == "error") |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
496 process_id_list (who, condition, args, nargin, pos, on_off, |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
497 m_errors_that_stop); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
498 else if (condition == "warning") |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
499 process_id_list (who, condition, args, nargin, pos, on_off, |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
500 m_warnings_that_stop); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
501 else if (condition == "caught" && nargin > pos+1 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
502 && args(pos+1).string_value () == "error") |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
503 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
504 pos++; |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
505 process_id_list (who, condition, args, nargin, pos, on_off, |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
506 m_caught_that_stop); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
507 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
508 else if (condition == "interrupt") |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
509 { |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
510 Vdebug_on_interrupt = on_off; |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
511 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
512 else if (condition == "naninf") |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
513 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
514 #if defined (DBSTOP_NANINF) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
515 Vdebug_on_naninf = on_off; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
516 enable_fpe (on_off); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
517 #else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
518 warning ("%s: condition '%s' not yet supported", |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
519 who, condition.c_str ()); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
520 #endif |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
521 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
522 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
523 error ("%s: invalid condition %s", |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
524 who, condition.c_str ()); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
525 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
526 pos = nargin; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
527 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
528 break; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
529 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
530 default: // dbstop_none should never occur |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
531 break; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
532 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
533 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
534 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
535 |
27184 | 536 /* |
537 %!test | |
538 %! dbclear all; # Clear out breakpoints before test | |
539 %! dbstop help; | |
540 %! dbstop in ls; | |
30875
5d3faba0342e
doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
541 %! dbstop help at 105; # 105 is a comment; code line is at 106 |
5d3faba0342e
doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
542 %! dbstop in ls 102; |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27913
diff
changeset
|
543 %! dbstop help 204 if a==5; |
27184 | 544 %! dbstop if error Octave:undefined-function; |
545 %! s = dbstatus; | |
546 %! dbclear all; | |
547 %! assert ({s.bkpt(:).name}, {"help", "help", "help>do_contents", "ls", "ls"}); | |
30875
5d3faba0342e
doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
548 %! assert ([s.bkpt(:).line], [56, 106, 208, 63, 102]); |
27184 | 549 %! assert (s.errs, {"Octave:undefined-function"}); |
550 */ | |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
551 |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
552 void bp_table::set_stop_flag (const char *who, const std::string& condition, |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
553 bool on_off) |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
554 { |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
555 interpreter& interp = m_evaluator.get_interpreter (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
556 error_system& es = interp.get_error_system (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
557 |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
558 if (condition == "error") |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
559 es.debug_on_error (on_off); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
560 else if (condition == "warning") |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
561 es.debug_on_warning (on_off); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
562 else if (condition == "caught") |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
563 es.debug_on_caught (on_off); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
564 else |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
565 error ("%s: internal error in set_stop_flag", who); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
566 } |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
567 |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
568 void bp_table::process_id_list (const char *who, |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
569 const std::string& condition, |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
570 const octave_value_list& args, |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
571 int nargin, int& pos, bool on_off, |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
572 std::set<std::string>& id_list) |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
573 { |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
574 pos++; |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
575 |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
576 if (nargin > pos) // only affect a single error ID |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
577 { |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
578 if (! args(pos).is_string () || nargin > pos+1) |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
579 error ("%s: ID must be a single string", who); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
580 else if (on_off) |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
581 { |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
582 id_list.insert (args(pos).string_value ()); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
583 set_stop_flag (who, condition, true); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
584 } |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
585 else |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
586 { |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
587 id_list.erase (args(pos).string_value ()); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
588 if (id_list.empty ()) |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
589 set_stop_flag (who, condition, false); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
590 } |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
591 } |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
592 else // unqualified. Turn all on or off |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
593 { |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
594 id_list.clear (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
595 set_stop_flag (who, condition, on_off); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
596 |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
597 if (condition == "error") |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
598 { |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
599 // Matlab stops on both. |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
600 Vdebug_on_interrupt = on_off; |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
601 } |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
602 } |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
603 } |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
604 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
605 // Return the sub/nested/main function of MAIN_FCN that contains |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
606 // line number LINENO of the source file. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
607 // If END_LINE != 0, *END_LINE is set to last line of the returned function. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
608 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
609 static octave_user_code * find_fcn_by_line (octave_user_code *main_fcn, |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
610 int lineno, |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
611 int *end_line = nullptr) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
612 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
613 octave_user_code *retval = nullptr; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
614 octave_user_code *next_fcn = nullptr; // 1st function starting after lineno |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
615 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
616 // Find innermost nested (or parent) function containing lineno. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
617 int earliest_end = std::numeric_limits<int>::max (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
618 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
619 std::map<std::string, octave_value> subfcns = main_fcn->subfunctions (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
620 for (const auto& str_val_p : subfcns) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
621 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
622 if (str_val_p.second.is_user_function ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
623 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
624 auto *dbg_subfcn = str_val_p.second.user_function_value (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
625 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
626 // Check if lineno is within dbg_subfcn. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
627 // FIXME: we could break when beginning_line() > lineno, |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
628 // but that makes the code "fragile" |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
629 // if the order of walking subfcns changes, |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
630 // for a minor speed improvement in non-critical code. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
631 if (dbg_subfcn->ending_line () < earliest_end |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
632 && dbg_subfcn->ending_line () >= lineno |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
633 && dbg_subfcn->beginning_line () <= lineno) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
634 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
635 earliest_end = dbg_subfcn->ending_line (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
636 retval = find_fcn_by_line (dbg_subfcn, lineno, &earliest_end); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
637 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
638 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
639 // Find the first fcn starting after lineno. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
640 // This is used if line is not inside any function. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
641 if (dbg_subfcn->beginning_line () >= lineno && ! next_fcn) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
642 next_fcn = dbg_subfcn; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
643 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
644 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
645 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
646 // The breakpoint is either in the subfunction found above, |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
647 // or in the main function, which we check now. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
648 if (main_fcn->is_user_function ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
649 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
650 int e = dynamic_cast<octave_user_function *> (main_fcn)->ending_line (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
651 if (e >= lineno && e < earliest_end) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
652 retval = main_fcn; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
653 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
654 if (! retval) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
655 retval = next_fcn; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
656 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
657 else // main_fcn is a script. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
658 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
659 if (! retval) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
660 retval = main_fcn; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
661 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
662 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
663 if (end_line && earliest_end < *end_line) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
664 *end_line = earliest_end; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
665 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
666 return retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
667 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
668 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
669 // Given file name fname, find the subfunction at line and create |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
670 // a breakpoint there. Put the system into debug_mode. |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
671 int bp_table::add_breakpoint_in_function (const std::string& fname, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
672 const std::string& class_name, |
30346
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
29688
diff
changeset
|
673 int line, |
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
29688
diff
changeset
|
674 const std::string& condition) |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
675 { |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
676 bp_lines line_info; |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
677 line_info.insert (line); |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
678 |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
679 bp_lines result |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
680 = add_breakpoints_in_function (fname, class_name, line_info, condition); |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
681 |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
682 return result.empty () ? 0 : *(result.begin ()); |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
683 } |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
684 |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
685 // Given file name fname, find the subfunction at line and create |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
686 // a breakpoint there. Put the system into debug_mode. |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
687 bp_table::bp_lines |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
688 bp_table::add_breakpoints_in_function (const std::string& fname, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
689 const std::string& class_name, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
690 const bp_table::bp_lines& lines, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
691 const std::string& condition) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
692 { |
26975
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26954
diff
changeset
|
693 octave_user_code *main_fcn = m_evaluator.get_user_code (fname, class_name); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
694 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
695 if (! main_fcn) |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
696 error ("add_breakpoints_in_function: unable to find function '%s'\n", |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
697 fname.c_str ()); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
698 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
699 condition_valid (condition); // Throw error if condition not valid. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
700 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
701 bp_lines retval; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
702 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
703 for (const auto& lineno : lines) |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
704 { |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
705 octave_user_code *dbg_fcn = find_fcn_by_line (main_fcn, lineno); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
706 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
707 // We've found the right (sub)function. Now insert the breakpoint. |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
708 bp_lines line_info; |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
709 line_info.insert (lineno); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
710 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
711 bp_lines ret_one; |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
712 if (dbg_fcn && add_breakpoint_1 (dbg_fcn, fname, line_info, |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
713 condition, ret_one)) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
714 { |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
715 if (! ret_one.empty ()) |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
716 { |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
717 int line = *(ret_one.begin ()); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
718 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
719 if (line) |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
720 retval.insert (line); |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
721 } |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
722 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
723 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
724 |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27000
diff
changeset
|
725 m_evaluator.reset_debug_state (); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
726 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
727 return retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
728 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
729 |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
730 int bp_table::add_breakpoint_in_file (const std::string& file, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
731 int line, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
732 const std::string& condition) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
733 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
734 // Duplicates what the GUI was doing previously, but this action |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
735 // should not be specific to the GUI. |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
736 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
737 bp_file_info info (m_evaluator, file); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
738 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
739 if (! info.ok ()) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
740 return 0; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
741 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
742 return add_breakpoint_in_function (info.fcn (), info.class_name (), |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
743 line, condition); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
744 } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
745 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
746 bp_table::bp_lines |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
747 bp_table::add_breakpoints_in_file (const std::string& file, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
748 const bp_lines& lines, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
749 const std::string& condition) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
750 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
751 // Duplicates what the GUI was doing previously, but this action |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
752 // should not be specific to the GUI. |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
753 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
754 bp_file_info info (m_evaluator, file); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
755 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
756 if (! info.ok ()) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
757 return bp_lines (); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
758 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
759 return add_breakpoints_in_function (info.fcn (), info.class_name (), |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
760 lines, condition); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
761 } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
762 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
763 int bp_table::remove_breakpoint_1 (octave_user_code *fcn, |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
764 const std::string& fname, |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
765 const bp_table::bp_lines& lines) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
766 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
767 int retval = 0; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
768 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
769 std::string file = fcn->fcn_file_name (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
770 |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
771 tree_statement_list *cmds = fcn->body (); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
772 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
773 // FIXME: move the operation on cmds to the tree_statement_list class? |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
774 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
775 if (cmds) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
776 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
777 octave_value_list results = cmds->list_breakpoints (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
778 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
779 if (results.length () > 0) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
780 { |
27261
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
781 interpreter& interp = m_evaluator.get_interpreter (); |
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
782 |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27261
diff
changeset
|
783 event_manager& evmgr = interp.get_event_manager (); |
27261
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
784 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
785 for (const auto& lineno : lines) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
786 { |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
787 cmds->delete_breakpoint (lineno); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
788 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
789 if (! file.empty ()) |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
790 evmgr.update_breakpoint (false, file, lineno); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
791 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
792 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
793 results = cmds->list_breakpoints (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
794 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25336
diff
changeset
|
795 auto it = m_bp_set.find (fname); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
796 if (results.empty () && it != m_bp_set.end ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
797 m_bp_set.erase (it); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
798 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
799 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
800 retval = results.length (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
801 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
802 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
803 return retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
804 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
805 |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
806 int |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
807 bp_table::remove_breakpoint_from_function (const std::string& fname, int line) |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
808 { |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
809 bp_lines line_info; |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
810 line_info.insert (line); |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
811 |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
812 return remove_breakpoints_from_function (fname, line_info); |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
813 } |
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
814 |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
815 int |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
816 bp_table::remove_breakpoints_from_function (const std::string& fname, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
817 const bp_table::bp_lines& lines) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
818 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
819 int retval = 0; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
820 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
821 if (lines.empty ()) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
822 { |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
823 bp_lines results = remove_all_breakpoints_from_function (fname); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
824 retval = results.size (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
825 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
826 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
827 { |
25360
bc5f225bc578
eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents:
25347
diff
changeset
|
828 octave_user_code *dbg_fcn = m_evaluator.get_user_code (fname); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
829 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
830 if (! dbg_fcn) |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
831 error ("remove_breakpoints_from_function: unable to find function %s\n", |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
832 fname.c_str ()); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
833 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
834 retval = remove_breakpoint_1 (dbg_fcn, fname, lines); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
835 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
836 // Search subfunctions in the order they appear in the file. |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
837 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
838 const std::list<std::string> subfcn_names |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
839 = dbg_fcn->subfunction_names (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
840 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
841 std::map<std::string, octave_value> subfcns |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
842 = dbg_fcn->subfunctions (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
843 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
844 for (const auto& subf_nm : subfcn_names) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
845 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
846 const auto q = subfcns.find (subf_nm); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
847 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
848 if (q != subfcns.end ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
849 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
850 octave_user_code *dbg_subfcn = q->second.user_code_value (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
851 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
852 retval += remove_breakpoint_1 (dbg_subfcn, fname, lines); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
853 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
854 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
855 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
856 |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27000
diff
changeset
|
857 m_evaluator.reset_debug_state (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
858 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
859 return retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
860 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
861 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
862 // Remove all breakpoints from a file, including those in subfunctions. |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
863 |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
864 bp_table::bp_lines |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
865 bp_table::remove_all_breakpoints_from_function (const std::string& fname, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
866 bool silent) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
867 { |
29457
313b8b897733
revamp handling of breakpoint line positions
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
868 bp_lines retval; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
869 |
25360
bc5f225bc578
eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents:
25347
diff
changeset
|
870 octave_user_code *dbg_fcn = m_evaluator.get_user_code (fname); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
871 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
872 if (dbg_fcn) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
873 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
874 std::string file = dbg_fcn->fcn_file_name (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
875 |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
876 tree_statement_list *cmds = dbg_fcn->body (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
877 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
878 if (cmds) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
879 { |
27261
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
880 interpreter& interp = m_evaluator.get_interpreter (); |
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
881 |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27261
diff
changeset
|
882 event_manager& evmgr = interp.get_event_manager (); |
27261
dccdc3b001a2
eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents:
27185
diff
changeset
|
883 |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27261
diff
changeset
|
884 retval = cmds->remove_all_breakpoints (evmgr, file); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
885 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25336
diff
changeset
|
886 auto it = m_bp_set.find (fname); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
887 if (it != m_bp_set.end ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
888 m_bp_set.erase (it); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
889 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
890 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
891 else if (! silent) |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
892 error ("remove_all_breakpoints_from_function: " |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
893 "unable to find function %s\n", fname.c_str ()); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
894 |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27000
diff
changeset
|
895 m_evaluator.reset_debug_state (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
896 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
897 return retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
898 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
899 |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
900 int |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
901 bp_table::remove_breakpoint_from_file (const std::string& file, int line) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
902 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
903 // Duplicates what the GUI was doing previously, but this action |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
904 // should not be specific to the GUI. |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
905 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
906 bp_file_info info (m_evaluator, file); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
907 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
908 if (! info.ok ()) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
909 return 0; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
910 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
911 return remove_breakpoint_from_function (info.fcn (), line); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
912 } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
913 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
914 int |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
915 bp_table::remove_breakpoints_from_file (const std::string& file, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
916 const bp_lines& lines) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
917 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
918 // Duplicates what the GUI was doing previously, but this action |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
919 // should not be specific to the GUI. |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
920 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
921 bp_file_info info (m_evaluator, file); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
922 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
923 if (! info.ok ()) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
924 return 0; |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
925 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
926 return remove_breakpoints_from_function (info.fcn (), lines); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
927 } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
928 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
929 bp_table::bp_lines |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
930 bp_table::remove_all_breakpoints_from_file (const std::string& file, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
931 bool silent) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
932 { |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
933 // Duplicates what the GUI was doing previously, but this action |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
934 // should not be specific to the GUI. |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
935 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
936 bp_file_info info (m_evaluator, file); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
937 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
938 if (! info.ok ()) |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
939 return bp_lines (); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
940 |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
941 return remove_all_breakpoints_from_function (info.fcn (), silent); |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
942 } |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
943 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
944 void bp_table::remove_all_breakpoints (void) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
945 { |
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
|
946 // Odd loop structure required because delete will invalidate |
416856765a55
be more careful with using auto in place of explicit const iterator decls
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
947 // m_bp_set iterators. |
25343
4d7790d9793f
use cbegin, crbegin, cend, and crend and auto decls where possible
John W. Eaton <jwe@octave.org>
parents:
25342
diff
changeset
|
948 for (auto it = m_bp_set.cbegin (), it_next = it; |
4d7790d9793f
use cbegin, crbegin, cend, and crend and auto decls where possible
John W. Eaton <jwe@octave.org>
parents:
25342
diff
changeset
|
949 it != m_bp_set.cend (); |
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
|
950 it = it_next) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
951 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
952 ++it_next; |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29457
diff
changeset
|
953 remove_all_breakpoints_from_function (*it); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
954 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
955 |
27037
8408acb7ca4f
make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents:
27000
diff
changeset
|
956 m_evaluator.reset_debug_state (); |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
957 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
958 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
959 std::string find_bkpt_list (octave_value_list slist, std::string match) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
960 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
961 std::string retval; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
962 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
963 for (int i = 0; i < slist.length (); i++) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
964 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
965 if (slist(i).string_value () == match) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
966 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
967 retval = slist(i).string_value (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
968 break; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
969 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
970 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
971 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
972 return retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
973 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
974 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
975 bp_table::fname_bp_map |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
976 bp_table::get_breakpoint_list (const octave_value_list& fname_list) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
977 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
978 fname_bp_map retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
979 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
980 // make copy since changes may invalidate iters of m_bp_set. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
981 std::set<std::string> tmp_bp_set = m_bp_set; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
982 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
983 for (auto& bp_fname : tmp_bp_set) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
984 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
985 if (fname_list.empty () |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
986 || find_bkpt_list (fname_list, bp_fname) != "") |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
987 { |
25360
bc5f225bc578
eliminate some global accesses to the breakpoint table
John W. Eaton <jwe@octave.org>
parents:
25347
diff
changeset
|
988 octave_user_code *dbg_fcn = m_evaluator.get_user_code (bp_fname); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
989 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
990 if (dbg_fcn) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
991 { |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
992 tree_statement_list *cmds = dbg_fcn->body (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
993 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
994 // FIXME: move the operation on cmds to the |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
995 // tree_statement_list class? |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
996 if (cmds) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
997 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
998 std::list<bp_type> bkpts = cmds->breakpoints_and_conds (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
999 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1000 if (! bkpts.empty ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1001 retval[bp_fname] = bkpts; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1002 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1003 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1004 // look for breakpoints in subfunctions |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1005 const std::list<std::string> subf_nm |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1006 = dbg_fcn->subfunction_names (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1007 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1008 std::map<std::string, octave_value> subfcns |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1009 = dbg_fcn->subfunctions (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1010 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1011 for (const auto& subfcn_nm : subf_nm) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1012 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1013 const auto q = subfcns.find (subfcn_nm); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1014 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1015 if (q != subfcns.end ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1016 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1017 octave_user_code *dbg_subfcn |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1018 = q->second.user_code_value (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1019 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1020 cmds = dbg_subfcn->body (); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1021 if (cmds) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1022 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1023 std::list<bp_type> bkpts |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1024 = cmds->breakpoints_and_conds (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1025 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1026 if (! bkpts.empty ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1027 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1028 std::string key |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1029 = bp_fname + '>' + dbg_subfcn->name (); |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1030 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1031 retval[key] = bkpts; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1032 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1033 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1034 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1035 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1036 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1037 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1038 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1039 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1040 return retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1041 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1042 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1043 // Report the status of "dbstop if error ..." and "dbstop if warning ..." |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1044 // If to_screen is true, the output goes to octave_stdout; otherwise it is |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1045 // returned. |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1046 // If dbstop if error is true but no explicit IDs are specified, the return |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1047 // value will have an empty field called "errs". If IDs are specified, the |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1048 // "errs" field will have a row per ID. If dbstop if error is false, there |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1049 // is no "errs" field. The "warn" field is set similarly by dbstop if warning |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1050 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1051 octave_map bp_table::stop_on_err_warn_status (bool to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1052 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1053 octave_map retval; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1054 |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
1055 interpreter& interp = m_evaluator.get_interpreter (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
1056 error_system& es = interp.get_error_system (); |
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
1057 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1058 // print dbstop if error information |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
1059 if (es.debug_on_error ()) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1060 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1061 if (m_errors_that_stop.empty ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1062 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1063 if (to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1064 octave_stdout << "stop if error\n"; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1065 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1066 retval.assign ("errs", octave_value("")); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1067 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1068 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1069 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1070 Cell errs (dim_vector (bp_table::m_errors_that_stop.size (), 1)); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1071 int i = 0; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1072 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1073 for (const auto& e : m_errors_that_stop) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1074 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1075 if (to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1076 octave_stdout << "stop if error " << e << "\n"; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1077 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1078 errs(i++) = e; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1079 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1080 if (! to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1081 retval.assign ("errs", octave_value (errs)); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1082 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1083 } |
24286
6bfb96ab73cb
* bp-table.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
24279
diff
changeset
|
1084 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1085 // print dbstop if caught error information |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
1086 if (es.debug_on_caught ()) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1087 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1088 if (m_caught_that_stop.empty ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1089 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1090 if (to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1091 octave_stdout << "stop if caught error\n"; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1092 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1093 retval.assign ("caught", octave_value("")); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1094 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1095 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1096 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1097 Cell errs (dim_vector (m_caught_that_stop.size (), 1)); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1098 int i = 0; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1099 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1100 for (const auto& e : m_caught_that_stop) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1101 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1102 if (to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1103 octave_stdout << "stop if caught error " << e << "\n"; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1104 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1105 errs(i++) = e; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1106 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1107 if (! to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1108 retval.assign ("caught", octave_value (errs)); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1109 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1110 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1111 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1112 // print dbstop if warning information |
27160
6b0c61a5a0f0
move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
1113 if (es.debug_on_warning ()) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1114 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1115 if (m_warnings_that_stop.empty ()) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1116 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1117 if (to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1118 octave_stdout << "stop if warning\n"; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1119 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1120 retval.assign ("warn", octave_value("")); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1121 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1122 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1123 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1124 Cell warn (dim_vector (m_warnings_that_stop.size (), 1)); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1125 int i = 0; |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1126 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1127 for (const auto& w : m_warnings_that_stop) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1128 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1129 if (to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1130 octave_stdout << "stop if warning " << w << "\n"; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1131 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1132 warn(i++) = w; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1133 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1134 if (! to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1135 retval.assign ("warn", octave_value (warn)); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1136 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1137 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1138 |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1139 // print dbstop if interrupt information |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
1140 if (Vdebug_on_interrupt) |
24738
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1141 { |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1142 if (to_screen) |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1143 octave_stdout << "stop if interrupt\n"; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1144 else |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1145 retval.assign ("intr", octave_value ()); |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1146 } |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1147 |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1148 return retval; |
3695c2cd69b8
don't use singleton pattern for bp_table
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1149 } |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1150 } |