GNU Binutils with patches for OS216
Revision | 16c4d54a71d8052988ed9c8005a03a7f934245f4 (tree) |
---|---|
Zeit | 2017-04-25 09:45:21 |
Autor | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
Don't memset non-POD types: struct breakpoint
Eh, struct breakpoint was made non-POD just today, with commit
d28cd78ad820e3 ("Change breakpoint event locations to
event_location_up"). :-)
from src/gdb/defs.h:28,
from src/gdb/breakpoint.c:20:
gdb/ChangeLog:
2017-04-25 Pedro Alves <palves@redhat.com>
* breakpoint.h (struct breakpoint): In-class initialize all
fields. Make boolean fields "bool".
* breakpoint.c (init_raw_breakpoint_without_location): Remove
memset call and initializations no longer necessary.
@@ -1,5 +1,12 @@ | ||
1 | 1 | 2017-04-25 Pedro Alves <palves@redhat.com> |
2 | 2 | |
3 | + * breakpoint.h (struct breakpoint): In-class initialize all | |
4 | + fields. Make boolean fields "bool". | |
5 | + * breakpoint.c (init_raw_breakpoint_without_location): Remove | |
6 | + memset call and initializations no longer necessary. | |
7 | + | |
8 | +2017-04-25 Pedro Alves <palves@redhat.com> | |
9 | + | |
3 | 10 | * btrace.c (pt_btrace_insn_flags): Change parameter type to |
4 | 11 | reference. |
5 | 12 | (pt_btrace_insn): New function. |
@@ -7428,8 +7428,6 @@ init_raw_breakpoint_without_location (struct breakpoint *b, | ||
7428 | 7428 | enum bptype bptype, |
7429 | 7429 | const struct breakpoint_ops *ops) |
7430 | 7430 | { |
7431 | - memset (b, 0, sizeof (*b)); | |
7432 | - | |
7433 | 7431 | gdb_assert (ops != NULL); |
7434 | 7432 | |
7435 | 7433 | b->ops = ops; |
@@ -7437,17 +7435,7 @@ init_raw_breakpoint_without_location (struct breakpoint *b, | ||
7437 | 7435 | b->gdbarch = gdbarch; |
7438 | 7436 | b->language = current_language->la_language; |
7439 | 7437 | b->input_radix = input_radix; |
7440 | - b->thread = -1; | |
7441 | - b->enable_state = bp_enabled; | |
7442 | - b->next = 0; | |
7443 | - b->silent = 0; | |
7444 | - b->ignore_count = 0; | |
7445 | - b->commands = NULL; | |
7446 | - b->frame_id = null_frame_id; | |
7447 | - b->condition_not_parsed = 0; | |
7448 | - b->py_bp_object = NULL; | |
7449 | 7438 | b->related_breakpoint = b; |
7450 | - b->location = NULL; | |
7451 | 7439 | } |
7452 | 7440 | |
7453 | 7441 | /* Helper to set_raw_breakpoint below. Creates a breakpoint |
@@ -681,45 +681,45 @@ extern int target_exact_watchpoints; | ||
681 | 681 | struct breakpoint |
682 | 682 | { |
683 | 683 | /* Methods associated with this breakpoint. */ |
684 | - const struct breakpoint_ops *ops; | |
684 | + const breakpoint_ops *ops = NULL; | |
685 | 685 | |
686 | - struct breakpoint *next; | |
686 | + breakpoint *next = NULL; | |
687 | 687 | /* Type of breakpoint. */ |
688 | - enum bptype type; | |
688 | + bptype type = bp_none; | |
689 | 689 | /* Zero means disabled; remember the info but don't break here. */ |
690 | - enum enable_state enable_state; | |
690 | + enum enable_state enable_state = bp_enabled; | |
691 | 691 | /* What to do with this breakpoint after we hit it. */ |
692 | - enum bpdisp disposition; | |
692 | + bpdisp disposition = disp_del; | |
693 | 693 | /* Number assigned to distinguish breakpoints. */ |
694 | - int number; | |
694 | + int number = 0; | |
695 | 695 | |
696 | 696 | /* Location(s) associated with this high-level breakpoint. */ |
697 | - struct bp_location *loc; | |
697 | + bp_location *loc = NULL; | |
698 | 698 | |
699 | - /* Non-zero means a silent breakpoint (don't print frame info if we | |
700 | - stop here). */ | |
701 | - unsigned char silent; | |
702 | - /* Non-zero means display ADDR_STRING to the user verbatim. */ | |
703 | - unsigned char display_canonical; | |
699 | + /* True means a silent breakpoint (don't print frame info if we stop | |
700 | + here). */ | |
701 | + bool silent = false; | |
702 | + /* True means display ADDR_STRING to the user verbatim. */ | |
703 | + bool display_canonical = false; | |
704 | 704 | /* Number of stops at this breakpoint that should be continued |
705 | 705 | automatically before really stopping. */ |
706 | - int ignore_count; | |
706 | + int ignore_count = 0; | |
707 | 707 | |
708 | 708 | /* Number of stops at this breakpoint before it will be |
709 | 709 | disabled. */ |
710 | - int enable_count; | |
710 | + int enable_count = 0; | |
711 | 711 | |
712 | 712 | /* Chain of command lines to execute when this breakpoint is |
713 | 713 | hit. */ |
714 | - struct counted_command_line *commands; | |
714 | + counted_command_line *commands = NULL; | |
715 | 715 | /* Stack depth (address of frame). If nonzero, break only if fp |
716 | 716 | equals this. */ |
717 | - struct frame_id frame_id; | |
717 | + struct frame_id frame_id = null_frame_id; | |
718 | 718 | |
719 | 719 | /* The program space used to set the breakpoint. This is only set |
720 | 720 | for breakpoints which are specific to a program space; for |
721 | 721 | non-thread-specific ordinary breakpoints this is NULL. */ |
722 | - struct program_space *pspace; | |
722 | + program_space *pspace = NULL; | |
723 | 723 | |
724 | 724 | /* Location we used to set the breakpoint. */ |
725 | 725 | event_location_up location; |
@@ -727,60 +727,60 @@ struct breakpoint | ||
727 | 727 | /* The filter that should be passed to decode_line_full when |
728 | 728 | re-setting this breakpoint. This may be NULL, but otherwise is |
729 | 729 | allocated with xmalloc. */ |
730 | - char *filter; | |
730 | + char *filter = NULL; | |
731 | 731 | |
732 | 732 | /* For a ranged breakpoint, the location we used to find the end of |
733 | 733 | the range. */ |
734 | 734 | event_location_up location_range_end; |
735 | 735 | |
736 | 736 | /* Architecture we used to set the breakpoint. */ |
737 | - struct gdbarch *gdbarch; | |
737 | + struct gdbarch *gdbarch = NULL; | |
738 | 738 | /* Language we used to set the breakpoint. */ |
739 | - enum language language; | |
739 | + enum language language = language_unknown; | |
740 | 740 | /* Input radix we used to set the breakpoint. */ |
741 | - int input_radix; | |
741 | + int input_radix = 0; | |
742 | 742 | /* String form of the breakpoint condition (malloc'd), or NULL if |
743 | 743 | there is no condition. */ |
744 | - char *cond_string; | |
744 | + char *cond_string = NULL; | |
745 | 745 | |
746 | 746 | /* String form of extra parameters, or NULL if there are none. |
747 | 747 | Malloc'd. */ |
748 | - char *extra_string; | |
748 | + char *extra_string = NULL; | |
749 | 749 | |
750 | 750 | /* Holds the address of the related watchpoint_scope breakpoint when |
751 | 751 | using watchpoints on local variables (might the concept of a |
752 | 752 | related breakpoint be useful elsewhere, if not just call it the |
753 | 753 | watchpoint_scope breakpoint or something like that. FIXME). */ |
754 | - struct breakpoint *related_breakpoint; | |
754 | + breakpoint *related_breakpoint = NULL; | |
755 | 755 | |
756 | 756 | /* Thread number for thread-specific breakpoint, or -1 if don't |
757 | 757 | care. */ |
758 | - int thread; | |
758 | + int thread = -1; | |
759 | 759 | |
760 | 760 | /* Ada task number for task-specific breakpoint, or 0 if don't |
761 | 761 | care. */ |
762 | - int task; | |
762 | + int task = 0; | |
763 | 763 | |
764 | 764 | /* Count of the number of times this breakpoint was taken, dumped |
765 | 765 | with the info, but not used for anything else. Useful for seeing |
766 | 766 | how many times you hit a break prior to the program aborting, so |
767 | 767 | you can back up to just before the abort. */ |
768 | - int hit_count; | |
768 | + int hit_count = 0; | |
769 | 769 | |
770 | 770 | /* Is breakpoint's condition not yet parsed because we found no |
771 | 771 | location initially so had no context to parse the condition |
772 | 772 | in. */ |
773 | - int condition_not_parsed; | |
773 | + int condition_not_parsed = 0; | |
774 | 774 | |
775 | 775 | /* With a Python scripting enabled GDB, store a reference to the |
776 | 776 | Python object that has been associated with this breakpoint. |
777 | 777 | This is always NULL for a GDB that is not script enabled. It can |
778 | 778 | sometimes be NULL for enabled GDBs as not all breakpoint types |
779 | 779 | are tracked by the scripting language API. */ |
780 | - struct gdbpy_breakpoint_object *py_bp_object; | |
780 | + gdbpy_breakpoint_object *py_bp_object = NULL; | |
781 | 781 | |
782 | 782 | /* Same as py_bp_object, but for Scheme. */ |
783 | - struct gdbscm_breakpoint_object *scm_bp_object; | |
783 | + gdbscm_breakpoint_object *scm_bp_object = NULL; | |
784 | 784 | }; |
785 | 785 | |
786 | 786 | /* An instance of this type is used to represent a watchpoint. It |