OLD | NEW |
1 /* Skipping uninteresting files and functions while stepping. | 1 /* Skipping uninteresting files and functions while stepping. |
2 | 2 |
3 Copyright (C) 2011-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2011-2012 Free Software Foundation, Inc. |
4 | 4 |
5 This program is free software; you can redistribute it and/or modify | 5 This program is free software; you can redistribute it and/or modify |
6 it under the terms of the GNU General Public License as published by | 6 it under the terms of the GNU General Public License as published by |
7 the Free Software Foundation; either version 3 of the License, or | 7 the Free Software Foundation; either version 3 of the License, or |
8 (at your option) any later version. | 8 (at your option) any later version. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, | 10 This program is distributed in the hope that it will be useful, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 int pending; | 60 int pending; |
61 | 61 |
62 struct skiplist_entry *next; | 62 struct skiplist_entry *next; |
63 }; | 63 }; |
64 | 64 |
65 static void skip_function_command (char *arg, int from_tty); | 65 static void skip_function_command (char *arg, int from_tty); |
66 static void skip_file_command (char *arg, int from_tty); | 66 static void skip_file_command (char *arg, int from_tty); |
67 static void skip_info (char *arg, int from_tty); | 67 static void skip_info (char *arg, int from_tty); |
68 | 68 |
69 static void add_skiplist_entry (struct skiplist_entry *e); | 69 static void add_skiplist_entry (struct skiplist_entry *e); |
70 static void skip_function_pc (CORE_ADDR pc, char *name, | 70 static void skip_function_pc (CORE_ADDR pc, const char *name, |
71 struct gdbarch *arch, | 71 struct gdbarch *arch, |
72 int pending); | 72 int pending); |
73 | 73 |
74 static struct skiplist_entry *skiplist_entry_chain; | 74 static struct skiplist_entry *skiplist_entry_chain; |
75 static int skiplist_entry_count; | 75 static int skiplist_entry_count; |
76 | 76 |
77 #define ALL_SKIPLIST_ENTRIES(E) \ | 77 #define ALL_SKIPLIST_ENTRIES(E) \ |
78 for (E = skiplist_entry_chain; E; E = E->next) | 78 for (E = skiplist_entry_chain; E; E = E->next) |
79 | 79 |
80 #define ALL_SKIPLIST_ENTRIES_SAFE(E,TMP) \ | 80 #define ALL_SKIPLIST_ENTRIES_SAFE(E,TMP) \ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 add_skiplist_entry (e); | 127 add_skiplist_entry (e); |
128 | 128 |
129 printf_filtered (_("File %s will be skipped when stepping.\n"), filename); | 129 printf_filtered (_("File %s will be skipped when stepping.\n"), filename); |
130 } | 130 } |
131 | 131 |
132 static void | 132 static void |
133 skip_function_command (char *arg, int from_tty) | 133 skip_function_command (char *arg, int from_tty) |
134 { | 134 { |
135 CORE_ADDR func_pc; | 135 CORE_ADDR func_pc; |
136 char *name = NULL; | 136 const char *name = NULL; |
137 | 137 |
138 /* Default to the current function if no argument is given. */ | 138 /* Default to the current function if no argument is given. */ |
139 if (arg == 0) | 139 if (arg == 0) |
140 { | 140 { |
141 CORE_ADDR pc; | 141 CORE_ADDR pc; |
142 if (!last_displayed_sal_is_valid ()) | 142 if (!last_displayed_sal_is_valid ()) |
143 error (_("No default function now.")); | 143 error (_("No default function now.")); |
144 | 144 |
145 pc = get_last_displayed_addr (); | 145 pc = get_last_displayed_addr (); |
146 if (!find_pc_partial_function (pc, &name, &func_pc, 0)) | 146 if (!find_pc_partial_function (pc, &name, &func_pc, 0)) |
147 { | 147 { |
148 error (_("No function found containing current program point %s."), | 148 error (_("No function found containing current program point %s."), |
149 paddress (get_current_arch (), pc)); | 149 paddress (get_current_arch (), pc)); |
150 } | 150 } |
151 skip_function_pc (func_pc, name, get_current_arch (), 0); | 151 skip_function_pc (func_pc, name, get_current_arch (), 0); |
152 } | 152 } |
153 else | 153 else |
154 { | 154 { |
155 /* Decode arg. We set funfirstline=1 so decode_line_1 will give us the | 155 /* Decode arg. We set funfirstline=1 so decode_line_1 will give us the |
156 first line of the function specified, if it can, and so that we'll | 156 first line of the function specified, if it can, and so that we'll |
157 reject variable names and the like. */ | 157 reject variable names and the like. */ |
158 | |
159 int i; | |
160 int pending = 0; | |
161 char *orig_arg = arg; /* decode_line_1 modifies the arg pointer. */ | 158 char *orig_arg = arg; /* decode_line_1 modifies the arg pointer. */ |
162 volatile struct gdb_exception decode_exception; | 159 volatile struct gdb_exception decode_exception; |
163 struct symtabs_and_lines sals = { 0 }; | 160 struct symtabs_and_lines sals = { 0 }; |
164 | 161 |
165 TRY_CATCH (decode_exception, RETURN_MASK_ERROR) | 162 TRY_CATCH (decode_exception, RETURN_MASK_ERROR) |
166 { | 163 { |
167 sals = decode_line_1 (&arg, DECODE_LINE_FUNFIRSTLINE, 0, 0); | 164 sals = decode_line_1 (&arg, DECODE_LINE_FUNFIRSTLINE, 0, 0); |
168 } | 165 } |
169 | 166 |
170 if (decode_exception.reason < 0) | 167 if (decode_exception.reason < 0) |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 387 } |
391 | 388 |
392 if (!found) | 389 if (!found) |
393 error (_("No skiplist entries found with number %s."), arg); | 390 error (_("No skiplist entries found with number %s."), arg); |
394 } | 391 } |
395 | 392 |
396 /* Create a skiplist entry for the given pc corresponding to the given | 393 /* Create a skiplist entry for the given pc corresponding to the given |
397 function name and add it to the list. */ | 394 function name and add it to the list. */ |
398 | 395 |
399 static void | 396 static void |
400 skip_function_pc (CORE_ADDR pc, char *name, struct gdbarch *arch, | 397 skip_function_pc (CORE_ADDR pc, const char *name, struct gdbarch *arch, |
401 int pending) | 398 int pending) |
402 { | 399 { |
403 struct skiplist_entry *e = XZALLOC (struct skiplist_entry); | 400 struct skiplist_entry *e = XZALLOC (struct skiplist_entry); |
404 | 401 |
405 e->pc = pc; | 402 e->pc = pc; |
406 e->gdbarch = arch; | 403 e->gdbarch = arch; |
407 e->enabled = 1; | 404 e->enabled = 1; |
408 e->pending = pending; | 405 e->pending = pending; |
409 e->function_name = xstrdup (name); | 406 e->function_name = xstrdup (name); |
410 | 407 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 sals = decode_line_1 (&func_name, DECODE_LINE_FUNFIRSTLINE, 0, 0); | 514 sals = decode_line_1 (&func_name, DECODE_LINE_FUNFIRSTLINE, 0, 0); |
518 } | 515 } |
519 | 516 |
520 if (decode_exception.reason >= 0 | 517 if (decode_exception.reason >= 0 |
521 && sals.nelts == 1 && strlen (func_name) == 0) | 518 && sals.nelts == 1 && strlen (func_name) == 0) |
522 { | 519 { |
523 struct symtab_and_line sal = sals.sals[0]; | 520 struct symtab_and_line sal = sals.sals[0]; |
524 CORE_ADDR pc = sal.pc; | 521 CORE_ADDR pc = sal.pc; |
525 CORE_ADDR func_start = 0; | 522 CORE_ADDR func_start = 0; |
526 struct gdbarch *arch = get_sal_arch (sal); | 523 struct gdbarch *arch = get_sal_arch (sal); |
527 char *func_name; | 524 const char *func_name; |
528 | 525 |
529 if (find_pc_partial_function (pc, &func_name, &func_start, 0)) | 526 if (find_pc_partial_function (pc, &func_name, &func_start, 0)) |
530 { | 527 { |
531 e->pending = 0; | 528 e->pending = 0; |
532 e->function_name = xstrdup (func_name); | 529 e->function_name = xstrdup (func_name); |
533 e->pc = func_start; | 530 e->pc = func_start; |
534 e->gdbarch = arch; | 531 e->gdbarch = arch; |
535 } | 532 } |
536 } | 533 } |
537 else | 534 else |
538 { | 535 { |
539 e->pending = 1; | 536 e->pending = 1; |
540 } | 537 } |
541 } | 538 } |
542 } | 539 } |
543 } | 540 } |
544 | 541 |
| 542 /* Provide a prototype to silence -Wmissing-prototypes. */ |
| 543 extern initialize_file_ftype _initialize_step_skip; |
| 544 |
545 void | 545 void |
546 _initialize_step_skip (void) | 546 _initialize_step_skip (void) |
547 { | 547 { |
548 struct cmd_list_element *c; | 548 struct cmd_list_element *c; |
549 | 549 |
550 skiplist_entry_chain = 0; | 550 skiplist_entry_chain = 0; |
551 skiplist_entry_count = 0; | 551 skiplist_entry_count = 0; |
552 | 552 |
553 add_prefix_cmd ("skip", class_breakpoint, skip_function_command, _("\ | 553 add_prefix_cmd ("skip", class_breakpoint, skip_function_command, _("\ |
554 Ignore a function while stepping.\n\ | 554 Ignore a function while stepping.\n\ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 | 593 |
594 add_info ("skip", skip_info, _("\ | 594 add_info ("skip", skip_info, _("\ |
595 Display the status of skips. You can specify numbers (e.g. \"skip info 1 3\"),
\ | 595 Display the status of skips. You can specify numbers (e.g. \"skip info 1 3\"),
\ |
596 ranges (e.g. \"skip info 4-8\"), or both (e.g. \"skip info 1 3 4-8\").\n\n\ | 596 ranges (e.g. \"skip info 4-8\"), or both (e.g. \"skip info 1 3 4-8\").\n\n\ |
597 If you don't specify any numbers or ranges, we'll show all skips.\n\n\ | 597 If you don't specify any numbers or ranges, we'll show all skips.\n\n\ |
598 Usage: skip info [NUMBERS AND/OR RANGES]\n\ | 598 Usage: skip info [NUMBERS AND/OR RANGES]\n\ |
599 The \"Type\" column indicates one of:\n\ | 599 The \"Type\" column indicates one of:\n\ |
600 \tfile - ignored file\n\ | 600 \tfile - ignored file\n\ |
601 \tfunction - ignored function")); | 601 \tfunction - ignored function")); |
602 } | 602 } |
OLD | NEW |