Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: gdb/breakpoint.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/breakpoint.h ('k') | gdb/bsd-uthread.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
None
OLDNEW
1 /* Everything about breakpoints, for GDB. 1 /* Everything about breakpoints, for GDB.
2 2
3 Copyright (C) 1986-2012 Free Software Foundation, Inc. 3 Copyright (C) 1986-2012 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "cli/cli-script.h" 49 #include "cli/cli-script.h"
50 #include "gdb_assert.h" 50 #include "gdb_assert.h"
51 #include "block.h" 51 #include "block.h"
52 #include "solib.h" 52 #include "solib.h"
53 #include "solist.h" 53 #include "solist.h"
54 #include "observer.h" 54 #include "observer.h"
55 #include "exceptions.h" 55 #include "exceptions.h"
56 #include "memattr.h" 56 #include "memattr.h"
57 #include "ada-lang.h" 57 #include "ada-lang.h"
58 #include "top.h" 58 #include "top.h"
59 #include "wrapper.h"
60 #include "valprint.h" 59 #include "valprint.h"
61 #include "jit.h" 60 #include "jit.h"
62 #include "xml-syscall.h" 61 #include "xml-syscall.h"
63 #include "parser-defs.h" 62 #include "parser-defs.h"
63 #include "gdb_regex.h"
64 #include "probe.h"
64 #include "cli/cli-utils.h" 65 #include "cli/cli-utils.h"
65 #include "continuations.h" 66 #include "continuations.h"
66 #include "stack.h" 67 #include "stack.h"
67 #include "skip.h" 68 #include "skip.h"
68 #include "record.h" 69 #include "gdb_regex.h"
70 #include "ax-gdb.h"
71 #include "dummy-frame.h"
72
73 #include "format.h"
69 74
70 /* readline include files */ 75 /* readline include files */
71 #include "readline/readline.h" 76 #include "readline/readline.h"
72 #include "readline/history.h" 77 #include "readline/history.h"
73 78
74 /* readline defines this. */ 79 /* readline defines this. */
75 #undef savestring 80 #undef savestring
76 81
77 #include "mi/mi-common.h" 82 #include "mi/mi-common.h"
78 #include "python/python.h" 83 #include "python/python.h"
79 84
80 /* Prototypes for local functions. */ 85 /* Prototypes for local functions. */
81 86
82 static void enable_delete_command (char *, int); 87 static void enable_delete_command (char *, int);
83 88
84 static void enable_once_command (char *, int); 89 static void enable_once_command (char *, int);
85 90
91 static void enable_count_command (char *, int);
92
86 static void disable_command (char *, int); 93 static void disable_command (char *, int);
87 94
88 static void enable_command (char *, int); 95 static void enable_command (char *, int);
89 96
90 static void map_breakpoint_numbers (char *, void (*) (struct breakpoint *, 97 static void map_breakpoint_numbers (char *, void (*) (struct breakpoint *,
91 void *), 98 void *),
92 void *); 99 void *);
93 100
94 static void ignore_command (char *, int); 101 static void ignore_command (char *, int);
95 102
96 static int breakpoint_re_set_one (void *); 103 static int breakpoint_re_set_one (void *);
97 104
98 static void breakpoint_re_set_default (struct breakpoint *); 105 static void breakpoint_re_set_default (struct breakpoint *);
99 106
107 static void create_sals_from_address_default (char **,
108 struct linespec_result *,
109 enum bptype, char *,
110 char **);
111
112 static void create_breakpoints_sal_default (struct gdbarch *,
113 struct linespec_result *,
114 struct linespec_sals *,
115 char *, char *, enum bptype,
116 enum bpdisp, int, int,
117 int,
118 const struct breakpoint_ops *,
119 int, int, int, unsigned);
120
121 static void decode_linespec_default (struct breakpoint *, char **,
122 struct symtabs_and_lines *);
123
100 static void clear_command (char *, int); 124 static void clear_command (char *, int);
101 125
102 static void catch_command (char *, int); 126 static void catch_command (char *, int);
103 127
104 static int can_use_hardware_watchpoint (struct value *); 128 static int can_use_hardware_watchpoint (struct value *);
105 129
106 static void break_command_1 (char *, int, int); 130 static void break_command_1 (char *, int, int);
107 131
108 static void mention (struct breakpoint *); 132 static void mention (struct breakpoint *);
109 133
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 static int hw_watchpoint_use_count (struct breakpoint *); 207 static int hw_watchpoint_use_count (struct breakpoint *);
184 208
185 static int hw_watchpoint_used_count_others (struct breakpoint *except, 209 static int hw_watchpoint_used_count_others (struct breakpoint *except,
186 enum bptype type, 210 enum bptype type,
187 int *other_type_used); 211 int *other_type_used);
188 212
189 static void hbreak_command (char *, int); 213 static void hbreak_command (char *, int);
190 214
191 static void thbreak_command (char *, int); 215 static void thbreak_command (char *, int);
192 216
193 static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp); 217 static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
218 » » » » int count);
194 219
195 static void stop_command (char *arg, int from_tty); 220 static void stop_command (char *arg, int from_tty);
196 221
197 static void stopin_command (char *arg, int from_tty); 222 static void stopin_command (char *arg, int from_tty);
198 223
199 static void stopat_command (char *arg, int from_tty); 224 static void stopat_command (char *arg, int from_tty);
200 225
201 static char *ep_parse_optional_if_clause (char **arg); 226 static char *ep_parse_optional_if_clause (char **arg);
202 227
203 static void catch_exception_command_1 (enum exception_event_kind ex_event, 228 static void catch_exception_command_1 (enum exception_event_kind ex_event,
(...skipping 27 matching lines...) Expand all
231 static void delete_trace_command (char *, int); 256 static void delete_trace_command (char *, int);
232 257
233 static void enable_trace_command (char *, int); 258 static void enable_trace_command (char *, int);
234 259
235 static void disable_trace_command (char *, int); 260 static void disable_trace_command (char *, int);
236 261
237 static void trace_pass_command (char *, int); 262 static void trace_pass_command (char *, int);
238 263
239 static int is_masked_watchpoint (const struct breakpoint *b); 264 static int is_masked_watchpoint (const struct breakpoint *b);
240 265
241 /* Assuming we're creating a static tracepoint, does S look like a 266 static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address);
242 static tracepoint marker spec ("-m MARKER_ID")? */ 267
243 #define is_marker_spec(s)» » » » » » \ 268 /* Return 1 if B refers to a static tracepoint set by marker ("-m"), zero
244 (s != NULL && strncmp (s, "-m", 2) == 0 && ((s)[2] == ' ' || (s)[2] == '\t')) 269 otherwise. */
270
271 static int strace_marker_p (struct breakpoint *b);
272
273 static void init_catchpoint (struct breakpoint *b,
274 » » » struct gdbarch *gdbarch, int tempflag,
275 » » » char *cond_string,
276 » » » const struct breakpoint_ops *ops);
245 277
246 /* The abstract base class all breakpoint_ops structures inherit 278 /* The abstract base class all breakpoint_ops structures inherit
247 from. */ 279 from. */
248 static struct breakpoint_ops base_breakpoint_ops; 280 static struct breakpoint_ops base_breakpoint_ops;
249 281
250 /* The breakpoint_ops structure to be inherited by all breakpoint_ops 282 /* The breakpoint_ops structure to be inherited by all breakpoint_ops
251 that are implemented on top of software or hardware breakpoints 283 that are implemented on top of software or hardware breakpoints
252 (user breakpoints, internal and momentary breakpoints, etc.). */ 284 (user breakpoints, internal and momentary breakpoints, etc.). */
253 static struct breakpoint_ops bkpt_base_breakpoint_ops; 285 static struct breakpoint_ops bkpt_base_breakpoint_ops;
254 286
255 /* Internal breakpoints class type. */ 287 /* Internal breakpoints class type. */
256 static struct breakpoint_ops internal_breakpoint_ops; 288 static struct breakpoint_ops internal_breakpoint_ops;
257 289
258 /* Momentary breakpoints class type. */ 290 /* Momentary breakpoints class type. */
259 static struct breakpoint_ops momentary_breakpoint_ops; 291 static struct breakpoint_ops momentary_breakpoint_ops;
260 292
293 /* Momentary breakpoints for bp_longjmp and bp_exception class type. */
294 static struct breakpoint_ops longjmp_breakpoint_ops;
295
261 /* The breakpoint_ops structure to be used in regular user created 296 /* The breakpoint_ops structure to be used in regular user created
262 breakpoints. */ 297 breakpoints. */
263 struct breakpoint_ops bkpt_breakpoint_ops; 298 struct breakpoint_ops bkpt_breakpoint_ops;
264 299
300 /* Breakpoints set on probes. */
301 static struct breakpoint_ops bkpt_probe_breakpoint_ops;
302
303 /* Dynamic printf class type. */
304 static struct breakpoint_ops dprintf_breakpoint_ops;
305
306 /* The style in which to perform a dynamic printf. This is a user
307 option because different output options have different tradeoffs;
308 if GDB does the printing, there is better error handling if there
309 is a problem with any of the arguments, but using an inferior
310 function lets you have special-purpose printers and sending of
311 output to the same place as compiled-in print functions. */
312
313 static const char dprintf_style_gdb[] = "gdb";
314 static const char dprintf_style_call[] = "call";
315 static const char dprintf_style_agent[] = "agent";
316 static const char *const dprintf_style_enums[] = {
317 dprintf_style_gdb,
318 dprintf_style_call,
319 dprintf_style_agent,
320 NULL
321 };
322 static const char *dprintf_style = dprintf_style_gdb;
323
324 /* The function to use for dynamic printf if the preferred style is to
325 call into the inferior. The value is simply a string that is
326 copied into the command, so it can be anything that GDB can
327 evaluate to a callable address, not necessarily a function name. */
328
329 static char *dprintf_function = "";
330
331 /* The channel to use for dynamic printf if the preferred style is to
332 call into the inferior; if a nonempty string, it will be passed to
333 the call as the first argument, with the format string as the
334 second. As with the dprintf function, this can be anything that
335 GDB knows how to evaluate, so in addition to common choices like
336 "stderr", this could be an app-specific expression like
337 "mystreams[curlogger]". */
338
339 static char *dprintf_channel = "";
340
341 /* True if dprintf commands should continue to operate even if GDB
342 has disconnected. */
343 static int disconnected_dprintf = 1;
344
265 /* A reference-counted struct command_line. This lets multiple 345 /* A reference-counted struct command_line. This lets multiple
266 breakpoints share a single command list. */ 346 breakpoints share a single command list. */
267 struct counted_command_line 347 struct counted_command_line
268 { 348 {
269 /* The reference count. */ 349 /* The reference count. */
270 int refc; 350 int refc;
271 351
272 /* The command list. */ 352 /* The command list. */
273 struct command_line *commands; 353 struct command_line *commands;
274 }; 354 };
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 _("Automatic usage of hardware breakpoints is %s.\n"), 421 _("Automatic usage of hardware breakpoints is %s.\n"),
342 value); 422 value);
343 } 423 }
344 424
345 /* If on, gdb will keep breakpoints inserted even as inferior is 425 /* If on, gdb will keep breakpoints inserted even as inferior is
346 stopped, and immediately insert any new breakpoints. If off, gdb 426 stopped, and immediately insert any new breakpoints. If off, gdb
347 will insert breakpoints into inferior only when resuming it, and 427 will insert breakpoints into inferior only when resuming it, and
348 will remove breakpoints upon stop. If auto, GDB will behave as ON 428 will remove breakpoints upon stop. If auto, GDB will behave as ON
349 if in non-stop mode, and as OFF if all-stop mode.*/ 429 if in non-stop mode, and as OFF if all-stop mode.*/
350 430
351 static const char always_inserted_auto[] = "auto"; 431 static enum auto_boolean always_inserted_mode = AUTO_BOOLEAN_AUTO;
352 static const char always_inserted_on[] = "on"; 432
353 static const char always_inserted_off[] = "off";
354 static const char *always_inserted_enums[] = {
355 always_inserted_auto,
356 always_inserted_off,
357 always_inserted_on,
358 NULL
359 };
360 static const char *always_inserted_mode = always_inserted_auto;
361 static void 433 static void
362 show_always_inserted_mode (struct ui_file *file, int from_tty, 434 show_always_inserted_mode (struct ui_file *file, int from_tty,
363 struct cmd_list_element *c, const char *value) 435 struct cmd_list_element *c, const char *value)
364 { 436 {
365 if (always_inserted_mode == always_inserted_auto) 437 if (always_inserted_mode == AUTO_BOOLEAN_AUTO)
366 fprintf_filtered (file, 438 fprintf_filtered (file,
367 _("Always inserted breakpoint " 439 _("Always inserted breakpoint "
368 "mode is %s (currently %s).\n"), 440 "mode is %s (currently %s).\n"),
369 value, 441 value,
370 breakpoints_always_inserted_mode () ? "on" : "off"); 442 breakpoints_always_inserted_mode () ? "on" : "off");
371 else 443 else
372 fprintf_filtered (file, _("Always inserted breakpoint mode is %s.\n"), 444 fprintf_filtered (file, _("Always inserted breakpoint mode is %s.\n"),
373 value); 445 value);
374 } 446 }
375 447
376 int 448 int
377 breakpoints_always_inserted_mode (void) 449 breakpoints_always_inserted_mode (void)
378 { 450 {
379 return ((always_inserted_mode == always_inserted_on 451 return (always_inserted_mode == AUTO_BOOLEAN_TRUE
380 » || (always_inserted_mode == always_inserted_auto && non_stop)) 452 » || (always_inserted_mode == AUTO_BOOLEAN_AUTO && non_stop));
381 » && !RECORD_IS_USED); 453 }
454
455 static const char condition_evaluation_both[] = "host or target";
456
457 /* Modes for breakpoint condition evaluation. */
458 static const char condition_evaluation_auto[] = "auto";
459 static const char condition_evaluation_host[] = "host";
460 static const char condition_evaluation_target[] = "target";
461 static const char *const condition_evaluation_enums[] = {
462 condition_evaluation_auto,
463 condition_evaluation_host,
464 condition_evaluation_target,
465 NULL
466 };
467
468 /* Global that holds the current mode for breakpoint condition evaluation. */
469 static const char *condition_evaluation_mode_1 = condition_evaluation_auto;
470
471 /* Global that we use to display information to the user (gets its value from
472 condition_evaluation_mode_1. */
473 static const char *condition_evaluation_mode = condition_evaluation_auto;
474
475 /* Translate a condition evaluation mode MODE into either "host"
476 or "target". This is used mostly to translate from "auto" to the
477 real setting that is being used. It returns the translated
478 evaluation mode. */
479
480 static const char *
481 translate_condition_evaluation_mode (const char *mode)
482 {
483 if (mode == condition_evaluation_auto)
484 {
485 if (target_supports_evaluation_of_breakpoint_conditions ())
486 » return condition_evaluation_target;
487 else
488 » return condition_evaluation_host;
489 }
490 else
491 return mode;
492 }
493
494 /* Discovers what condition_evaluation_auto translates to. */
495
496 static const char *
497 breakpoint_condition_evaluation_mode (void)
498 {
499 return translate_condition_evaluation_mode (condition_evaluation_mode);
500 }
501
502 /* Return true if GDB should evaluate breakpoint conditions or false
503 otherwise. */
504
505 static int
506 gdb_evaluates_breakpoint_condition_p (void)
507 {
508 const char *mode = breakpoint_condition_evaluation_mode ();
509
510 return (mode == condition_evaluation_host);
382 } 511 }
383 512
384 void _initialize_breakpoint (void); 513 void _initialize_breakpoint (void);
385 514
386 /* Are we executing breakpoint commands? */ 515 /* Are we executing breakpoint commands? */
387 static int executing_breakpoint_commands; 516 static int executing_breakpoint_commands;
388 517
389 /* Are overlay event breakpoints enabled? */ 518 /* Are overlay event breakpoints enabled? */
390 static int overlay_events_enabled; 519 static int overlay_events_enabled;
391 520
(...skipping 13 matching lines...) Expand all
405 534
406 /* Similar iterator for the low-level breakpoints. SAFE variant is 535 /* Similar iterator for the low-level breakpoints. SAFE variant is
407 not provided so update_global_location_list must not be called 536 not provided so update_global_location_list must not be called
408 while executing the block of ALL_BP_LOCATIONS. */ 537 while executing the block of ALL_BP_LOCATIONS. */
409 538
410 #define ALL_BP_LOCATIONS(B,BP_TMP) \ 539 #define ALL_BP_LOCATIONS(B,BP_TMP) \
411 for (BP_TMP = bp_location; \ 540 for (BP_TMP = bp_location; \
412 BP_TMP < bp_location + bp_location_count && (B = *BP_TMP); \ 541 BP_TMP < bp_location + bp_location_count && (B = *BP_TMP); \
413 BP_TMP++) 542 BP_TMP++)
414 543
544 /* Iterates through locations with address ADDRESS for the currently selected
545 program space. BP_LOCP_TMP points to each object. BP_LOCP_START points
546 to where the loop should start from.
547 If BP_LOCP_START is a NULL pointer, the macro automatically seeks the
548 appropriate location to start with. */
549
550 #define ALL_BP_LOCATIONS_AT_ADDR(BP_LOCP_TMP, BP_LOCP_START, ADDRESS) \
551 for (BP_LOCP_START = BP_LOCP_START == NULL ? get_first_locp_gte_addr (AD DRESS) : BP_LOCP_START, \
552 BP_LOCP_TMP = BP_LOCP_START; \
553 BP_LOCP_START \
554 && (BP_LOCP_TMP < bp_location + bp_location_count \
555 && (*BP_LOCP_TMP)->address == ADDRESS); \
556 BP_LOCP_TMP++)
557
415 /* Iterator for tracepoints only. */ 558 /* Iterator for tracepoints only. */
416 559
417 #define ALL_TRACEPOINTS(B) \ 560 #define ALL_TRACEPOINTS(B) \
418 for (B = breakpoint_chain; B; B = B->next) \ 561 for (B = breakpoint_chain; B; B = B->next) \
419 if (is_tracepoint (B)) 562 if (is_tracepoint (B))
420 563
421 /* Chains of all breakpoints defined. */ 564 /* Chains of all breakpoints defined. */
422 565
423 struct breakpoint *breakpoint_chain; 566 struct breakpoint *breakpoint_chain;
424 567
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 struct breakpoint * 728 struct breakpoint *
586 get_breakpoint (int num) 729 get_breakpoint (int num)
587 { 730 {
588 struct breakpoint *b; 731 struct breakpoint *b;
589 732
590 ALL_BREAKPOINTS (b) 733 ALL_BREAKPOINTS (b)
591 if (b->number == num) 734 if (b->number == num)
592 return b; 735 return b;
593 736
594 return NULL; 737 return NULL;

error: old chunk mismatch

OLDNEW
« no previous file with comments | « gdb/breakpoint.h ('k') | gdb/bsd-uthread.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698