From patchwork Sun Sep 22 00:04:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 34632 Received: (qmail 92336 invoked by alias); 22 Sep 2019 00:04:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 92324 invoked by uid 89); 22 Sep 2019 00:04:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_SOFTFAIL autolearn=ham version=3.3.1 spammy=watching, 17277, HContent-Transfer-Encoding:8bit X-HELO: barracuda.ebox.ca Received: from barracuda.ebox.ca (HELO barracuda.ebox.ca) (96.127.255.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 22 Sep 2019 00:04:46 +0000 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id vojgtvkV5jQXm2Gb (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 21 Sep 2019 20:04:44 -0400 (EDT) Received: from simark.lan (unknown [192.222.164.54]) by smtp.ebox.ca (Postfix) with ESMTP id 70C49441B21; Sat, 21 Sep 2019 20:04:44 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [pushed] gdb: make watchpoint::val_valid a bool Date: Sat, 21 Sep 2019 20:04:44 -0400 Message-Id: <20190922000444.525896-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-IsSubscribed: yes gdb/ChangeLog: * breakpoint.h (struct watchpoint) : Change type to bool. * breakpoint.c (update_watchpoint): Assign false instead of 0, true instead of 1. (breakpoint_init_inferior): Likewise. (watchpoint_check): Likewise. (watch_command_1): Likewise. (invalidate_bp_value_on_memory_change): Likewise. --- gdb/breakpoint.c | 12 ++++++------ gdb/breakpoint.h | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8ef3aac0c1aa..838c9d136fd1 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1727,7 +1727,7 @@ update_watchpoint (struct watchpoint *b, int reparse) to the user when the old value and the new value may actually be completely different objects. */ b->val = NULL; - b->val_valid = 0; + b->val_valid = false; /* Note that unlike with breakpoints, the watchpoint's condition expression is stored in the breakpoint object, not in the @@ -1780,7 +1780,7 @@ update_watchpoint (struct watchpoint *b, int reparse) if (b->val_bitsize != 0) v = extract_bitfield_from_watchpoint_value (b, v); b->val = release_value (v); - b->val_valid = 1; + b->val_valid = true; } frame_pspace = get_frame_program_space (get_selected_frame (NULL)); @@ -3900,7 +3900,7 @@ breakpoint_init_inferior (enum inf_context context) /* Reset val field to force reread of starting value in insert_breakpoints. */ w->val.reset (nullptr); - w->val_valid = 0; + w->val_valid = false; } } } @@ -4877,7 +4877,7 @@ watchpoint_check (bpstat bs) { bs->old_val = b->val; b->val = release_value (new_val); - b->val_valid = 1; + b->val_valid = true; if (new_val != NULL) value_free_to_mark (mark); return WP_VALUE_CHANGED; @@ -10717,7 +10717,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty, w->val = val; w->val_bitpos = saved_bitpos; w->val_bitsize = saved_bitsize; - w->val_valid = 1; + w->val_valid = true; } if (cond_start) @@ -14375,7 +14375,7 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior, && addr + len > loc->address) { wp->val = NULL; - wp->val_valid = 0; + wp->val_valid = false; } } } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 80bb11c14168..9791032c5e84 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -817,9 +817,10 @@ struct watchpoint : public breakpoint we do not know the value yet or the value was not readable. VAL is never lazy. */ value_ref_ptr val; - /* Nonzero if VAL is valid. If VAL_VALID is set but VAL is NULL, + + /* True if VAL is valid. If VAL_VALID is set but VAL is NULL, then an error occurred reading the value. */ - int val_valid; + bool val_valid; /* When watching the location of a bitfield, contains the offset and size of the bitfield. Otherwise contains 0. */