• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revision16c4d54a71d8052988ed9c8005a03a7f934245f4 (tree)
Zeit2017-04-25 09:45:21
AutorPedro Alves <palves@redh...>
CommiterPedro Alves

Log Message

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"). :-)

src/gdb/breakpoint.c: In function ‘void init_raw_breakpoint_without_location(breakpoint*, gdbarch*, bptype, const breakpoint_ops*)’:
src/gdb/breakpoint.c:7447:28: error: use of deleted function ‘void* memset(T*, int, size_t) [with T = breakpoint; <template-parameter-1-2> = void; size_t = long unsigned int]’
memset (b, 0, sizeof (*b));


In file included from src/gdb/common/common-defs.h:85:0,

from src/gdb/defs.h:28,
from src/gdb/breakpoint.c:20:

src/gdb/common/poison.h:56:7: note: declared here
void *memset (T *s, int c, size_t n) = delete;


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.

Ändern Zusammenfassung

Diff

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
11 2017-04-25 Pedro Alves <palves@redhat.com>
22
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+
310 * btrace.c (pt_btrace_insn_flags): Change parameter type to
411 reference.
512 (pt_btrace_insn): New function.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7428,8 +7428,6 @@ init_raw_breakpoint_without_location (struct breakpoint *b,
74287428 enum bptype bptype,
74297429 const struct breakpoint_ops *ops)
74307430 {
7431- memset (b, 0, sizeof (*b));
7432-
74337431 gdb_assert (ops != NULL);
74347432
74357433 b->ops = ops;
@@ -7437,17 +7435,7 @@ init_raw_breakpoint_without_location (struct breakpoint *b,
74377435 b->gdbarch = gdbarch;
74387436 b->language = current_language->la_language;
74397437 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;
74497438 b->related_breakpoint = b;
7450- b->location = NULL;
74517439 }
74527440
74537441 /* Helper to set_raw_breakpoint below. Creates a breakpoint
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -681,45 +681,45 @@ extern int target_exact_watchpoints;
681681 struct breakpoint
682682 {
683683 /* Methods associated with this breakpoint. */
684- const struct breakpoint_ops *ops;
684+ const breakpoint_ops *ops = NULL;
685685
686- struct breakpoint *next;
686+ breakpoint *next = NULL;
687687 /* Type of breakpoint. */
688- enum bptype type;
688+ bptype type = bp_none;
689689 /* 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;
691691 /* What to do with this breakpoint after we hit it. */
692- enum bpdisp disposition;
692+ bpdisp disposition = disp_del;
693693 /* Number assigned to distinguish breakpoints. */
694- int number;
694+ int number = 0;
695695
696696 /* Location(s) associated with this high-level breakpoint. */
697- struct bp_location *loc;
697+ bp_location *loc = NULL;
698698
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;
704704 /* Number of stops at this breakpoint that should be continued
705705 automatically before really stopping. */
706- int ignore_count;
706+ int ignore_count = 0;
707707
708708 /* Number of stops at this breakpoint before it will be
709709 disabled. */
710- int enable_count;
710+ int enable_count = 0;
711711
712712 /* Chain of command lines to execute when this breakpoint is
713713 hit. */
714- struct counted_command_line *commands;
714+ counted_command_line *commands = NULL;
715715 /* Stack depth (address of frame). If nonzero, break only if fp
716716 equals this. */
717- struct frame_id frame_id;
717+ struct frame_id frame_id = null_frame_id;
718718
719719 /* The program space used to set the breakpoint. This is only set
720720 for breakpoints which are specific to a program space; for
721721 non-thread-specific ordinary breakpoints this is NULL. */
722- struct program_space *pspace;
722+ program_space *pspace = NULL;
723723
724724 /* Location we used to set the breakpoint. */
725725 event_location_up location;
@@ -727,60 +727,60 @@ struct breakpoint
727727 /* The filter that should be passed to decode_line_full when
728728 re-setting this breakpoint. This may be NULL, but otherwise is
729729 allocated with xmalloc. */
730- char *filter;
730+ char *filter = NULL;
731731
732732 /* For a ranged breakpoint, the location we used to find the end of
733733 the range. */
734734 event_location_up location_range_end;
735735
736736 /* Architecture we used to set the breakpoint. */
737- struct gdbarch *gdbarch;
737+ struct gdbarch *gdbarch = NULL;
738738 /* Language we used to set the breakpoint. */
739- enum language language;
739+ enum language language = language_unknown;
740740 /* Input radix we used to set the breakpoint. */
741- int input_radix;
741+ int input_radix = 0;
742742 /* String form of the breakpoint condition (malloc'd), or NULL if
743743 there is no condition. */
744- char *cond_string;
744+ char *cond_string = NULL;
745745
746746 /* String form of extra parameters, or NULL if there are none.
747747 Malloc'd. */
748- char *extra_string;
748+ char *extra_string = NULL;
749749
750750 /* Holds the address of the related watchpoint_scope breakpoint when
751751 using watchpoints on local variables (might the concept of a
752752 related breakpoint be useful elsewhere, if not just call it the
753753 watchpoint_scope breakpoint or something like that. FIXME). */
754- struct breakpoint *related_breakpoint;
754+ breakpoint *related_breakpoint = NULL;
755755
756756 /* Thread number for thread-specific breakpoint, or -1 if don't
757757 care. */
758- int thread;
758+ int thread = -1;
759759
760760 /* Ada task number for task-specific breakpoint, or 0 if don't
761761 care. */
762- int task;
762+ int task = 0;
763763
764764 /* Count of the number of times this breakpoint was taken, dumped
765765 with the info, but not used for anything else. Useful for seeing
766766 how many times you hit a break prior to the program aborting, so
767767 you can back up to just before the abort. */
768- int hit_count;
768+ int hit_count = 0;
769769
770770 /* Is breakpoint's condition not yet parsed because we found no
771771 location initially so had no context to parse the condition
772772 in. */
773- int condition_not_parsed;
773+ int condition_not_parsed = 0;
774774
775775 /* With a Python scripting enabled GDB, store a reference to the
776776 Python object that has been associated with this breakpoint.
777777 This is always NULL for a GDB that is not script enabled. It can
778778 sometimes be NULL for enabled GDBs as not all breakpoint types
779779 are tracked by the scripting language API. */
780- struct gdbpy_breakpoint_object *py_bp_object;
780+ gdbpy_breakpoint_object *py_bp_object = NULL;
781781
782782 /* Same as py_bp_object, but for Scheme. */
783- struct gdbscm_breakpoint_object *scm_bp_object;
783+ gdbscm_breakpoint_object *scm_bp_object = NULL;
784784 };
785785
786786 /* An instance of this type is used to represent a watchpoint. It