Mercurial > octave-nkf
comparison src/interpfcn/debug.h @ 15088:60ff2cef569d
maint: Move core interpreter files with DEFUNS to interpfcn/ directory
* src/Makefile.am: Adjust build system for new location of files.
* interpfcn/module.mk: Add files and rules to build system.
* data.cc, data.h, debug.cc, debug.h, defaults.cc, defaults.in.h, defun.cc,
defun.h, dirfns.cc, dirfns.h, error.cc, error.h, file-io.cc, file-io.h,
graphics.cc, graphics.in.h, help.cc, help.h, input.cc, input.h, load-path.cc,
load-path.h, load-save.cc, load-save.h, ls-oct-ascii.cc, ls-oct-ascii.h,
oct-hist.cc, oct-hist.h, pager.cc, pager.h, pr-output.cc,
pr-output.h, profiler.cc, profiler.h, sighandlers.cc, sighandlers.h, symtab.cc,
symtab.h, sysdep.cc, sysdep.h, toplev.cc, toplev.h, utils.cc, utils.h,
variables.cc, variables.h: Move files to interpfcn/ directory
author | Rik <rik@octave.org> |
---|---|
date | Fri, 03 Aug 2012 09:31:37 -0700 |
parents | src/debug.h@72c96de7a403 |
children |
comparison
equal
deleted
inserted
replaced
15087:20b33f227599 | 15088:60ff2cef569d |
---|---|
1 /* | |
2 | |
3 Copyright (C) 2001-2012 Ben Sapp | |
4 | |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 3 of the License, or (at your | |
10 option) any later version. | |
11 | |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with Octave; see the file COPYING. If not, see | |
19 <http://www.gnu.org/licenses/>. | |
20 | |
21 */ | |
22 | |
23 #if !defined (octave_debug_h) | |
24 #define octave_debug_h 1 | |
25 | |
26 #include <map> | |
27 #include <set> | |
28 #include "ov.h" | |
29 #include "dRowVector.h" | |
30 | |
31 class octave_value_list; | |
32 class octave_user_code; | |
33 | |
34 // Interface to breakpoints,. | |
35 | |
36 class | |
37 OCTINTERP_API | |
38 bp_table | |
39 { | |
40 private: | |
41 | |
42 bp_table (void) : bp_set () { } | |
43 | |
44 ~bp_table (void) { } | |
45 | |
46 public: | |
47 | |
48 typedef std::map<int, int> intmap; | |
49 | |
50 typedef intmap::const_iterator const_intmap_iterator; | |
51 typedef intmap::iterator intmap_iterator; | |
52 | |
53 typedef std::map <std::string, intmap> fname_line_map; | |
54 | |
55 typedef fname_line_map::const_iterator const_fname_line_map_iterator; | |
56 typedef fname_line_map::iterator fname_line_map_iterator; | |
57 | |
58 static bool instance_ok (void); | |
59 | |
60 // Add a breakpoint at the nearest executable line. | |
61 static intmap add_breakpoint (const std::string& fname = "", | |
62 const intmap& lines = intmap ()) | |
63 { | |
64 return instance_ok () | |
65 ? instance->do_add_breakpoint (fname, lines) : intmap (); | |
66 } | |
67 | |
68 // Remove a breakpoint from a line in file. | |
69 static int remove_breakpoint (const std::string& fname = "", | |
70 const intmap& lines = intmap ()) | |
71 { | |
72 return instance_ok () | |
73 ? instance->do_remove_breakpoint (fname, lines) : 0; | |
74 } | |
75 | |
76 // Remove all the breakpoints in a specified file. | |
77 static intmap remove_all_breakpoints_in_file (const std::string& fname, | |
78 bool silent = false) | |
79 { | |
80 return instance_ok () | |
81 ? instance->do_remove_all_breakpoints_in_file (fname, silent) : intmap (); | |
82 } | |
83 | |
84 // Remove all the breakpoints registered with octave. | |
85 static void remove_all_breakpoints (void) | |
86 { | |
87 if (instance_ok ()) | |
88 instance->do_remove_all_breakpoints (); | |
89 } | |
90 | |
91 // Return all breakpoints. Each element of the map is a vector | |
92 // containing the breakpoints corresponding to a given function name. | |
93 static fname_line_map | |
94 get_breakpoint_list (const octave_value_list& fname_list) | |
95 { | |
96 return instance_ok () | |
97 ? instance->do_get_breakpoint_list (fname_list) : fname_line_map (); | |
98 } | |
99 | |
100 static bool | |
101 have_breakpoints (void) | |
102 { | |
103 return instance_ok () ? instance->do_have_breakpoints () : 0; | |
104 } | |
105 | |
106 private: | |
107 | |
108 typedef std::set<std::string>::const_iterator const_bp_set_iterator; | |
109 typedef std::set<std::string>::iterator bp_set_iterator; | |
110 | |
111 // Set of function names containing at least one breakpoint. | |
112 std::set<std::string> bp_set; | |
113 | |
114 static bp_table *instance; | |
115 | |
116 static void cleanup_instance (void) { delete instance; instance = 0; } | |
117 | |
118 intmap do_add_breakpoint (const std::string& fname, const intmap& lines); | |
119 | |
120 int do_remove_breakpoint (const std::string&, const intmap& lines); | |
121 | |
122 intmap do_remove_all_breakpoints_in_file (const std::string& fname, | |
123 bool silent); | |
124 | |
125 void do_remove_all_breakpoints (void); | |
126 | |
127 fname_line_map do_get_breakpoint_list (const octave_value_list& fname_list); | |
128 | |
129 bool do_have_breakpoints (void) { return (! bp_set.empty ()); } | |
130 }; | |
131 | |
132 std::string get_file_line (const std::string& fname, size_t line); | |
133 | |
134 #endif |