Mercurial > octave
annotate libinterp/corefcn/call-stack.h @ 26377:fff643eb3514
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 02 Jan 2019 16:45:58 -0500 |
parents | f23f27e78aa2 00f796120a6d |
children | cf9e10ce3351 |
rev | line source |
---|---|
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
26376
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
26093
diff
changeset
|
3 Copyright (C) 1993-2019 John W. Eaton |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22600
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22600
diff
changeset
|
10 (at your option) any later version. |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22600
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22600
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22600
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22600
diff
changeset
|
15 GNU General Public License for more details. |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 */ |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 #if ! defined (octave_call_stack_h) |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 #define octave_call_stack_h 1 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #include "octave-config.h" |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #include <deque> |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include <string> |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 class octave_function; |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
32 class octave_map; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 class octave_user_code; |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 class octave_user_script; |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
35 class octave_value; |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
36 class octave_value_list; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 |
24362
3fc24b792a24
avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24361
diff
changeset
|
38 #include "symscope.h" |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
40 namespace octave |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 { |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
42 class interpreter; |
26092
661dfb062485
use symbol_info_list to gather data for save function
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
43 class symbol_info_list; |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
44 class unwind_protect; |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
45 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
46 class |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
47 OCTINTERP_API |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
48 call_stack |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
49 { |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 public: |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
52 class stack_frame |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
53 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
54 public: |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
55 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
56 friend class call_stack; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
57 |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23553
diff
changeset
|
58 stack_frame (octave_function *fcn = nullptr, |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
59 unwind_protect *up_frame = nullptr, |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
60 const symbol_scope& scope = symbol_scope (), |
24362
3fc24b792a24
avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24361
diff
changeset
|
61 symbol_record::context_id context = 0, size_t prev = 0) |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
62 : m_fcn (fcn), m_unwind_protect_frame (up_frame), |
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
63 m_line (-1), m_column (-1), m_scope (scope), |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
64 m_context (context), m_prev (prev) |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
65 { } |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
66 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
67 stack_frame (const stack_frame& elt) |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
68 : m_fcn (elt.m_fcn), |
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
69 m_unwind_protect_frame (elt.m_unwind_protect_frame), |
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
70 m_line (elt.m_line), m_column (elt.m_column), |
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
71 m_scope (elt.m_scope), m_context (elt.m_context), |
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
72 m_prev (elt.m_prev) |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
73 { } |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
74 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
75 int line (void) const { return m_line; } |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
76 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
77 int column (void) const { return m_column; } |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
78 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
79 std::string fcn_file_name (void) const; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
80 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
81 std::string fcn_name (bool print_subfn = true) const; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
82 |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
83 bool operator == (const stack_frame& rhs) const; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
84 |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
85 symbol_info_list |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
86 make_symbol_info_list (const std::list<symbol_record>& srl) const; |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
87 |
26092
661dfb062485
use symbol_info_list to gather data for save function
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
88 symbol_info_list glob_symbol_info (const std::string& pat) const; |
661dfb062485
use symbol_info_list to gather data for save function
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
89 |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
90 symbol_info_list regexp_symbol_info (const std::string& pat) const; |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
91 |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
92 symbol_info_list get_symbol_info (void) const; |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
93 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
94 private: |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
95 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
96 octave_function *m_fcn; |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
97 unwind_protect *m_unwind_protect_frame; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
98 int m_line; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
99 int m_column; |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
100 symbol_scope m_scope; |
24362
3fc24b792a24
avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24361
diff
changeset
|
101 symbol_record::context_id m_context; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
102 size_t m_prev; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
103 }; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
104 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
105 typedef std::deque<stack_frame>::iterator iterator; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
106 typedef std::deque<stack_frame>::const_iterator const_iterator; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
107 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
108 typedef std::deque<stack_frame>::reverse_iterator reverse_iterator; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
109 typedef std::deque<stack_frame>::const_reverse_iterator const_reverse_iterator; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
110 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
111 call_stack (interpreter& interp); |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
112 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
113 // Current function (top of stack). |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
114 octave_function * current (void) const |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
115 { |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
116 octave_function *retval = nullptr; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
117 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
118 if (! cs.empty ()) |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
119 { |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
120 const stack_frame& elt = cs[curr_frame]; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
121 retval = elt.m_fcn; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
122 } |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
123 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
124 return retval; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
125 } |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
126 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
127 // Current line in current function. |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
128 int current_line (void) const; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
129 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
130 // Current column in current function. |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
131 int current_column (void) const; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
132 |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
133 // Caller function, may be built-in. |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23553
diff
changeset
|
134 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
135 octave_function * caller (void) const |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
136 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
137 return curr_frame > 1 ? cs[curr_frame-1].m_fcn : cs[0].m_fcn; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
138 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
139 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
140 size_t current_frame (void) const { return curr_frame; } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
141 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
142 size_t size (void) const { return cs.size (); } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
144 size_t num_user_code_frames (octave_idx_type& curr_user_frame) const; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
145 |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
146 symbol_scope current_scope (void) const |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
147 { |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
148 return (curr_frame > 0 && curr_frame < cs.size () |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
149 ? cs[curr_frame].m_scope : symbol_scope ()); |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
150 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
151 |
24362
3fc24b792a24
avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24361
diff
changeset
|
152 symbol_record::context_id current_context (void) const |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
153 { |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
154 return (curr_frame > 0 && curr_frame < cs.size () |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
155 ? cs[curr_frame].m_context : 0); |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
156 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
157 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
158 // Function at location N on the call stack (N == 0 is current), may |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
159 // be built-in. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
160 octave_function * element (size_t n) |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
161 { |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
162 octave_function *retval = nullptr; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
163 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
164 if (cs.size () > n) |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
165 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
166 stack_frame& elt = cs[n]; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
167 retval = elt.m_fcn; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
168 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
169 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
170 return retval; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
171 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
172 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
173 // User code caller. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
174 octave_user_code * caller_user_code (size_t nskip = 0) const; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
175 |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
176 unwind_protect *curr_fcn_unwind_protect_frame (void) const; |
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
177 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
178 // Line in user code caller. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
179 int caller_user_code_line (void) const; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
180 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
181 // Column in user code caller. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
182 int caller_user_code_column (void) const; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
183 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
184 // Current function that we are debugging. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
185 octave_user_code * debug_user_code (void) const; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
186 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
187 // Line number in current function that we are debugging. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
188 int debug_user_code_line (void) const; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
189 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
190 // Column number in current function that we are debugging. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
191 int debug_user_code_column (void) const; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
192 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
193 // Return TRUE if all elements on the call stack are scripts. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
194 bool all_scripts (void) const; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
195 |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
196 void push (octave_function *fcn = nullptr, |
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
197 unwind_protect *up_frame = nullptr); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
198 |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
199 void push (octave_function *fcn, unwind_protect *up_frame, |
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
200 const symbol_scope& scope, symbol_record::context_id context); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
201 |
24362
3fc24b792a24
avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24361
diff
changeset
|
202 void push (const symbol_scope& scope, symbol_record::context_id context) |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
203 { |
25399
6ca2c0d76d84
store unwind protect frame for function evaluation in call_stack object
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
204 push (nullptr, nullptr, scope, context); |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
205 } |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
206 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
207 void set_location (int l, int c) |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
208 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
209 if (! cs.empty ()) |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
210 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
211 stack_frame& elt = cs.back (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
212 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
213 elt.m_line = l; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
214 elt.m_column = c; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
215 } |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
216 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
217 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
218 void set_line (int l) |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
219 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
220 if (! cs.empty ()) |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
221 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
222 stack_frame& elt = cs.back (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
223 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
224 elt.m_line = l; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
225 } |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
226 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
227 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
228 void set_column (int c) |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
229 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
230 if (! cs.empty ()) |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
231 { |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
232 stack_frame& elt = cs.back (); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
233 |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
234 elt.m_column = c; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
235 } |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
236 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
237 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
238 bool goto_frame (size_t n = 0, bool verbose = false); |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
239 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
240 void restore_frame (size_t n) |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
241 { |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
242 goto_frame (n); |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
243 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
244 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
245 bool goto_frame_relative (int n, bool verbose = false); |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
246 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
247 void goto_caller_frame (void); |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
248 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
249 void goto_base_frame (void); |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
250 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
251 std::list<call_stack::stack_frame> |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
252 backtrace_frames (size_t nskip, octave_idx_type& curr_user_frame) const; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
253 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
254 std::list<call_stack::stack_frame> |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
255 backtrace_frames (size_t nskip = 0) const |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
256 { |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
257 octave_idx_type curr_user_frame = -1; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
258 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
259 return backtrace_frames (nskip, curr_user_frame); |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
260 } |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
261 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
262 octave_map backtrace (size_t nskip, octave_idx_type& curr_user_frame, |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
263 bool print_subfn = true) const; |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
264 |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
265 octave_map backtrace (size_t nskip = 0); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
266 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
267 octave_map empty_backtrace (void) const; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
268 |
23630
8a47d4735655
avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
269 void pop (void); |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
271 void clear (void) { cs.clear (); } |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
272 |
26092
661dfb062485
use symbol_info_list to gather data for save function
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
273 symbol_info_list glob_symbol_info (const std::string& pat) const; |
661dfb062485
use symbol_info_list to gather data for save function
John W. Eaton <jwe@octave.org>
parents:
25399
diff
changeset
|
274 |
26093
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
275 symbol_info_list regexp_symbol_info (const std::string& pat) const; |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
276 |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
277 symbol_info_list get_symbol_info (void) const; |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
278 |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
279 symbol_info_list top_scope_symbol_info (void) const; |
6a03af2c4c9e
use symbol_info_list to gather data for saving workspace on crash
John W. Eaton <jwe@octave.org>
parents:
26092
diff
changeset
|
280 |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
281 octave_value max_stack_depth (const octave_value_list& args, int nargout); |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
282 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
283 private: |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
284 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
285 // The current call stack. |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
286 std::deque<stack_frame> cs; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
287 |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
288 size_t curr_frame; |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
289 |
24855
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
290 int m_max_stack_depth; |
41f80b9af274
prevent stack overflow crash on deeply nested function calls (bug #47620)
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
291 |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
292 interpreter& m_interpreter; |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
293 }; |
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
294 } |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
295 |
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
296 #endif |