1a45ae5f8SJohn Marino /* Skipping uninteresting files and functions while stepping.
2a45ae5f8SJohn Marino
3*ef5ccd6cSJohn Marino Copyright (C) 2011-2013 Free Software Foundation, Inc.
4a45ae5f8SJohn Marino
5a45ae5f8SJohn Marino This program is free software; you can redistribute it and/or modify
6a45ae5f8SJohn Marino it under the terms of the GNU General Public License as published by
7a45ae5f8SJohn Marino the Free Software Foundation; either version 3 of the License, or
8a45ae5f8SJohn Marino (at your option) any later version.
9a45ae5f8SJohn Marino
10a45ae5f8SJohn Marino This program is distributed in the hope that it will be useful,
11a45ae5f8SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of
12a45ae5f8SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13a45ae5f8SJohn Marino GNU General Public License for more details.
14a45ae5f8SJohn Marino
15a45ae5f8SJohn Marino You should have received a copy of the GNU General Public License
16a45ae5f8SJohn Marino along with this program. If not, see <http://www.gnu.org/licenses/>. */
17a45ae5f8SJohn Marino
18a45ae5f8SJohn Marino #include "defs.h"
19a45ae5f8SJohn Marino #include "skip.h"
20a45ae5f8SJohn Marino #include "value.h"
21a45ae5f8SJohn Marino #include "valprint.h"
22a45ae5f8SJohn Marino #include "ui-out.h"
23a45ae5f8SJohn Marino #include "gdb_string.h"
24a45ae5f8SJohn Marino #include "symtab.h"
25a45ae5f8SJohn Marino #include "gdbcmd.h"
26a45ae5f8SJohn Marino #include "command.h"
27a45ae5f8SJohn Marino #include "completer.h"
28a45ae5f8SJohn Marino #include "stack.h"
29a45ae5f8SJohn Marino #include "cli/cli-utils.h"
30a45ae5f8SJohn Marino #include "arch-utils.h"
31a45ae5f8SJohn Marino #include "linespec.h"
32a45ae5f8SJohn Marino #include "objfiles.h"
33a45ae5f8SJohn Marino #include "exceptions.h"
34a45ae5f8SJohn Marino #include "breakpoint.h" /* for get_sal_arch () */
35*ef5ccd6cSJohn Marino #include "source.h"
36*ef5ccd6cSJohn Marino #include "filenames.h"
37a45ae5f8SJohn Marino
38a45ae5f8SJohn Marino struct skiplist_entry
39a45ae5f8SJohn Marino {
40a45ae5f8SJohn Marino int number;
41a45ae5f8SJohn Marino
42a45ae5f8SJohn Marino /* NULL if this isn't a skiplist entry for an entire file.
43a45ae5f8SJohn Marino The skiplist entry owns this pointer. */
44a45ae5f8SJohn Marino char *filename;
45a45ae5f8SJohn Marino
46a45ae5f8SJohn Marino /* The name of the marked-for-skip function, if this is a skiplist
47*ef5ccd6cSJohn Marino entry for a function.
48a45ae5f8SJohn Marino The skiplist entry owns this pointer. */
49a45ae5f8SJohn Marino char *function_name;
50a45ae5f8SJohn Marino
51a45ae5f8SJohn Marino int enabled;
52a45ae5f8SJohn Marino
53a45ae5f8SJohn Marino struct skiplist_entry *next;
54a45ae5f8SJohn Marino };
55a45ae5f8SJohn Marino
56a45ae5f8SJohn Marino static void add_skiplist_entry (struct skiplist_entry *e);
57*ef5ccd6cSJohn Marino static void skip_function (const char *name);
58a45ae5f8SJohn Marino
59a45ae5f8SJohn Marino static struct skiplist_entry *skiplist_entry_chain;
60a45ae5f8SJohn Marino static int skiplist_entry_count;
61a45ae5f8SJohn Marino
62a45ae5f8SJohn Marino #define ALL_SKIPLIST_ENTRIES(E) \
63a45ae5f8SJohn Marino for (E = skiplist_entry_chain; E; E = E->next)
64a45ae5f8SJohn Marino
65a45ae5f8SJohn Marino #define ALL_SKIPLIST_ENTRIES_SAFE(E,TMP) \
66a45ae5f8SJohn Marino for (E = skiplist_entry_chain; \
67a45ae5f8SJohn Marino E ? (TMP = E->next, 1) : 0; \
68a45ae5f8SJohn Marino E = TMP)
69a45ae5f8SJohn Marino
70a45ae5f8SJohn Marino static void
skip_file_command(char * arg,int from_tty)71a45ae5f8SJohn Marino skip_file_command (char *arg, int from_tty)
72a45ae5f8SJohn Marino {
73a45ae5f8SJohn Marino struct skiplist_entry *e;
74a45ae5f8SJohn Marino struct symtab *symtab;
75*ef5ccd6cSJohn Marino const char *filename = NULL;
76a45ae5f8SJohn Marino
77a45ae5f8SJohn Marino /* If no argument was given, try to default to the last
78a45ae5f8SJohn Marino displayed codepoint. */
79*ef5ccd6cSJohn Marino if (arg == NULL)
80a45ae5f8SJohn Marino {
81a45ae5f8SJohn Marino symtab = get_last_displayed_symtab ();
82*ef5ccd6cSJohn Marino if (symtab == NULL)
83a45ae5f8SJohn Marino error (_("No default file now."));
84*ef5ccd6cSJohn Marino
85*ef5ccd6cSJohn Marino /* It is not a typo, symtab_to_filename_for_display woule be needlessly
86*ef5ccd6cSJohn Marino ambiguous. */
87*ef5ccd6cSJohn Marino filename = symtab_to_fullname (symtab);
88a45ae5f8SJohn Marino }
89a45ae5f8SJohn Marino else
90a45ae5f8SJohn Marino {
91a45ae5f8SJohn Marino symtab = lookup_symtab (arg);
92*ef5ccd6cSJohn Marino if (symtab == NULL)
93a45ae5f8SJohn Marino {
94a45ae5f8SJohn Marino fprintf_filtered (gdb_stderr, _("No source file named %s.\n"), arg);
95a45ae5f8SJohn Marino if (!nquery (_("\
96a45ae5f8SJohn Marino Ignore file pending future shared library load? ")))
97a45ae5f8SJohn Marino return;
98a45ae5f8SJohn Marino }
99*ef5ccd6cSJohn Marino /* Do not use SYMTAB's filename, later loaded shared libraries may match
100*ef5ccd6cSJohn Marino given ARG but not SYMTAB's filename. */
101*ef5ccd6cSJohn Marino filename = arg;
102a45ae5f8SJohn Marino }
103a45ae5f8SJohn Marino
104a45ae5f8SJohn Marino e = XZALLOC (struct skiplist_entry);
105a45ae5f8SJohn Marino e->filename = xstrdup (filename);
106a45ae5f8SJohn Marino e->enabled = 1;
107a45ae5f8SJohn Marino
108a45ae5f8SJohn Marino add_skiplist_entry (e);
109a45ae5f8SJohn Marino
110a45ae5f8SJohn Marino printf_filtered (_("File %s will be skipped when stepping.\n"), filename);
111a45ae5f8SJohn Marino }
112a45ae5f8SJohn Marino
113a45ae5f8SJohn Marino static void
skip_function_command(char * arg,int from_tty)114a45ae5f8SJohn Marino skip_function_command (char *arg, int from_tty)
115a45ae5f8SJohn Marino {
116*ef5ccd6cSJohn Marino const char *name = NULL;
117a45ae5f8SJohn Marino
118a45ae5f8SJohn Marino /* Default to the current function if no argument is given. */
119*ef5ccd6cSJohn Marino if (arg == NULL)
120a45ae5f8SJohn Marino {
121a45ae5f8SJohn Marino CORE_ADDR pc;
122*ef5ccd6cSJohn Marino
123a45ae5f8SJohn Marino if (!last_displayed_sal_is_valid ())
124a45ae5f8SJohn Marino error (_("No default function now."));
125a45ae5f8SJohn Marino
126a45ae5f8SJohn Marino pc = get_last_displayed_addr ();
127*ef5ccd6cSJohn Marino if (!find_pc_partial_function (pc, &name, NULL, NULL))
128a45ae5f8SJohn Marino {
129a45ae5f8SJohn Marino error (_("No function found containing current program point %s."),
130a45ae5f8SJohn Marino paddress (get_current_arch (), pc));
131a45ae5f8SJohn Marino }
132*ef5ccd6cSJohn Marino skip_function (name);
133a45ae5f8SJohn Marino }
134a45ae5f8SJohn Marino else
135a45ae5f8SJohn Marino {
136*ef5ccd6cSJohn Marino if (lookup_symbol (arg, NULL, VAR_DOMAIN, NULL) == NULL)
137a45ae5f8SJohn Marino {
138a45ae5f8SJohn Marino fprintf_filtered (gdb_stderr,
139*ef5ccd6cSJohn Marino _("No function found named %s.\n"), arg);
140a45ae5f8SJohn Marino
141a45ae5f8SJohn Marino if (nquery (_("\
142a45ae5f8SJohn Marino Ignore function pending future shared library load? ")))
143a45ae5f8SJohn Marino {
144*ef5ccd6cSJohn Marino /* Add the unverified skiplist entry. */
145*ef5ccd6cSJohn Marino skip_function (arg);
146a45ae5f8SJohn Marino }
147a45ae5f8SJohn Marino return;
148a45ae5f8SJohn Marino }
149a45ae5f8SJohn Marino
150*ef5ccd6cSJohn Marino skip_function (arg);
151a45ae5f8SJohn Marino }
152a45ae5f8SJohn Marino }
153a45ae5f8SJohn Marino
154a45ae5f8SJohn Marino static void
skip_info(char * arg,int from_tty)155a45ae5f8SJohn Marino skip_info (char *arg, int from_tty)
156a45ae5f8SJohn Marino {
157a45ae5f8SJohn Marino struct skiplist_entry *e;
158a45ae5f8SJohn Marino int num_printable_entries = 0;
159a45ae5f8SJohn Marino struct value_print_options opts;
160a45ae5f8SJohn Marino struct cleanup *tbl_chain;
161a45ae5f8SJohn Marino
162a45ae5f8SJohn Marino get_user_print_options (&opts);
163a45ae5f8SJohn Marino
164a45ae5f8SJohn Marino /* Count the number of rows in the table and see if we need space for a
165a45ae5f8SJohn Marino 64-bit address anywhere. */
166a45ae5f8SJohn Marino ALL_SKIPLIST_ENTRIES (e)
167*ef5ccd6cSJohn Marino if (arg == NULL || number_is_in_list (arg, e->number))
168a45ae5f8SJohn Marino num_printable_entries++;
169a45ae5f8SJohn Marino
170a45ae5f8SJohn Marino if (num_printable_entries == 0)
171a45ae5f8SJohn Marino {
172*ef5ccd6cSJohn Marino if (arg == NULL)
173a45ae5f8SJohn Marino ui_out_message (current_uiout, 0, _("\
174a45ae5f8SJohn Marino Not skipping any files or functions.\n"));
175a45ae5f8SJohn Marino else
176a45ae5f8SJohn Marino ui_out_message (current_uiout, 0,
177a45ae5f8SJohn Marino _("No skiplist entries found with number %s.\n"), arg);
178a45ae5f8SJohn Marino
179a45ae5f8SJohn Marino return;
180a45ae5f8SJohn Marino }
181a45ae5f8SJohn Marino
182*ef5ccd6cSJohn Marino tbl_chain = make_cleanup_ui_out_table_begin_end (current_uiout, 4,
183a45ae5f8SJohn Marino num_printable_entries,
184a45ae5f8SJohn Marino "SkiplistTable");
185a45ae5f8SJohn Marino
186a45ae5f8SJohn Marino ui_out_table_header (current_uiout, 7, ui_left, "number", "Num"); /* 1 */
187a45ae5f8SJohn Marino ui_out_table_header (current_uiout, 14, ui_left, "type", "Type"); /* 2 */
188a45ae5f8SJohn Marino ui_out_table_header (current_uiout, 3, ui_left, "enabled", "Enb"); /* 3 */
189*ef5ccd6cSJohn Marino ui_out_table_header (current_uiout, 40, ui_noalign, "what", "What"); /* 4 */
190a45ae5f8SJohn Marino ui_out_table_body (current_uiout);
191a45ae5f8SJohn Marino
192a45ae5f8SJohn Marino ALL_SKIPLIST_ENTRIES (e)
193a45ae5f8SJohn Marino {
194a45ae5f8SJohn Marino struct cleanup *entry_chain;
195a45ae5f8SJohn Marino
196a45ae5f8SJohn Marino QUIT;
197*ef5ccd6cSJohn Marino if (arg != NULL && !number_is_in_list (arg, e->number))
198a45ae5f8SJohn Marino continue;
199a45ae5f8SJohn Marino
200a45ae5f8SJohn Marino entry_chain = make_cleanup_ui_out_tuple_begin_end (current_uiout,
201a45ae5f8SJohn Marino "blklst-entry");
202a45ae5f8SJohn Marino ui_out_field_int (current_uiout, "number", e->number); /* 1 */
203a45ae5f8SJohn Marino
204*ef5ccd6cSJohn Marino if (e->function_name != NULL)
205a45ae5f8SJohn Marino ui_out_field_string (current_uiout, "type", "function"); /* 2 */
206*ef5ccd6cSJohn Marino else if (e->filename != NULL)
207a45ae5f8SJohn Marino ui_out_field_string (current_uiout, "type", "file"); /* 2 */
208a45ae5f8SJohn Marino else
209a45ae5f8SJohn Marino internal_error (__FILE__, __LINE__, _("\
210a45ae5f8SJohn Marino Skiplist entry should have either a filename or a function name."));
211a45ae5f8SJohn Marino
212a45ae5f8SJohn Marino if (e->enabled)
213a45ae5f8SJohn Marino ui_out_field_string (current_uiout, "enabled", "y"); /* 3 */
214a45ae5f8SJohn Marino else
215a45ae5f8SJohn Marino ui_out_field_string (current_uiout, "enabled", "n"); /* 3 */
216a45ae5f8SJohn Marino
217*ef5ccd6cSJohn Marino if (e->function_name != NULL)
218*ef5ccd6cSJohn Marino ui_out_field_string (current_uiout, "what", e->function_name); /* 4 */
219*ef5ccd6cSJohn Marino else if (e->filename != NULL)
220*ef5ccd6cSJohn Marino ui_out_field_string (current_uiout, "what", e->filename); /* 4 */
221a45ae5f8SJohn Marino
222a45ae5f8SJohn Marino ui_out_text (current_uiout, "\n");
223a45ae5f8SJohn Marino do_cleanups (entry_chain);
224a45ae5f8SJohn Marino }
225a45ae5f8SJohn Marino
226a45ae5f8SJohn Marino do_cleanups (tbl_chain);
227a45ae5f8SJohn Marino }
228a45ae5f8SJohn Marino
229a45ae5f8SJohn Marino static void
skip_enable_command(char * arg,int from_tty)230a45ae5f8SJohn Marino skip_enable_command (char *arg, int from_tty)
231a45ae5f8SJohn Marino {
232a45ae5f8SJohn Marino struct skiplist_entry *e;
233a45ae5f8SJohn Marino int found = 0;
234a45ae5f8SJohn Marino
235a45ae5f8SJohn Marino ALL_SKIPLIST_ENTRIES (e)
236*ef5ccd6cSJohn Marino if (arg == NULL || number_is_in_list (arg, e->number))
237a45ae5f8SJohn Marino {
238a45ae5f8SJohn Marino e->enabled = 1;
239a45ae5f8SJohn Marino found = 1;
240a45ae5f8SJohn Marino }
241a45ae5f8SJohn Marino
242a45ae5f8SJohn Marino if (!found)
243a45ae5f8SJohn Marino error (_("No skiplist entries found with number %s."), arg);
244a45ae5f8SJohn Marino }
245a45ae5f8SJohn Marino
246a45ae5f8SJohn Marino static void
skip_disable_command(char * arg,int from_tty)247a45ae5f8SJohn Marino skip_disable_command (char *arg, int from_tty)
248a45ae5f8SJohn Marino {
249a45ae5f8SJohn Marino struct skiplist_entry *e;
250a45ae5f8SJohn Marino int found = 0;
251a45ae5f8SJohn Marino
252a45ae5f8SJohn Marino ALL_SKIPLIST_ENTRIES (e)
253*ef5ccd6cSJohn Marino if (arg == NULL || number_is_in_list (arg, e->number))
254a45ae5f8SJohn Marino {
255a45ae5f8SJohn Marino e->enabled = 0;
256a45ae5f8SJohn Marino found = 1;
257a45ae5f8SJohn Marino }
258a45ae5f8SJohn Marino
259a45ae5f8SJohn Marino if (!found)
260a45ae5f8SJohn Marino error (_("No skiplist entries found with number %s."), arg);
261a45ae5f8SJohn Marino }
262a45ae5f8SJohn Marino
263a45ae5f8SJohn Marino static void
skip_delete_command(char * arg,int from_tty)264a45ae5f8SJohn Marino skip_delete_command (char *arg, int from_tty)
265a45ae5f8SJohn Marino {
266a45ae5f8SJohn Marino struct skiplist_entry *e, *temp, *b_prev;
267a45ae5f8SJohn Marino int found = 0;
268a45ae5f8SJohn Marino
269a45ae5f8SJohn Marino b_prev = 0;
270a45ae5f8SJohn Marino ALL_SKIPLIST_ENTRIES_SAFE (e, temp)
271*ef5ccd6cSJohn Marino if (arg == NULL || number_is_in_list (arg, e->number))
272a45ae5f8SJohn Marino {
273*ef5ccd6cSJohn Marino if (b_prev != NULL)
274a45ae5f8SJohn Marino b_prev->next = e->next;
275a45ae5f8SJohn Marino else
276a45ae5f8SJohn Marino skiplist_entry_chain = e->next;
277a45ae5f8SJohn Marino
278a45ae5f8SJohn Marino xfree (e->function_name);
279a45ae5f8SJohn Marino xfree (e->filename);
280a45ae5f8SJohn Marino xfree (e);
281a45ae5f8SJohn Marino found = 1;
282a45ae5f8SJohn Marino }
283a45ae5f8SJohn Marino else
284a45ae5f8SJohn Marino {
285a45ae5f8SJohn Marino b_prev = e;
286a45ae5f8SJohn Marino }
287a45ae5f8SJohn Marino
288a45ae5f8SJohn Marino if (!found)
289a45ae5f8SJohn Marino error (_("No skiplist entries found with number %s."), arg);
290a45ae5f8SJohn Marino }
291a45ae5f8SJohn Marino
292*ef5ccd6cSJohn Marino /* Create a skiplist entry for the given function NAME and add it to the
293*ef5ccd6cSJohn Marino list. */
294a45ae5f8SJohn Marino
295a45ae5f8SJohn Marino static void
skip_function(const char * name)296*ef5ccd6cSJohn Marino skip_function (const char *name)
297a45ae5f8SJohn Marino {
298a45ae5f8SJohn Marino struct skiplist_entry *e = XZALLOC (struct skiplist_entry);
299a45ae5f8SJohn Marino
300a45ae5f8SJohn Marino e->enabled = 1;
301a45ae5f8SJohn Marino e->function_name = xstrdup (name);
302a45ae5f8SJohn Marino
303a45ae5f8SJohn Marino add_skiplist_entry (e);
304a45ae5f8SJohn Marino
305*ef5ccd6cSJohn Marino printf_filtered (_("Function %s will be skipped when stepping.\n"), name);
306a45ae5f8SJohn Marino }
307a45ae5f8SJohn Marino
308a45ae5f8SJohn Marino /* Add the given skiplist entry to our list, and set the entry's number. */
309a45ae5f8SJohn Marino
310a45ae5f8SJohn Marino static void
add_skiplist_entry(struct skiplist_entry * e)311a45ae5f8SJohn Marino add_skiplist_entry (struct skiplist_entry *e)
312a45ae5f8SJohn Marino {
313a45ae5f8SJohn Marino struct skiplist_entry *e1;
314a45ae5f8SJohn Marino
315a45ae5f8SJohn Marino e->number = ++skiplist_entry_count;
316a45ae5f8SJohn Marino
317a45ae5f8SJohn Marino /* Add to the end of the chain so that the list of
318a45ae5f8SJohn Marino skiplist entries will be in numerical order. */
319a45ae5f8SJohn Marino
320a45ae5f8SJohn Marino e1 = skiplist_entry_chain;
321*ef5ccd6cSJohn Marino if (e1 == NULL)
322a45ae5f8SJohn Marino skiplist_entry_chain = e;
323a45ae5f8SJohn Marino else
324a45ae5f8SJohn Marino {
325a45ae5f8SJohn Marino while (e1->next)
326a45ae5f8SJohn Marino e1 = e1->next;
327a45ae5f8SJohn Marino e1->next = e;
328a45ae5f8SJohn Marino }
329a45ae5f8SJohn Marino }
330a45ae5f8SJohn Marino
331*ef5ccd6cSJohn Marino
332*ef5ccd6cSJohn Marino /* See skip.h. */
333a45ae5f8SJohn Marino
334a45ae5f8SJohn Marino int
function_name_is_marked_for_skip(const char * function_name,const struct symtab_and_line * function_sal)335*ef5ccd6cSJohn Marino function_name_is_marked_for_skip (const char *function_name,
336*ef5ccd6cSJohn Marino const struct symtab_and_line *function_sal)
337a45ae5f8SJohn Marino {
338*ef5ccd6cSJohn Marino int searched_for_fullname = 0;
339*ef5ccd6cSJohn Marino const char *fullname = NULL;
340a45ae5f8SJohn Marino struct skiplist_entry *e;
341a45ae5f8SJohn Marino
342*ef5ccd6cSJohn Marino if (function_name == NULL)
343*ef5ccd6cSJohn Marino return 0;
344*ef5ccd6cSJohn Marino
345a45ae5f8SJohn Marino ALL_SKIPLIST_ENTRIES (e)
346a45ae5f8SJohn Marino {
347*ef5ccd6cSJohn Marino if (!e->enabled)
348a45ae5f8SJohn Marino continue;
349a45ae5f8SJohn Marino
350a45ae5f8SJohn Marino /* Does the pc we're stepping into match e's stored pc? */
351*ef5ccd6cSJohn Marino if (e->function_name != NULL
352*ef5ccd6cSJohn Marino && strcmp_iw (function_name, e->function_name) == 0)
353a45ae5f8SJohn Marino return 1;
354a45ae5f8SJohn Marino
355*ef5ccd6cSJohn Marino if (e->filename != NULL)
356a45ae5f8SJohn Marino {
357*ef5ccd6cSJohn Marino /* Check first sole SYMTAB->FILENAME. It does not need to be
358*ef5ccd6cSJohn Marino a substring of symtab_to_fullname as it may contain "./" etc. */
359*ef5ccd6cSJohn Marino if (function_sal->symtab != NULL
360*ef5ccd6cSJohn Marino && compare_filenames_for_search (function_sal->symtab->filename,
361*ef5ccd6cSJohn Marino e->filename))
362*ef5ccd6cSJohn Marino return 1;
363*ef5ccd6cSJohn Marino
364*ef5ccd6cSJohn Marino /* Before we invoke realpath, which can get expensive when many
365*ef5ccd6cSJohn Marino files are involved, do a quick comparison of the basenames. */
366*ef5ccd6cSJohn Marino if (!basenames_may_differ
367*ef5ccd6cSJohn Marino && (function_sal->symtab == NULL
368*ef5ccd6cSJohn Marino || filename_cmp (lbasename (function_sal->symtab->filename),
369*ef5ccd6cSJohn Marino lbasename (e->filename)) != 0))
370*ef5ccd6cSJohn Marino continue;
371*ef5ccd6cSJohn Marino
372*ef5ccd6cSJohn Marino /* Get the filename corresponding to this FUNCTION_SAL, if we haven't
373*ef5ccd6cSJohn Marino yet. */
374*ef5ccd6cSJohn Marino if (!searched_for_fullname)
375a45ae5f8SJohn Marino {
376*ef5ccd6cSJohn Marino if (function_sal->symtab != NULL)
377*ef5ccd6cSJohn Marino fullname = symtab_to_fullname (function_sal->symtab);
378*ef5ccd6cSJohn Marino searched_for_fullname = 1;
379a45ae5f8SJohn Marino }
380*ef5ccd6cSJohn Marino if (fullname != NULL
381*ef5ccd6cSJohn Marino && compare_filenames_for_search (fullname, e->filename))
382a45ae5f8SJohn Marino return 1;
383a45ae5f8SJohn Marino }
384a45ae5f8SJohn Marino }
385a45ae5f8SJohn Marino
386a45ae5f8SJohn Marino return 0;
387a45ae5f8SJohn Marino }
388a45ae5f8SJohn Marino
389*ef5ccd6cSJohn Marino /* Provide a prototype to silence -Wmissing-prototypes. */
390*ef5ccd6cSJohn Marino extern initialize_file_ftype _initialize_step_skip;
391a45ae5f8SJohn Marino
392a45ae5f8SJohn Marino void
_initialize_step_skip(void)393a45ae5f8SJohn Marino _initialize_step_skip (void)
394a45ae5f8SJohn Marino {
395*ef5ccd6cSJohn Marino static struct cmd_list_element *skiplist = NULL;
396a45ae5f8SJohn Marino struct cmd_list_element *c;
397a45ae5f8SJohn Marino
398a45ae5f8SJohn Marino skiplist_entry_chain = 0;
399a45ae5f8SJohn Marino skiplist_entry_count = 0;
400a45ae5f8SJohn Marino
401a45ae5f8SJohn Marino add_prefix_cmd ("skip", class_breakpoint, skip_function_command, _("\
402a45ae5f8SJohn Marino Ignore a function while stepping.\n\
403a45ae5f8SJohn Marino Usage: skip [FUNCTION NAME]\n\
404a45ae5f8SJohn Marino If no function name is given, ignore the current function."),
405a45ae5f8SJohn Marino &skiplist, "skip ", 1, &cmdlist);
406a45ae5f8SJohn Marino
407a45ae5f8SJohn Marino c = add_cmd ("file", class_breakpoint, skip_file_command, _("\
408a45ae5f8SJohn Marino Ignore a file while stepping.\n\
409a45ae5f8SJohn Marino Usage: skip file [FILENAME]\n\
410a45ae5f8SJohn Marino If no filename is given, ignore the current file."),
411a45ae5f8SJohn Marino &skiplist);
412a45ae5f8SJohn Marino set_cmd_completer (c, filename_completer);
413a45ae5f8SJohn Marino
414a45ae5f8SJohn Marino c = add_cmd ("function", class_breakpoint, skip_function_command, _("\
415a45ae5f8SJohn Marino Ignore a function while stepping.\n\
416a45ae5f8SJohn Marino Usage: skip function [FUNCTION NAME]\n\
417a45ae5f8SJohn Marino If no function name is given, skip the current function."),
418a45ae5f8SJohn Marino &skiplist);
419a45ae5f8SJohn Marino set_cmd_completer (c, location_completer);
420a45ae5f8SJohn Marino
421a45ae5f8SJohn Marino add_cmd ("enable", class_breakpoint, skip_enable_command, _("\
422a45ae5f8SJohn Marino Enable skip entries. You can specify numbers (e.g. \"skip enable 1 3\"), \
423a45ae5f8SJohn Marino ranges (e.g. \"skip enable 4-8\"), or both (e.g. \"skip enable 1 3 4-8\").\n\n\
424a45ae5f8SJohn Marino If you don't specify any numbers or ranges, we'll enable all skip entries.\n\n\
425a45ae5f8SJohn Marino Usage: skip enable [NUMBERS AND/OR RANGES]"),
426a45ae5f8SJohn Marino &skiplist);
427a45ae5f8SJohn Marino
428a45ae5f8SJohn Marino add_cmd ("disable", class_breakpoint, skip_disable_command, _("\
429a45ae5f8SJohn Marino Disable skip entries. You can specify numbers (e.g. \"skip disable 1 3\"), \
430a45ae5f8SJohn Marino ranges (e.g. \"skip disable 4-8\"), or both (e.g. \"skip disable 1 3 4-8\").\n\n\
431a45ae5f8SJohn Marino If you don't specify any numbers or ranges, we'll disable all skip entries.\n\n\
432a45ae5f8SJohn Marino Usage: skip disable [NUMBERS AND/OR RANGES]"),
433a45ae5f8SJohn Marino &skiplist);
434a45ae5f8SJohn Marino
435a45ae5f8SJohn Marino add_cmd ("delete", class_breakpoint, skip_delete_command, _("\
436a45ae5f8SJohn Marino Delete skip entries. You can specify numbers (e.g. \"skip delete 1 3\"), \
437a45ae5f8SJohn Marino ranges (e.g. \"skip delete 4-8\"), or both (e.g. \"skip delete 1 3 4-8\").\n\n\
438a45ae5f8SJohn Marino If you don't specify any numbers or ranges, we'll delete all skip entries.\n\n\
439a45ae5f8SJohn Marino Usage: skip delete [NUMBERS AND/OR RANGES]"),
440a45ae5f8SJohn Marino &skiplist);
441a45ae5f8SJohn Marino
442a45ae5f8SJohn Marino add_info ("skip", skip_info, _("\
443a45ae5f8SJohn Marino Display the status of skips. You can specify numbers (e.g. \"skip info 1 3\"), \
444a45ae5f8SJohn Marino ranges (e.g. \"skip info 4-8\"), or both (e.g. \"skip info 1 3 4-8\").\n\n\
445a45ae5f8SJohn Marino If you don't specify any numbers or ranges, we'll show all skips.\n\n\
446a45ae5f8SJohn Marino Usage: skip info [NUMBERS AND/OR RANGES]\n\
447a45ae5f8SJohn Marino The \"Type\" column indicates one of:\n\
448a45ae5f8SJohn Marino \tfile - ignored file\n\
449a45ae5f8SJohn Marino \tfunction - ignored function"));
450a45ae5f8SJohn Marino }
451